#pragma once #include #include #include namespace nodes { class SymbolDocs { public: SymbolDocs() {} SymbolDocs(std::string &&description) : description_(std::move(description)) {} SymbolDocs(const std::string &description) : description_(description) {} bool add_annotation_info(const std::string &annotation, std::string &&info) { if (annotations_info_.count(annotation) == 0) { annotations_info_[annotation] = std::move(info); return true; } return false; } bool add_annotation_info(const std::string &annotation, const std::string &info) { if (annotations_info_.count(annotation) == 0) { annotations_info_[annotation] = info; return true; } return false; } std::optional get_description() { if (description_.has_value()) { return &description_.value(); } return std::nullopt; } std::optional get_description() const { if (description_.has_value()) { return &description_.value(); } return std::nullopt; } 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::optional description_; std::unordered_map annotations_info_; }; } // namespace nodes