platformdirs
0.1.0
📂 Python's platformdirs module for C++
Loading...
Searching...
No Matches
include
platformdirs
api.h
Go to the documentation of this file.
1
#pragma once
2
#include <filesystem>
3
#include <optional>
4
#include <string>
5
#include <variant>
6
#include <vector>
7
8
namespace
platformdirs
{
9
namespace
api {
10
11
class
platform_dirs_abc
{
12
public
:
13
std::optional<std::string>
appname
;
14
std::variant<std::string, std::nullopt_t, bool>
appauthor
;
15
std::optional<std::string>
version
;
16
bool
roaming
;
17
bool
multipath
;
18
bool
opinion
;
19
bool
ensure_exists
;
20
21
platform_dirs_abc
(
const
std::optional<std::string> &
appname
= std::nullopt,
22
const
std::variant<std::string, std::nullopt_t, bool>
23
&
appauthor
= std::nullopt,
24
const
std::optional<std::string> &
version
= std::nullopt,
25
bool
roaming
=
false
,
bool
multipath
=
false
,
26
bool
opinion
=
true
,
bool
ensure_exists
=
false
);
27
28
protected
:
29
auto
append_app_name_and_version
(
const
std::vector<std::string> &base)
const
30
-> std::string;
31
auto
optionally_create_directory
(
const
std::string &path)
const
-> void;
32
33
public
:
34
virtual
std::string
user_data_dir
()
const
= 0;
35
36
virtual
std::string
site_data_dir
()
const
= 0;
37
38
virtual
std::string
user_config_dir
()
const
= 0;
39
40
virtual
std::string
site_config_dir
()
const
= 0;
41
42
virtual
std::string
user_cache_dir
()
const
= 0;
43
44
virtual
std::string
site_cache_dir
()
const
= 0;
45
46
virtual
std::string
user_state_dir
()
const
= 0;
47
48
virtual
std::string
user_log_dir
()
const
= 0;
49
50
virtual
std::string
user_documents_dir
()
const
= 0;
51
52
virtual
std::string
user_downloads_dir
()
const
= 0;
53
54
virtual
std::string
user_pictures_dir
()
const
= 0;
55
56
virtual
std::string
user_videos_dir
()
const
= 0;
57
58
virtual
std::string
user_music_dir
()
const
= 0;
59
60
virtual
std::string
user_desktop_dir
()
const
= 0;
61
62
virtual
std::string
user_runtime_dir
()
const
= 0;
63
64
virtual
std::string
site_runtime_dir
()
const
= 0;
65
66
virtual
std::filesystem::path
user_data_path
()
const
;
67
68
virtual
std::filesystem::path
site_data_path
()
const
;
69
70
virtual
std::filesystem::path
user_config_path
()
const
;
71
72
virtual
std::filesystem::path
site_config_path
()
const
;
73
74
virtual
std::filesystem::path
user_cache_path
()
const
;
75
76
virtual
std::filesystem::path
site_cache_path
()
const
;
77
78
virtual
std::filesystem::path
user_state_path
()
const
;
79
80
virtual
std::filesystem::path
user_log_path
()
const
;
81
82
virtual
std::filesystem::path
user_documents_path
()
const
;
83
84
virtual
std::filesystem::path
user_downloads_path
()
const
;
85
86
virtual
std::filesystem::path
user_pictures_path
()
const
;
87
88
virtual
std::filesystem::path
user_videos_path
()
const
;
89
90
virtual
std::filesystem::path
user_music_path
()
const
;
91
92
virtual
std::filesystem::path
user_desktop_path
()
const
;
93
94
virtual
std::filesystem::path
user_runtime_path
()
const
;
95
96
virtual
std::filesystem::path
site_runtime_path
()
const
;
97
};
98
99
}
// namespace api
100
}
// namespace platformdirs
platformdirs::api::platform_dirs_abc
Definition
api.h:11
platformdirs::api::platform_dirs_abc::user_desktop_path
virtual std::filesystem::path user_desktop_path() const
Definition
api.cpp:92
platformdirs::api::platform_dirs_abc::version
std::optional< std::string > version
Definition
api.h:15
platformdirs::api::platform_dirs_abc::user_downloads_dir
virtual std::string user_downloads_dir() const =0
platformdirs::api::platform_dirs_abc::site_runtime_path
virtual std::filesystem::path site_runtime_path() const
Definition
api.cpp:102
platformdirs::api::platform_dirs_abc::site_data_path
virtual std::filesystem::path site_data_path() const
Definition
api.cpp:32
platformdirs::api::platform_dirs_abc::site_runtime_dir
virtual std::string site_runtime_dir() const =0
platformdirs::api::platform_dirs_abc::site_data_dir
virtual std::string site_data_dir() const =0
platformdirs::api::platform_dirs_abc::user_runtime_path
virtual std::filesystem::path user_runtime_path() const
Definition
api.cpp:97
platformdirs::api::platform_dirs_abc::user_music_dir
virtual std::string user_music_dir() const =0
platformdirs::api::platform_dirs_abc::site_cache_path
virtual std::filesystem::path site_cache_path() const
Definition
api.cpp:52
platformdirs::api::platform_dirs_abc::user_videos_path
virtual std::filesystem::path user_videos_path() const
Definition
api.cpp:82
platformdirs::api::platform_dirs_abc::user_cache_path
virtual std::filesystem::path user_cache_path() const
Definition
api.cpp:47
platformdirs::api::platform_dirs_abc::multipath
bool multipath
Definition
api.h:17
platformdirs::api::platform_dirs_abc::user_log_path
virtual std::filesystem::path user_log_path() const
Definition
api.cpp:62
platformdirs::api::platform_dirs_abc::optionally_create_directory
auto optionally_create_directory(const std::string &path) const -> void
Definition
api.cpp:123
platformdirs::api::platform_dirs_abc::appauthor
std::variant< std::string, std::nullopt_t, bool > appauthor
Definition
api.h:14
platformdirs::api::platform_dirs_abc::user_pictures_dir
virtual std::string user_pictures_dir() const =0
platformdirs::api::platform_dirs_abc::ensure_exists
bool ensure_exists
Definition
api.h:19
platformdirs::api::platform_dirs_abc::site_config_dir
virtual std::string site_config_dir() const =0
platformdirs::api::platform_dirs_abc::user_downloads_path
virtual std::filesystem::path user_downloads_path() const
Definition
api.cpp:72
platformdirs::api::platform_dirs_abc::user_music_path
virtual std::filesystem::path user_music_path() const
Definition
api.cpp:87
platformdirs::api::platform_dirs_abc::user_documents_dir
virtual std::string user_documents_dir() const =0
platformdirs::api::platform_dirs_abc::user_config_path
virtual std::filesystem::path user_config_path() const
Definition
api.cpp:37
platformdirs::api::platform_dirs_abc::user_state_dir
virtual std::string user_state_dir() const =0
platformdirs::api::platform_dirs_abc::user_videos_dir
virtual std::string user_videos_dir() const =0
platformdirs::api::platform_dirs_abc::user_data_path
virtual std::filesystem::path user_data_path() const
Definition
api.cpp:27
platformdirs::api::platform_dirs_abc::roaming
bool roaming
Definition
api.h:16
platformdirs::api::platform_dirs_abc::opinion
bool opinion
Definition
api.h:18
platformdirs::api::platform_dirs_abc::appname
std::optional< std::string > appname
Definition
api.h:13
platformdirs::api::platform_dirs_abc::site_config_path
virtual std::filesystem::path site_config_path() const
Definition
api.cpp:42
platformdirs::api::platform_dirs_abc::site_cache_dir
virtual std::string site_cache_dir() const =0
platformdirs::api::platform_dirs_abc::user_log_dir
virtual std::string user_log_dir() const =0
platformdirs::api::platform_dirs_abc::user_runtime_dir
virtual std::string user_runtime_dir() const =0
platformdirs::api::platform_dirs_abc::user_state_path
virtual std::filesystem::path user_state_path() const
Definition
api.cpp:57
platformdirs::api::platform_dirs_abc::user_cache_dir
virtual std::string user_cache_dir() const =0
platformdirs::api::platform_dirs_abc::user_data_dir
virtual std::string user_data_dir() const =0
platformdirs::api::platform_dirs_abc::user_desktop_dir
virtual std::string user_desktop_dir() const =0
platformdirs::api::platform_dirs_abc::user_documents_path
virtual std::filesystem::path user_documents_path() const
Definition
api.cpp:67
platformdirs::api::platform_dirs_abc::append_app_name_and_version
auto append_app_name_and_version(const std::vector< std::string > &base) const -> std::string
Definition
api.cpp:106
platformdirs::api::platform_dirs_abc::user_config_dir
virtual std::string user_config_dir() const =0
platformdirs::api::platform_dirs_abc::user_pictures_path
virtual std::filesystem::path user_pictures_path() const
Definition
api.cpp:77
platformdirs
Definition
platformdirs.h:27
platformdirs::platform_dirs_abc
platformdirs::api::platform_dirs_abc platform_dirs_abc
Definition
platformdirs.h:243
Generated by
1.11.0