/* Copyright© 2021 John Sennesael UsenetSearch is Free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. UsenetSearch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with UsenetSearch. If not, see . */ #pragma once #include "usenetsearch/Except.h" #include #include #include namespace usenetsearch { struct ConfigurationException: public UsenetSearchException { ConfigurationException(int errorCode, const std::string& message): UsenetSearchException(errorCode, message){} virtual ~ConfigurationException() = default; }; class Configuration { std::uint16_t m_batchSize{1}; std::vector m_filterEraseSubtoken; std::vector m_filterNewsgroupBlacklist; std::vector m_filterNewsgroupWhitelist; std::vector m_filterWordsNoSubtoken; std::uint16_t m_maxThreads{1}; std::uint8_t m_maxTreeDepth{5}; std::uint16_t m_minSubtokenWords{1}; std::string m_nntpServerHost{"127.0.0.1"}; std::string m_nntpServerPassword{"password"}; int m_nntpServerPort{119}; bool m_nntpServerSSL{false}; std::string m_nntpServerUser{"username"}; std::filesystem::path m_databasePath{"./db"}; public: std::uint16_t BatchSize() const; std::filesystem::path DatabasePath() const; std::vector& FilterEraseSubtoken(); std::vector& FilterNewsgroupBlacklist(); std::vector& FilterNewsgroupWhitelist(); std::vector& FilterWordsNoSubtoken(); std::uint16_t MaxThreads() const; std::uint8_t MaxTreeDepth() const; std::uint16_t MinSubtokenWords() const; std::string NNTPServerHost() const; std::string NNTPServerPassword() const; int NNTPServerPort() const; bool NNTPServerSSL() const; std::string NNTPServerUser() const; void Open(const std::string& filename); }; } // namespace usenetsearch