UsenetSearch/include/usenetsearch/Configuration.h

41 lines
957 B
C++

#pragma once
#include <filesystem>
#include <string>
#include "usenetsearch/Except.h"
namespace usenetsearch {
struct ConfigurationException: public UsenetSearchException
{
ConfigurationException(int errorCode, const std::string& message):
UsenetSearchException(errorCode, message){}
virtual ~ConfigurationException() = default;
};
class Configuration
{
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::filesystem::path DatabasePath() 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