cpptooling.data.representation

Members

Enums

MergeMode
enum MergeMode

Dictates how the namespaces are merged.

Functions

getName
string getName(ref const(CppClass.CppFunc) method)

Get the name of a C++ method.

getName
string getName(const CxParam p, string default_)

Get the name of a parameter or the default.

getType
string getType(const CxParam p)

Get the parameter type as a string.

joinParamNames
string joinParamNames(T r)

Join a range of CxParams by extracting the parameter names.

joinParamTypes
string joinParamTypes(const(CxParam)[] r)

Join a range of CxParams to a string of the parameter types separated by ", ".

joinParams
string joinParams(const(CxParam)[] r)

Join a range of CxParams to a string separated by ", ".

makeCxParam
CxParam makeCxParam()

Make a variadic parameter.

makeCxParam
CxParam makeCxParam(TypeKindVariable tk)

CxParam created by analyzing a TypeKindVariable. A empty variable name means it is of the algebraic type TypeKind.

makeUniqueUSR
USRType makeUniqueUSR()

Construct a USR that is ensured to be unique.

nextUniqueID
size_t nextUniqueID()

Generate the next globally unique ID.

paramNameToString
string paramNameToString(CxParam p, string id = "")

Convert a CxParam to a string.

paramTypeToString
string paramTypeToString(CxParam p, string id = "")

Convert a CxParam to a string.

toInternal
string toInternal(CxParam p)

Convert a CxParam to a string.

toInternal
string toInternal(TypeKindVariable tk)

Convert a TypeKindVariable to a string.

unpackParam
UnpackParamResult unpackParam(ref const(CxParam) p)

Unpack a CxParam.

Structs

CFunction
struct CFunction

Information about free functions. TODO: rename to CxFreeFunction

CppClass
struct CppClass
CppCtor
struct CppCtor

Represent a C++ constructor.

CppMethod
struct CppMethod
CppMethodGeneric
struct CppMethodGeneric
CppMethodOp
struct CppMethodOp
CppNamespace
struct CppNamespace
CppRoot
struct CppRoot

The root of the data structure of the semantic representation of the analyzed C++ source.

CxGlobalVariable
struct CxGlobalVariable

Meta

Authors

Joakim Brännström (joakim.brannstrom@gmx.com)

Structuraly represents the semantic-centric view of of C/C++ code.

The guiding principle for this module is: "Correct by construction". After the data is created it should be "correct". As far as possible avoid runtime errors.

Structs was chosen instead of classes to: ensure allocation on the stack. lower the GC pressure. dynamic dispatch isn't needed. value semantics.

Design rules for Structural representation. shall: toString functions shall never append a newline as the last character. toString(..., FormatSpec!Char fmt) shall have a %u when the struct has a USR. all c'tor parameters shall be const. members are declared at the top. Rationale const: (The ':' is not a typo) can affect var members thus all member shall be defined after imports. when applicable: attributes "@safe" for the struct. Add mixin for Id when the need arise.

TODO Implement uniqueness for namespaces and classes via e.g. RedBlackTree's

Date

Date: 2015-2017, Joakim Brännström

License

MPL-2, Mozilla Public License 2.0