36inline std::uint8_t
ptrLevel(std::unique_ptr<CppVarType>& varType)
38return varType->typeModifier().ptrLevel_;
43return varType->typeModifier().ptrLevel_;
53return varType->typeModifier().refType_;
58return varType->typeModifier().refType_;
63return ptrLevel(varType) + [&varType]() {
81inline std::string&
baseType(std::unique_ptr<CppVarType>& varType)
83return varType->baseType();
88return varType->baseType();
93return varTypeName.find(
'<') != varTypeName.npos;
107if (varType->
baseType().length() < 4)
109return (strncmp(varType->
baseType().c_str() + varType->
baseType().length() - 4,
"void", 4) == 0);
112inline bool isVoid(std::unique_ptr<CppVarType>& varType)
114return isVoid(varType.get());
122inline bool isByRef(std::unique_ptr<CppVarType>& varType)
152inline bool isConst(std::unique_ptr<CppVarType>& varType)
159return ((varType->typeAttr() &
kConst) ==
kConst) || (varType->typeModifier().constBits_ & 1);
168inline bool isByValue(std::unique_ptr<CppVarType>& varType)
176 && (varType->typeModifier().ptrLevel_ == 0);
184inline std::string&
baseType(std::unique_ptr<CppVar>& var)
199inline std::uint8_t
ptrLevel(std::unique_ptr<CppVar>& var)
229inline std::string&
name(std::unique_ptr<CppVar>& var)
231return name(var.get());
236return var->varDecl().name();
244inline bool isByRef(std::unique_ptr<CppVar>& var)
274inline bool isConst(std::unique_ptr<CppVar>& var)
Helps working with raw or unique_ptr of CppObj in a uniform way.
CppRefType
Type of references a variable can have in a C++ program.
bool isByValue(CppVarType *varType)
std::uint8_t effectivePtrLevel(CppVarTypeEPtr &varType)
bool isByRef(CppVarType *varType)
bool isConst(CppVarType *varType)
std::string & baseType(CppVarType *varType)
std::uint8_t ptrLevel(CppVarType *varType)
std::string & name(CppVar *var)
bool isByRValueRef(CppVarType *varType)
CppRefType refType(CppVarType *varType)
bool isVoid(CppVarType *varType)
bool usesTemplateType(std::string &varTypeName)
CppTypeModifier & typeModifier()
Class to represent C++ variable definition.