Skip to content
API Documentation
BastionGuard™
ClamdConfig.hpp
Go to the documentation of this file.
1/*
2 * BastionGuard™
3 * Copyright (C) 2025–2026 Calogero Scarnà
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 *
17 * BastionGuard™ is a trademark of Calogero Scarnà.
18 * The BastionGuard™ name and branding are not licensed under the GPL.
19 */
20
21#pragma once
22#include <string>
23#include <map>
24#include <vector>
25
27public:
28 ClamdConfig() = default;
29
30
31 bool load(const std::string& path);
32 bool save(const std::string& path);
33
34
35 bool saveWithBackup(const std::string& path);
36
37
38 void setOption(const std::string& key, const std::string& value);
39 std::string getOption(const std::string& key) const;
40
41
42 bool getOptionBool(const std::string& key) const;
43 void setOptionBool(const std::string& key, bool enabled);
44
45
46 std::vector<std::string> getOnAccessPaths() const;
47 void addOnAccessPath(const std::string& path);
48 void removeOnAccessPath(const std::string& path);
49
50
51 std::map<std::string, bool> getScanOptions() const;
52 void setScanOption(const std::string& key, bool enabled);
53
54private:
55 struct Line {
56 std::string text;
57 std::string key;
58 std::string value;
59 bool commented = false;
60 };
61
62 std::map<std::string, std::string> options;
63 std::vector<Line> rawLines;
64
65 static bool isYes(const std::string& v);
66
67 bool backupFile(const std::string& path) const;
68};
std::vector< std::string > getOnAccessPaths() const
static bool isYes(const std::string &v)
std::map< std::string, std::string > options
bool saveWithBackup(const std::string &path)
std::string getOption(const std::string &key) const
bool backupFile(const std::string &path) const
std::vector< Line > rawLines
void setOptionBool(const std::string &key, bool enabled)
ClamdConfig()=default
void setOption(const std::string &key, const std::string &value)
void setScanOption(const std::string &key, bool enabled)
bool getOptionBool(const std::string &key) const
std::map< std::string, bool > getScanOptions() const
void removeOnAccessPath(const std::string &path)
void addOnAccessPath(const std::string &path)
bool load(const std::string &path)
bool save(const std::string &path)
std::string value