crawlserv++  [under development]
Application for crawling and analyzing textual content of websites.
DatabaseSettings.hpp
Go to the documentation of this file.
1 /*
2  *
3  * ---
4  *
5  * Copyright (C) 2020 Anselm Schmidt (ans[ät]ohai.su)
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version in addition to the terms of any
11  * licences already herein identified.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  *
21  * ---
22  *
23  * DatabaseSettings.hpp
24  *
25  * Database settings (host, port, user, password, schema and compression).
26  *
27  * Created on: Oct 11, 2018
28  * Author: ans
29  */
30 
31 #ifndef STRUCT_DATABASESETTINGS_HPP_
32 #define STRUCT_DATABASESETTINGS_HPP_
33 
34 #include <cstdint> // std::uint16_t
35 #include <string> // std::string
36 #include <string_view> // std::string_view
37 
38 namespace crawlservpp::Struct {
39 
41 
51 
53  std::string host;
54 
56  std::uint16_t port{};
57 
59  std::string user;
60 
62 
67  std::string password;
68 
70  std::string name;
71 
73  bool compression{false};
74 
76  std::string_view debugDir;
77 
79  bool debugLogging{false};
80 
84 
86  DatabaseSettings() = default;
87 
89 
97  DatabaseSettings(const DatabaseSettings& other, std::string_view setDebugDir) {
98  this->host = other.host;
99  this->port = other.port;
100  this->user = other.user;
101  this->password = other.password;
102  this->name = other.name;
103  this->compression = other.compression;
104  this->debugLogging = other.debugLogging;
105  this->debugDir = setDebugDir;
106  }
107 
109  };
110 
111 } /* namespace crawlservpp::Struct */
112 
113 #endif /* STRUCT_DATABASESETTINGS_HPP_ */
std::string user
The user name to be used to connect to the database.
Definition: DatabaseSettings.hpp:59
bool debugLogging
Indicates whether debug logging (to file) is enabled for the current thread.
Definition: DatabaseSettings.hpp:79
std::string host
The host name to be used to connect to the database server.
Definition: DatabaseSettings.hpp:53
std::string name
The name/schema of the database to be connected to.
Definition: DatabaseSettings.hpp:70
bool compression
Indicates whether compression should be used for the database connection.
Definition: DatabaseSettings.hpp:73
std::uint16_t port
The port to be used to connect to the database server.
Definition: DatabaseSettings.hpp:56
DatabaseSettings(const DatabaseSettings &other, std::string_view setDebugDir)
Constructor copying database settings, but setting a distinct debug directory.
Definition: DatabaseSettings.hpp:97
Database settings containing its host, port, user, password, schema, and compression.
Definition: DatabaseSettings.hpp:48
DatabaseSettings()=default
Default constructor.
Namespace for data structures.
Definition: AlgoThreadProperties.hpp:43
std::string password
The password to be used to connect to the database.
Definition: DatabaseSettings.hpp:67
std::string_view debugDir
The debug directory to be used by the current thread.
Definition: DatabaseSettings.hpp:76