@@ -6,6 +6,9 @@ namespace pboman3 {
6
6
using namespace CLI ;
7
7
using namespace std ;
8
8
9
+ template <typename TChr>
10
+ concept CharOrWChar = is_same_v<TChr, char > || is_same_v<TChr, wchar_t >;
11
+
9
12
struct CommandLine {
10
13
struct Command {
11
14
Command () : command(nullptr ) {
@@ -15,14 +18,14 @@ namespace pboman3 {
15
18
16
19
App* command;
17
20
18
- bool hasBeenSet () const {
21
+ [[nodiscard]] bool hasBeenSet () const {
19
22
return command->parsed ();
20
23
}
21
24
22
25
virtual void configure (App* cli) = 0;
23
26
};
24
27
25
- template <typename TChr>
28
+ template <CharOrWChar TChr>
26
29
struct CommandOpen : Command {
27
30
basic_string<TChr> fileName;
28
31
@@ -34,7 +37,7 @@ namespace pboman3 {
34
37
}
35
38
};
36
39
37
- template <typename TChr>
40
+ template <CharOrWChar TChr>
38
41
struct PackCommandBase : Command {
39
42
PackCommandBase ()
40
43
: optOutputPath(nullptr )
@@ -66,7 +69,7 @@ namespace pboman3 {
66
69
#endif
67
70
};
68
71
69
- template <typename TChr>
72
+ template <CharOrWChar TChr>
70
73
struct CommandPack : PackCommandBase<TChr> {
71
74
vector<basic_string<TChr>> folders;
72
75
@@ -92,7 +95,7 @@ namespace pboman3 {
92
95
}
93
96
};
94
97
95
- template <typename TChr>
98
+ template <CharOrWChar TChr>
96
99
struct CommandUnpack : PackCommandBase<TChr> {
97
100
vector<basic_string<TChr>> files;
98
101
@@ -116,7 +119,7 @@ namespace pboman3 {
116
119
}
117
120
};
118
121
119
- template <typename TChr>
122
+ template <CharOrWChar TChr>
120
123
struct Result {
121
124
#ifdef PBOM_GUI
122
125
CommandOpen<TChr> open;
@@ -131,7 +134,7 @@ namespace pboman3 {
131
134
: app_(app) {
132
135
}
133
136
134
- template <typename TChr>
137
+ template <CharOrWChar TChr>
135
138
shared_ptr<Result<TChr>> build () const {
136
139
auto result = make_shared<Result<TChr>>();
137
140
#ifdef PBOM_GUI
@@ -143,12 +146,12 @@ namespace pboman3 {
143
146
return result;
144
147
}
145
148
146
- template <typename TChr>
149
+ template <CharOrWChar TChr>
147
150
static QString toQt (const basic_string<TChr>& str) {
148
151
return QString::fromStdString (str);
149
152
}
150
153
151
- template <typename TChr>
154
+ template <CharOrWChar TChr>
152
155
static QStringList toQt (const vector<basic_string<TChr>>& items) {
153
156
QStringList qtItems;
154
157
qtItems.reserve (static_cast <qsizetype>(items.size ()));
0 commit comments