#pragma once #include #include #include namespace nodes { class SymbolDocs { public: SymbolDocs(std::string &&description) : description_(std::move(description)) {} SymbolDocs(const std::string &description) : description_(description) {} template bool add_annotation_info(const std::string &annotation, T &&info) { if (annotations_info_.count(annotation) == 0) { annotations_info_[annotation] = std::forward(info); return true; } return false; } std::string *get_description() { return &description_; } const std::string *get_description() const { return &description_; } std::optional get_annotation_info(const std::string &annotation) { auto info_iterator = annotations_info_.find(annotation); if (info_iterator != annotations_info_.end()) { return &info_iterator->second; } return std::nullopt; } std::optional get_annotation_info(const std::string &annotation) const { auto info_iterator = annotations_info_.find(annotation); if (info_iterator != annotations_info_.end()) { return &info_iterator->second; } return std::nullopt; } private: std::string description_; std::unordered_map annotations_info_; }; } // namespace nodes