8#ifndef SEN_LIBS_GEN_SRC_COMMON_UTIL_H
9#define SEN_LIBS_GEN_SRC_COMMON_UTIL_H
16#include <inja/environment.hpp>
38[[nodiscard]] std::vector<std::string>
tokenize(
const std::string& str,
const char delim);
41[[nodiscard]] std::string
prepend(
const std::string& prefix,
const std::string str);
44[[nodiscard]] std::string
append(
const std::string& lhs,
const std::string rhs);
47[[nodiscard]] std::string
capitalize(
const std::string& str);
50[[nodiscard]] std::string
capitalize(std::string_view str);
88 std::stringstream stream;
89 stream <<
"0x" << std::setfill(
'0') << std::setw(
sizeof(T) +
sizeof(T)) << std::hex << i;
96 std::stringstream stream;
97 stream <<
"0x" << std::setfill(
'0') << std::setw(
sizeof(T)) << std::hex << i;
Represents a user-defined type.
Definition custom_type.h:23
Represents a type that can be used to define variables and arguments for methods or functions....
Definition type.h:71
The set of types used during resolution.
Definition stl_resolver.h:51
A set of types coming from a STL file.
Definition stl_resolver.h:33
Definition gen/src/common/util.h:30
constexpr std::size_t maxCommentLineLength
Definition gen/src/common/util.h:31
Definition type_storage.h:28
std::string intToHex2(T i)
Definition gen/src/common/util.h:94
std::string append(const std::string &lhs, const std::string rhs)
Appends a suffix to the end of a given string.
std::string intToHex(T i)
Definition gen/src/common/util.h:86
std::string collapseWhitespace(std::string_view text)
Collapses a description to one run of prose. Model text wraps and indents its sentences in the source...
void throwUnsupportedType(const sen::Type &type)
Refuses a type no template covers, in the one wording every generator used. Each had its own copy of ...
std::string capitalize(const std::string &str)
Transform a string to uppercase.
std::string computePackageName(const sen::lang::TypeSet &set)
Computes the dotted package name, as the language writes it: "sen.kernel", "rpr". Four generators eac...
std::string prepend(const std::string &prefix, const std::string str)
Appends a prefix to the beginning of a given string.
std::vector< const sen::lang::TypeSet * > collectAllTypeSets(const sen::lang::TypeSetContext &typeSets)
Walks the given context's type sets and their imports depth-first, returning unique sets in insertion...
void configureEnv(inja::Environment &env)
Registers inja helper callbacks used by generator templates.
std::string computeCppNamespace(const std::vector< std::string > &package)
Computes C++ namespace from a string package.
std::vector< std::string > tokenize(const std::string &str, const char delim)
Splits a string into substrings by a delimiter, skipping empty results.
std::string kindOf(const sen::CustomType &type)
How a type is grouped in a document: "classes", "structures", "enumerations", "variants",...