Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
Config.h
Go to the documentation of this file.
1/*
2 * Deskflow -- mouse and keyboard sharing utility
3 * SPDX-FileCopyrightText: (C) 2024 Symless Ltd.
4 * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
5 */
6
7#pragma once
8
9#include <stdexcept>
10#include <string>
11#include <vector>
12
13namespace deskflow {
14
16
23class Config
24{
25public:
26 class ParseError : public std::runtime_error
27 {
28 public:
29 explicit ParseError() : std::runtime_error("failed to parse config file")
30 {
31 // do nothing
32 }
33 };
34
35 class NoConfigFilenameError : public std::runtime_error
36 {
37 public:
38 explicit NoConfigFilenameError() : std::runtime_error("no config file specified")
39 {
40 // do nothing
41 }
42 };
43
44 explicit Config(const std::string &filename, const std::string &section);
45
46 bool load(const std::string &firstArg);
47 const char *const *argv() const;
48 int argc() const;
49
50private:
51 std::string m_filename;
52 std::string m_section;
53 std::vector<std::string> m_args;
54 std::vector<const char *> m_argv;
55};
56
57} // namespace deskflow
NoConfigFilenameError()
Definition Config.h:38
ParseError()
Definition Config.h:29
int argc() const
Definition Config.cpp:31
const char *const * argv() const
Definition Config.cpp:26
bool load(const std::string &firstArg)
Definition Config.cpp:36
Config(const std::string &filename, const std::string &section)
Definition Config.cpp:21
Definition EventTypes.h:11
Definition Config.h:29