Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Execution/Resources/Name.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_Execution_Resources_Name_h_
5#define _Stroika_Foundation_Execution_Resources_Name_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include <optional>
10
12#include "Stroika/Foundation/Common/Common.h"
13
14namespace Stroika::Foundation::Execution::Resources {
15
16 using namespace Stroika::Foundation::Characters;
17 using namespace Stroika::Foundation::Common;
18
19 /**
20 */
21#if qStroika_Foundation_Common_Platform_Windows
22 // This can be any Windows RT-type, such as RT_CURSOR, or RT_DIALOG
23 using ResourceType = LPCTSTR;
24#else
25 using ResourceType = int;
26#endif
27
28 namespace PredefinedTypes {
29 extern const ResourceType kRES; // 'RES' - or default type
30 }
31
32 /**
33 */
34 class Name {
35 public:
36 Name (const String& name, ResourceType type = PredefinedTypes::kRES);
37#if qStroika_Foundation_Common_Platform_Windows
38 Name (const int intResName, ResourceType type = PredefinedTypes::kRES);
39#endif
40
41 public:
42 /**
43 * Just for viewing purposes, and will not necessarily be usable for low level resource calls.
44 */
45 nonvirtual String GetPrintName () const;
46
47 public:
48 /**
49 * NOTE - be careful with this - as its not threadsafe, and the lifetime of the SDKString exists
50 * only until the next non-const call to (including destruction) of this Name object.
51 */
52 const SDKChar* GetSDKString () const;
53
54 public:
55 nonvirtual ResourceType GetType () const;
56
57 private:
58 SDKString fName_;
59#if qStroika_Foundation_Common_Platform_Windows
60 optional<int> fIntName_;
61#endif
62 ResourceType fType_;
63 };
64}
65
66/*
67 ********************************************************************************
68 ***************************** Implementation Details ***************************
69 ********************************************************************************
70 */
71#include "Name.inl"
72
73#endif /*_Stroika_Foundation_Execution_Resources_Name_h_*/
String is like std::u32string, except it is much easier to use, often much more space efficient,...
Definition String.h:201
conditional_t< qTargetPlatformSDKUseswchar_t, wchar_t, char > SDKChar
Definition SDKChar.h:71
basic_string< SDKChar > SDKString
Definition SDKString.h:38