Debian Codegraph @

tools/genutils.cpp

raw symbols SCIP
1 #include "genutils.hpp"
2
3 #include <set>
4 #include <string>
5
6 static std::set<std::string> reserved{"alignas", "alignof", "and", "and_eq",
7 "asm", "atomic_cancel", "atomic_commit", "atomic_noexcept", "auto",
8 "bitand", "bitor", "bool", "break", "case", "catch", "char", "char16_t",
9 "char32_t", "class", "compl", "concept", "const", "constexpr", "const_cast",
10 "continue", "co_await", "co_return", "co_yield", "decltype", "default",
11 "delete", "do", "double", "dynamic_cast", "else", "enum", "explicit",
12 "export", "extern", "false", "float", "for", "friend", "goto", "if",
13 "import", "inline", "int", "long", "module", "mutable", "namespace", "new",
14 "noexcept", "not", "not_eq", "nullptr", "operator", "or", "or_eq",
15 "private", "protected", "public", "register", "reflexpr",
16 "reinterpret_cast", "requires", "return", "short", "signed", "sizeof",
17 "static", "static_assert", "static_cast", "struct", "switch",
18 "synchronized", "template", "this", "thread_local", "throw", "true", "try",
19 "typedef", "typeid", "typename", "union", "unsigned", "using", "virtual",
20 "void", "volatile", "wchar_t", "while", "xor", "xor_eq"};
21
22 std::string
23 unreserve(const std::string &s, bool force)
24 {
25 auto res(s);
26 if (!s.empty() && isdigit(s[0]))
27 res.insert(res.begin(), '_');
28 else if (reserved.find(s) != reserved.end() || toupper(s) == s || force)
29 res += "_";
30 return res;
31 }