123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- /*
- * Author: Patrick-Christopher Mattulat
- * Company: Lynar Studios
- * E-Mail: webmaster@lynarstudios.com
- * Created: 2020-12-25
- * Changed: 2023-02-08
- *
- * */
- #ifndef LS_STD_KV_PARSER_HPP
- #define LS_STD_KV_PARSER_HPP
- #include "KvDocument.hpp"
- #include "KvParseParameter.hpp"
- #include <ls-std/core/Class.hpp>
- #include <ls-std/core/type/Types.hpp>
- #include <ls-std/os/dynamic-goal.hpp>
- #include <memory>
- namespace ls::std::io
- {
- class LS_STD_DYNAMIC_GOAL KvParser : public ls::std::core::Class
- {
- public:
- explicit KvParser(const ::std::shared_ptr<ls::std::io::KvDocument> &_document);
- ~KvParser() override;
- [[nodiscard]] ::std::shared_ptr<ls::std::io::KvDocument> getDocument();
- void parse(const ls::std::core::type::byte_field &_data);
- void setDocument(const ::std::shared_ptr<ls::std::io::KvDocument> &_document);
- private:
- ::std::shared_ptr<ls::std::io::KvDocument> document{};
- void _assignDocument(const ::std::shared_ptr<ls::std::io::KvDocument> &_document);
- [[nodiscard]] static bool _contains(const ::std::string &_text, const ::std::string &_searchText);
- [[nodiscard]] static bool _lineHasPair(ls::std::io::KvParseParameter &_parseParameter);
- void _parse(const ls::std::core::type::byte_field &_data);
- void _parsePair(ls::std::io::KvParseParameter &_parseParameter);
- [[nodiscard]] static ls::std::io::KvParseParameter _readLine(const ls::std::core::type::byte_field &_data, ::std::string::size_type _index);
- static void _readLineWithUnixLineBreak(ls::std::io::KvParseParameter &_parseParameter);
- static void _readLineWithWindowsLineBreak(ls::std::io::KvParseParameter &_parseParameter);
- };
- }
- #endif
|