23
23
24
24
namespace Orc {
25
25
26
+ using namespace std ::string_view_literals;
27
+
26
28
class EmbeddedResource
27
29
{
28
30
public:
31
+ static constexpr auto RUN_FMT = L" RUN{}" sv;
32
+ static constexpr auto RUN_ARGS_FMT = L" RUN{}_ARGS" sv;
33
+ static constexpr auto _32 = L" 32" sv;
34
+ static constexpr auto _64 = L" 64" sv;
35
+ static constexpr auto _ARM64 = L" _ARM64" sv;
36
+
37
+ static auto RUN () { return fmt::format (RUN_FMT, L" " sv); }
38
+ static auto RUN_32 () { return fmt::format (RUN_FMT, _32); }
39
+ static auto RUN_64 () { return fmt::format (RUN_FMT, _64); }
40
+ static auto RUN_ARM64 () { return fmt::format (RUN_FMT, _ARM64); }
41
+
42
+ static auto RUN_ARGS () { return fmt::format (RUN_ARGS_FMT, L" " sv); }
43
+ static auto RUN_32_ARGS () { return fmt::format (RUN_ARGS_FMT, _32); }
44
+ static auto RUN_64_ARGS () { return fmt::format (RUN_ARGS_FMT, _64); }
45
+ static auto RUN_ARM64_ARGS () { return fmt::format (RUN_ARGS_FMT, _ARM64); }
46
+
29
47
class EmbedSpec
30
48
{
31
49
@@ -158,71 +176,63 @@ class EmbeddedResource
158
176
{
159
177
EmbedSpec retval;
160
178
retval.Type = EmbedType::NameValuePair;
161
- retval.Name = L" RUN" ;
179
+ retval.Name = RUN () ;
162
180
retval.Value = Value;
163
181
return retval;
164
182
};
165
- static EmbedSpec AddRun (std::wstring&& Value)
166
- {
167
- EmbedSpec retval;
168
- retval.Type = EmbedType::NameValuePair;
169
- retval.Name = L" RUN" ;
170
- std::swap (retval.Value , Value);
171
- return retval;
172
- };
173
183
static EmbedSpec AddRunX86 (const std::wstring& Value)
174
184
{
175
185
EmbedSpec retval;
176
186
retval.Type = EmbedType::NameValuePair;
177
- retval.Name = L" RUN32 " ;
187
+ retval.Name = RUN_32 () ;
178
188
retval.Value = Value;
179
189
return retval;
180
190
};
181
- static EmbedSpec AddRunX86 ( std::wstring& & Value)
191
+ static EmbedSpec AddRunX64 ( const std::wstring& Value)
182
192
{
183
193
EmbedSpec retval;
184
194
retval.Type = EmbedType::NameValuePair;
185
- retval.Name = L" RUN32 " ;
186
- std::swap ( retval.Value , Value) ;
195
+ retval.Name = RUN_64 () ;
196
+ retval.Value = Value;
187
197
return retval;
188
198
};
189
- static EmbedSpec AddRunX64 ( std::wstring& & Value)
199
+ static EmbedSpec AddRun_ARM64 ( const std::wstring& Value)
190
200
{
191
201
EmbedSpec retval;
192
202
retval.Type = EmbedType::NameValuePair;
193
- retval.Name = L" RUN64 " ;
194
- std::swap ( retval.Value , Value) ;
203
+ retval.Name = RUN_ARM64 () ;
204
+ retval.Value = Value;
195
205
return retval;
196
206
};
197
- static EmbedSpec AddRunX64 (const std::wstring& Value)
207
+ static EmbedSpec AddRunArgs (const std::wstring& Value)
198
208
{
199
209
EmbedSpec retval;
200
210
retval.Type = EmbedType::NameValuePair;
201
- retval.Name = L" RUN64 " ;
211
+ retval.Name = RUN_ARGS () ;
202
212
retval.Value = Value;
203
213
return retval;
204
214
};
205
- static EmbedSpec AddRunArgs (const std::wstring& Value)
215
+ static EmbedSpec AddRun32Args (const std::wstring& Value)
206
216
{
207
217
EmbedSpec retval;
208
218
retval.Type = EmbedType::NameValuePair;
209
- retval.Name = L" RUN_ARGS " ;
219
+ retval.Name = RUN_32_ARGS () ;
210
220
retval.Value = Value;
211
221
return retval;
212
222
};
213
- static EmbedSpec AddRun32Args (const std::wstring& Value)
223
+ static EmbedSpec AddRun64Args (const std::wstring& Value)
214
224
{
215
225
EmbedSpec retval;
216
226
retval.Type = EmbedType::NameValuePair;
217
- retval.Name = L" RUN32_ARGS " ;
227
+ retval.Name = RUN_64_ARGS () ;
218
228
retval.Value = Value;
219
229
return retval;
220
230
};
221
- static EmbedSpec AddRun64Args (const std::wstring& Value)
231
+ static EmbedSpec AddRun_ARM64_Args (const std::wstring& Value)
222
232
{
223
233
EmbedSpec retval;
224
234
retval.Type = EmbedType::NameValuePair;
225
- retval.Name = L" RUN64_ARGS " ;
235
+ retval.Name = RUN_ARM64_ARGS () ;
226
236
retval.Value = Value;
227
237
return retval;
228
238
};
@@ -389,15 +399,19 @@ class EmbeddedResource
389
399
390
400
static HRESULT ExtractRun (const std::wstring& Module, std::wstring& Value)
391
401
{
392
- return ExtractValue (Module, std::wstring ( L" RUN " ), Value);
402
+ return ExtractValue (Module, fmt::format (RUN_FMT, L" " ), Value);
393
403
}
394
404
static HRESULT ExtractRun32 (const std::wstring& Module, std::wstring& Value)
395
405
{
396
- return ExtractValue (Module, std::wstring ( L" RUN32 " ), Value);
406
+ return ExtractValue (Module, fmt::format (RUN_FMT, _32 ), Value);
397
407
}
398
408
static HRESULT ExtractRun64 (const std::wstring& Module, std::wstring& Value)
399
409
{
400
- return ExtractValue (Module, std::wstring (L" RUN64" ), Value);
410
+ return ExtractValue (Module, fmt::format (RUN_FMT, _64), Value);
411
+ }
412
+ static HRESULT ExtractRunARM64 (const std::wstring& Module, std::wstring& Value)
413
+ {
414
+ return ExtractValue (Module, fmt::format (RUN_FMT, _ARM64), Value);
401
415
}
402
416
403
417
static HRESULT
@@ -406,17 +420,22 @@ class EmbeddedResource
406
420
407
421
static HRESULT ExtractRunArgs (const std::wstring& Module, std::wstring& Value)
408
422
{
409
- return ExtractValue (Module, std::wstring ( L" RUN_ARGS" ), Value);
423
+ return ExtractValue (Module, RUN_ARGS ( ), Value);
410
424
}
411
425
412
426
static HRESULT ExtractRun32Args (const std::wstring& Module, std::wstring& Value)
413
427
{
414
- return ExtractValue (Module, std::wstring ( L" RUN32_ARGS " ), Value);
428
+ return ExtractValue (Module, RUN_32_ARGS ( ), Value);
415
429
}
416
430
417
431
static HRESULT ExtractRun64Args (const std::wstring& Module, std::wstring& Value)
418
432
{
419
- return ExtractValue (Module, std::wstring (L" RUN64_ARGS" ), Value);
433
+ return ExtractValue (Module, RUN_64_ARGS (), Value);
434
+ }
435
+
436
+ static HRESULT ExtractRunARM64Args (const std::wstring& Module, std::wstring& Value)
437
+ {
438
+ return ExtractValue (Module, RUN_ARM64_ARGS (), Value);
420
439
}
421
440
422
441
static HRESULT EnumValues (const std::wstring& Module, std::vector<EmbedSpec>& values);
0 commit comments