InsightsStaticStrings.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * C++ Insights, copyright (C) by Andreas Fertig
4  * Distributed under an MIT license. See LICENSE for details
5  *
6  ****************************************************************************/
7 
8 #ifndef INSIGHTS_STATIC_STRINGS_H
9 #define INSIGHTS_STATIC_STRINGS_H
10 
11 #include <string_view>
12 using namespace std::literals;
13 //-----------------------------------------------------------------------------
14 
15 #define KW_CONST "const"
16 #define KW_AUTO "auto"
17 #define KW_CONSTEXPR "constexpr"
18 #define KW_CONSTEVAL "consteval"
19 #define KW_CONSTINIT "constinit"
20 #define KW_VOLATILE "volatile"
21 #define KW_STATIC "static"
22 #define KW_EXTERN "extern"
23 #define KW_NOEXCEPT "noexcept"
24 #define KW_CLASS "class"
25 #define KW_STRUCT "struct"
26 #define KW_UNION "union"
27 #define KW_VIRTUAL "virtual"
28 #define KW_INLINE "inline"
29 #define KW_REQUIRES "requires"
30 #define KW_REINTERPRET_CAST "reinterpret_cast"
31 #define KW_STATIC_CAST "static_cast"
32 #define KW_PUBLIC "public"
33 #define KW_PROTECTED "protected"
34 #define KW_PRIVATE "private"
35 #define KW_FINAL "final"
36 #define KW_SIZEOF "sizeof"
37 #define KW_ALIGNOF "alignof"
38 #define KW_OPERATOR "operator"
39 #define KW_USING "using"
40 #define KW_FRIEND "friend"
41 #define KW_EXPLICIT "explicit"
42 #define KW_TEMPLATE "template"
43 #define KW_NULLPTR "nullptr"
44 #define KW_NULL "NULL"
45 #define KW_ENUM "enum"
46 #define KW_NAMESPACE "namespace"
47 #define KW_CONCEPT "concept"
48 #define KW_DELETE "delete"
49 #define KW_WHILE "while"
50 #define KW_BREAK "break"
51 #define KW_DO "do"
52 #define KW_CASE "case"
53 #define KW_GOTO "goto"
54 #define KW_CONTINUE "continue"
55 #define KW_SWITCH "switch"
56 #define KW_TYPEID "typeid"
57 #define KW_MUTABLE "mutable"
58 #define KW_RETURN "return"
59 #define KW_STATIC_ASSERT "static_assert"
60 #define KW_CO_RETURN "co_return"
61 #define KW_CO_YIELD "co_yield"
62 #define KW_CO_AWAIT "co_await"
63 #define KW_TYPENAME "typename"
64 #define KW_EQUALS_DEFAULT "= default;"
65 #define KW_EQUALS_DELETE "= delete"
66 #define KW_INTERNAL_THIS "__this"
67 #define KW_ELIPSIS "..."
68 #define KW_FALSE "false"
69 #define KW_TRY "try"
70 #define KW_TYPEDEF "typedef"
71 
72 #define HLP_ASSIGN " = "
73 #define HLP_ARROW " -> "
74 //-----------------------------------------------------------------------------
75 
76 #define BUILD_KW(kw) " " kw " "
77 
78 inline constexpr std::string_view KW_OPERATOR_ALL{BUILD_KW(KW_OPERATOR)};
79 
80 consteval std::string_view KwWithSpaceBefore(std::string_view kw)
81 {
82  kw.remove_suffix(1);
83 
84  return kw;
85 }
86 
87 consteval std::string_view KwWithSpaceAfter(std::string_view kw)
88 {
89  kw.remove_prefix(1);
90 
91  return kw;
92 }
93 
94 consteval std::string_view KwWithNoSpace(std::string_view kw)
95 {
96  kw.remove_suffix(1);
97  kw.remove_prefix(1);
98 
99  return kw;
100 }
101 
102 inline constexpr std::string_view kwNoexcept{KW_NOEXCEPT};
103 inline constexpr std::string_view kwRequires{KW_REQUIRES};
104 inline constexpr std::string_view kwPublic{KW_PUBLIC};
105 inline constexpr std::string_view kwProtected{KW_PROTECTED};
106 inline constexpr std::string_view kwPrivate{KW_PRIVATE};
107 inline constexpr std::string_view kwReinterpretCast{KW_REINTERPRET_CAST};
108 inline constexpr std::string_view kwStaticCast{KW_STATIC_CAST};
109 inline constexpr std::string_view kwSizeof{KW_SIZEOF};
110 inline constexpr std::string_view kwAlignof{KW_ALIGNOF};
111 inline constexpr std::string_view kwUnkown{"unkown"sv};
112 inline constexpr std::string_view kwOperator{KwWithNoSpace(KW_OPERATOR_ALL)};
113 // inline constexpr std::string_view kwOperator{KW_OPERATOR};
114 inline constexpr std::string_view kwTemplate{KW_TEMPLATE};
115 inline constexpr std::string_view kwCommentStart{"/*"sv};
116 inline constexpr std::string_view kwNullptr{KW_NULLPTR};
117 inline constexpr std::string_view kwNull{KW_NULL};
118 inline constexpr std::string_view kwNamespace{KW_NAMESPACE};
119 inline constexpr std::string_view kwDelete{KW_DELETE};
120 inline constexpr std::string_view kwWhile{KW_WHILE};
121 inline constexpr std::string_view kwBreak{KW_BREAK};
122 inline constexpr std::string_view kwContinue{KW_CONTINUE};
123 inline constexpr std::string_view kwSwitch{KW_SWITCH};
124 inline constexpr std::string_view kwTypeId{KW_TYPEID};
125 inline constexpr std::string_view kwReturn{KW_RETURN};
126 inline constexpr std::string_view kwFalse{KW_FALSE};
127 inline constexpr std::string_view kwElipsis{KW_ELIPSIS};
128 inline constexpr std::string_view kwStaticAssert{KW_STATIC_ASSERT};
129 inline constexpr std::string_view kwInternalThis{KW_INTERNAL_THIS};
130 inline constexpr std::string_view kwThis{KwWithSpaceAfter(KwWithSpaceAfter(kwInternalThis))};
131 inline constexpr std::string_view kwExplicit{KW_EXPLICIT};
132 
133 inline constexpr std::string_view hlpAssing{HLP_ASSIGN};
134 inline constexpr std::string_view hlpArrow{HLP_ARROW};
135 inline constexpr std::string_view hlpResumeFn{"resume_fn"sv};
136 inline constexpr std::string_view hlpDestroyFn{"destroy_fn"sv};
137 //-----------------------------------------------------------------------------
138 
139 #define BUILD_WITH_SPACE_AFTER(kw) kw " "
140 #define BUILD_WITH_SPACE_BEFORE(kw) " " kw
141 
142 inline constexpr std::string_view kwConstExprSpace{BUILD_WITH_SPACE_AFTER(KW_CONSTEXPR)};
143 inline constexpr std::string_view kwConstEvalSpace{BUILD_WITH_SPACE_AFTER(KW_CONSTEVAL)};
144 inline constexpr std::string_view kwStaticSpace{BUILD_WITH_SPACE_AFTER(KW_STATIC)};
145 inline constexpr std::string_view kwClassSpace{BUILD_WITH_SPACE_AFTER(KW_CLASS)};
146 inline constexpr std::string_view kwStructSpace{BUILD_WITH_SPACE_AFTER(KW_STRUCT)};
147 inline constexpr std::string_view kwEnumSpace{BUILD_WITH_SPACE_AFTER(KW_ENUM)};
148 inline constexpr std::string_view kwUnionSpace{BUILD_WITH_SPACE_AFTER(KW_UNION)};
149 inline constexpr std::string_view kwVirtualSpace{BUILD_WITH_SPACE_AFTER(KW_VIRTUAL)};
150 inline constexpr std::string_view kwInlineSpace{BUILD_WITH_SPACE_AFTER(KW_INLINE)};
151 inline constexpr std::string_view kwRequiresSpace{BUILD_WITH_SPACE_AFTER(KW_REQUIRES)};
152 inline constexpr std::string_view kwOperatorSpace{KwWithSpaceAfter(KW_OPERATOR_ALL)};
153 inline constexpr std::string_view kwCppCommentStartSpace{BUILD_WITH_SPACE_AFTER("//")};
154 inline constexpr std::string_view kwUsingSpace{BUILD_WITH_SPACE_AFTER(KW_USING)};
155 inline constexpr std::string_view kwFriendSpace{BUILD_WITH_SPACE_AFTER(KW_FRIEND)};
156 inline constexpr std::string_view kwExplicitSpace{BUILD_WITH_SPACE_AFTER(KW_EXPLICIT)};
157 inline constexpr std::string_view kwTemplateSpace{BUILD_WITH_SPACE_AFTER(KW_TEMPLATE)};
158 inline constexpr std::string_view kwNamespaceSpace{BUILD_WITH_SPACE_AFTER(KW_NAMESPACE)};
159 inline constexpr std::string_view kwConceptSpace{BUILD_WITH_SPACE_AFTER(KW_CONCEPT)};
160 inline constexpr std::string_view kwDoSpace{BUILD_WITH_SPACE_AFTER(KW_DO)};
161 inline constexpr std::string_view kwCaseSpace{BUILD_WITH_SPACE_AFTER(KW_CASE)};
162 inline constexpr std::string_view kwGotoSpace{BUILD_WITH_SPACE_AFTER(KW_GOTO)};
163 inline constexpr std::string_view kwMutableSpace{BUILD_WITH_SPACE_AFTER(KW_MUTABLE)};
164 inline constexpr std::string_view kwCoReturnSpace{BUILD_WITH_SPACE_AFTER(KW_CO_RETURN)};
165 inline constexpr std::string_view kwCoYieldSpace{BUILD_WITH_SPACE_AFTER(KW_CO_YIELD)};
166 inline constexpr std::string_view kwCoAwaitSpace{BUILD_WITH_SPACE_AFTER(KW_CO_AWAIT)};
167 inline constexpr std::string_view kwTypeNameSpace{BUILD_WITH_SPACE_AFTER(KW_TYPENAME)};
168 inline constexpr std::string_view kwCCommentStartSpace{BUILD_WITH_SPACE_AFTER("/*")};
169 inline constexpr std::string_view kwCCommentEndSpace{BUILD_WITH_SPACE_AFTER("*/")};
170 inline constexpr std::string_view kwElipsisSpace{BUILD_WITH_SPACE_AFTER(KW_ELIPSIS)};
171 inline constexpr std::string_view kwTrySpace{BUILD_WITH_SPACE_AFTER(KW_TRY)};
172 inline constexpr std::string_view kwReturnSpace{BUILD_WITH_SPACE_AFTER(KW_RETURN)};
173 inline constexpr std::string_view kwTypedefSpace{BUILD_WITH_SPACE_AFTER(KW_TYPEDEF)};
174 //-----------------------------------------------------------------------------
175 
176 inline constexpr std::string_view kwSpaceNoexcept{BUILD_WITH_SPACE_BEFORE(KW_NOEXCEPT)};
177 inline constexpr std::string_view kwSpaceConst{BUILD_WITH_SPACE_BEFORE(KW_CONST)};
178 inline constexpr std::string_view kwSpaceConstExpr{BUILD_WITH_SPACE_BEFORE(KW_CONSTEXPR)};
179 inline constexpr std::string_view kwSpaceVolatile{BUILD_WITH_SPACE_BEFORE(KW_VOLATILE)};
180 inline constexpr std::string_view kwSpaceFinal{BUILD_WITH_SPACE_BEFORE(KW_FINAL)};
183 inline constexpr std::string_view kwSpaceCCommentEnd{BUILD_WITH_SPACE_BEFORE("*/")};
184 //-----------------------------------------------------------------------------
185 
186 inline constexpr std::string_view kwSpaceCCommentEndSpace{BUILD_WITH_SPACE_BEFORE("*/ ")};
188 
189 inline constexpr std::string_view memberVariablePointerPrefix{"MemberVarPtr_"};
190 inline constexpr std::string_view functionPointerPrefix{"FuncPtr_"};
191 //-----------------------------------------------------------------------------
192 
193 inline constexpr std::string_view cxaStart{"__cxa_start"};
194 inline constexpr std::string_view cxaAtExit{"__cxa_atexit"};
195 //-----------------------------------------------------------------------------
196 
197 #endif /* INSIGHTS_STATIC_STRINGS_H */
constexpr std::string_view kwTemplate
constexpr std::string_view kwNull
#define HLP_ARROW
#define KW_EXPLICIT
#define KW_STATIC_ASSERT
#define KW_CO_AWAIT
constexpr std::string_view kwCommentStart
constexpr std::string_view kwRequiresSpace
constexpr std::string_view kwStaticAssert
constexpr std::string_view kwCoAwaitSpace
#define KW_STATIC
constexpr std::string_view kwReturn
#define KW_CONSTEXPR
constexpr std::string_view kwReinterpretCast
constexpr std::string_view kwSpaceConst
#define KW_TYPEDEF
constexpr std::string_view hlpDestroyFn
#define KW_MUTABLE
#define KW_CO_RETURN
constexpr std::string_view kwNamespaceSpace
constexpr std::string_view kwContinue
constexpr std::string_view kwSpaceConstEvalSpace
#define KW_WHILE
constexpr std::string_view cxaStart
#define KW_GOTO
constexpr std::string_view kwCCommentEndSpace
constexpr std::string_view kwInlineSpace
constexpr std::string_view kwMutableSpace
#define BUILD_WITH_SPACE_BEFORE(kw)
constexpr std::string_view kwUsingSpace
#define KW_DELETE
constexpr std::string_view kwDelete
constexpr std::string_view kwConstExprSpace
constexpr std::string_view kwTemplateSpace
constexpr std::string_view kwCoReturnSpace
#define HLP_ASSIGN
#define KW_NULLPTR
#define KW_ELIPSIS
constexpr std::string_view KW_OPERATOR_ALL
constexpr std::string_view kwCoYieldSpace
consteval std::string_view KwWithNoSpace(std::string_view kw)
#define KW_PUBLIC
constexpr std::string_view kwSpaceConstExpr
constexpr std::string_view kwSpaceCCommentEndSpace
#define KW_STATIC_CAST
#define KW_PROTECTED
constexpr std::string_view kwNamespace
constexpr std::string_view kwCaseSpace
#define KW_NAMESPACE
#define KW_INLINE
constexpr std::string_view kwSizeof
constexpr std::string_view kwUnionSpace
#define KW_SWITCH
constexpr std::string_view kwSpaceCCommentEnd
#define KW_PRIVATE
#define KW_TRY
constexpr std::string_view kwEnumSpace
constexpr std::string_view kwElipsisSpace
#define KW_ENUM
constexpr std::string_view kwClassSpace
constexpr std::string_view kwTypeId
constexpr std::string_view kwConstEvalSpace
constexpr std::string_view kwSpaceEqualsDefault
constexpr std::string_view kwThis
constexpr std::string_view kwUnkown
constexpr std::string_view kwSpaceVolatile
constexpr std::string_view kwStructSpace
#define KW_CLASS
#define KW_EQUALS_DEFAULT
#define KW_UNION
#define BUILD_WITH_SPACE_AFTER(kw)
#define KW_CO_YIELD
constexpr std::string_view functionPointerPrefix
#define KW_INTERNAL_THIS
constexpr std::string_view kwStaticCast
constexpr std::string_view kwElipsis
constexpr std::string_view kwPublic
#define KW_CONTINUE
constexpr std::string_view kwOperator
constexpr std::string_view kwSpaceFinal
constexpr std::string_view kwNoexcept
#define KW_CONST
constexpr std::string_view kwCCommentStartSpace
constexpr std::string_view kwTypeNameSpace
#define KW_REINTERPRET_CAST
#define KW_NOEXCEPT
#define KW_VIRTUAL
#define KW_STRUCT
constexpr std::string_view kwExplicitSpace
constexpr std::string_view kwSwitch
#define KW_CASE
constexpr std::string_view kwFriendSpace
#define KW_CONCEPT
constexpr std::string_view kwOperatorSpace
#define KW_FALSE
#define KW_TEMPLATE
constexpr std::string_view kwInternalThis
#define KW_FRIEND
consteval std::string_view KwWithSpaceAfter(std::string_view kw)
constexpr std::string_view kwCppCommentStartSpace
#define KW_BREAK
constexpr std::string_view kwStaticSpace
constexpr std::string_view kwSpaceNoexcept
#define KW_SIZEOF
#define KW_ALIGNOF
constexpr std::string_view kwSpaceEqualsDelete
#define KW_NULL
constexpr std::string_view kwAlignof
constexpr std::string_view hlpResumeFn
constexpr std::string_view kwRequires
#define KW_EQUALS_DELETE
constexpr std::string_view kwNullptr
constexpr std::string_view kwFalse
#define KW_REQUIRES
#define KW_TYPENAME
#define KW_USING
constexpr std::string_view kwTrySpace
#define KW_FINAL
constexpr std::string_view kwReturnSpace
constexpr std::string_view kwExplicit
#define KW_DO
constexpr std::string_view hlpArrow
#define BUILD_KW(kw)
#define KW_CONSTEVAL
constexpr std::string_view hlpAssing
consteval std::string_view KwWithSpaceBefore(std::string_view kw)
constexpr std::string_view kwBreak
constexpr std::string_view kwDoSpace
constexpr std::string_view memberVariablePointerPrefix
#define KW_RETURN
constexpr std::string_view kwTypedefSpace
constexpr std::string_view kwWhile
constexpr std::string_view cxaAtExit
#define KW_VOLATILE
#define KW_OPERATOR
constexpr std::string_view kwVirtualSpace
#define KW_TYPEID
constexpr std::string_view kwGotoSpace
constexpr std::string_view kwPrivate
constexpr std::string_view kwProtected
constexpr std::string_view kwConceptSpace