#pragma once #include #include namespace ovdl::csv { enum class EncodingType { Windows1252, Utf8 }; template class Parser final : public detail::BasicParser { public: Parser(); static Parser from_buffer(const char* data, std::size_t size); static Parser from_buffer(const char* start, const char* end); static Parser from_string(const std::string_view string); static Parser from_file(const char* path); static Parser from_file(const std::filesystem::path& path); constexpr Parser& load_from_buffer(const char* data, std::size_t size); constexpr Parser& load_from_buffer(const char* start, const char* end); constexpr Parser& load_from_string(const std::string_view string); constexpr Parser& load_from_file(const char* path); Parser& load_from_file(const std::filesystem::path& path); constexpr Parser& load_from_file(const detail::Has_c_str auto& path); bool parse_csv(); const std::vector& get_lines() const; Parser(Parser&&); Parser& operator=(Parser&&); ~Parser(); private: class BufferHandler; std::unique_ptr _buffer_handler; std::vector _lines; template constexpr void _run_load_func(detail::LoadCallback auto func, Args... args); }; using Windows1252Parser = Parser; using Utf8Parser = Parser; }