KvDocument.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-12-25
  6. * Changed: 2023-02-06
  7. *
  8. * */
  9. #ifndef LS_STD_KV_DOCUMENT_HPP
  10. #define LS_STD_KV_DOCUMENT_HPP
  11. #include "KvPair.hpp"
  12. #include <ls-std/core/Class.hpp>
  13. #include <ls-std/core/types/KvTypes.hpp>
  14. #include <ls-std/os/dynamic-goal.hpp>
  15. #include <map>
  16. namespace ls::std::io
  17. {
  18. class LS_STD_DYNAMIC_GOAL KvDocument : public ls::std::core::Class
  19. {
  20. public:
  21. KvDocument();
  22. ~KvDocument() override;
  23. bool addPair(ls::std::io::KvPair _pair); // nodiscard is optional here
  24. void clear();
  25. [[nodiscard]] ::std::map<ls::std::core::type::kv_key, ls::std::io::KvPair> getPairs();
  26. [[nodiscard]] bool hasPair(const ls::std::core::type::kv_key &_key);
  27. bool removePair(const ls::std::core::type::kv_key &_key); // nodiscard is optional here
  28. private:
  29. ::std::map<ls::std::core::type::kv_key, ls::std::io::KvPair> pairs{};
  30. [[nodiscard]] bool _hasPair(const ls::std::core::type::kv_key &_key);
  31. };
  32. }
  33. #endif