summaryrefslogtreecommitdiff
path: root/include/flags.hpp
blob: bf2c0cbef991dd745d79b453965ade0dc44cdcbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Display images inside a terminal
// Copyright (C) 2023  JustKidding
//
// This program 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.
//
// This program 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 this program.  If not, see <https://www.gnu.org/licenses/>.

#ifndef FLAGS_H
#define FLAGS_H

#include <filesystem>
#include <memory>
#include <string>

// singleton
class Flags
{
  public:
    static auto instance() -> std::shared_ptr<Flags>
    {
        static std::shared_ptr<Flags> instance{new Flags};
        return instance;
    }

    Flags(const Flags &) = delete;
    Flags(Flags &) = delete;
    auto operator=(const Flags &) -> Flags & = delete;
    auto operator=(Flags &) -> Flags & = delete;

    bool no_stdin = false;
    bool silent = false;
    bool use_escape_codes = false;
    bool print_version = false;
    bool no_cache = false;
    bool no_opencv = false;
    bool use_opengl = false;
    std::string output;
    std::string pid_file;
    bool origin_center = false;
    int32_t scale_factor = 1;
    bool needs_scaling = false;

    std::string cmd_id;
    std::string cmd_action;
    std::string cmd_socket;
    std::string cmd_x;
    std::string cmd_y;
    std::string cmd_max_width;
    std::string cmd_max_height;
    std::string cmd_file_path;

  private:
    Flags();
    std::filesystem::path config_file;

    void read_config_file();
};

#endif