// License: Modified MIT (NON-AI) // See the LICENSE file in the root directory for license information. // Copyright 2025 Timothy Prepscius #pragma once #include #include #include #include "../threads/Lock.hpp" #include "../ptr/Ptr.hpp" namespace tjp { namespace core { namespace string_dictionary { struct Instance; struct Entry; struct Dictionary; struct Reference { StrongPtr entry; operator const std::string &() const; operator const std::string_view () const; } ; struct Entry { StrongPtr container; const std::string value; Entry(const StrongPtr &container, std::string &&string); ~Entry (); } ; bool operator ==(const Reference &lhs, const Reference &rhs); bool operator ==(const Reference &lhs, const std::string &r); bool operator ==(const Reference &lhs, const std::string_view &r); bool operator ==(const Reference &lhs, const char *r); bool operator ==(const std::string &l, const Reference &rhs); bool operator ==(const std::string_view &l, const Reference &rhs); bool operator ==(const char *l, const Reference &rhs); bool operator !=(const Reference &lhs, const Reference &rhs); bool operator !=(const Reference &lhs, const std::string &r); bool operator !=(const Reference &lhs, const std::string_view &r); bool operator !=(const Reference &lhs, const char *r); bool operator !=(const std::string &l, const Reference &rhs); bool operator !=(const std::string_view &l, const Reference &rhs); bool operator !=(const char *l, const Reference &rhs); bool operator <(const Reference &lhs, const Reference &rhs); bool operator <(const Reference &lhs, const std::string &r); bool operator <(const Reference &lhs, const std::string_view &r); bool operator <(const Reference &lhs, const char *r); bool operator <(const std::string &l, const Reference &rhs); bool operator <(const std::string_view &l, const Reference &rhs); bool operator <(const char *l, const Reference &rhs); // ---- struct Dictionary : StrongThis { Mutex mutex; std::map> entries; void remove(Entry *entry); Reference get(const std::string_view &value); Reference get(const std::string &value); Reference get(std::string &&value); Reference get(const char *value); } ; } // namespace using StringDictionary = string_dictionary::Dictionary; using StringRef = string_dictionary::Reference; } // namespace } // namespace #include "Dictionary.inl"