Class CGenContext#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Derived Types#

Class Documentation#

class CGenContext#

Generator context.

Subclassed by CDefinitionGeneratorBase< CDefinitionContext >, CDefinitionGeneratorBase< CSerdesContext >, CDefinitionGeneratorBase< TDefEntityContext >, CIdlCompilerCMakeGenerator, CPSClassGeneratorBase, CPsCppGenerator

Public Types

typedef std::map<std::string, std::string> CKeywordMap#

Keyword map for keyword replacement in a string.

typedef std::vector<std::string> CExceptionVector#

Vector containing the exceptions that might be thrown by the function.

Public Functions

CGenContext(sdv::IInterfaceAccess *pParser)#

Constructor.

Parameters:

pParser[in] Pointer to the parser object.

virtual ~CGenContext()#

Destructor.

template<typename TInterface>
inline TInterface *GetInterface(sdv::IInterfaceAccess *pObject) const#

Get the parser interface.

Template Parameters:

TInterface – The interface to request the interface from.

Parameters:

pObject[in] Pointer to the object to request the interface from or NULL when the parser should be asked.

Returns:

Returns a pointer to the interface if available.

inline sdv::IInterfaceAccess *GetParser() const#

Return the interface to the parser.

Returns:

The interface to the parser or NULL when the parser is not available.

std::filesystem::path GetSource() const#

Get source path.

Returns:

Returns the source path.

std::filesystem::path GetOutputDir() const#

Get the output directory.

Remark

If there is no output directory defined, takes the parent directory of the source.

Returns:

Returns the output directory path.

std::string Header(const std::filesystem::path &rpathFile, const std::string &rssDescription = std::string()) const#

File header generation using JavaDoc C-style comments.

Parameters:
  • rpathFile[in] Reference to the path to the file to generate the header for.

  • rssDescription[in] Optional description to add to the file header.

Returns:

Returns the file header string.

SCDeclInfo GetCDeclTypeStr(sdv::IInterfaceAccess *pDeclTypeObj, const std::string &rssScope, bool bScopedName = false) const#

Get the C++ declaration type as string.

Attention

Does not check for anonymous types.

Parameters:
  • pDeclTypeObj[in] Pointer to the IInterfaceAccess interface of the declaration type object.

  • rssScope[in] Reference to the string containing the current scope.

  • bScopedName[in] When set, return the scoped name.

Returns:

The declaration information (or empty types when not available).

Public Static Functions

static std::string Safeguard(const std::filesystem::path &rpathFile, bool bInitial)#

Creates safeguard C++ string that can be used to safeguard a C++ header file.

Parameters:
  • rpathFile[in] Reference to the path to the file to use for safeguarding.

  • bInitial[in] When set, creates initial lines, otherwise closing lines.

Returns:

Returns the safeguard string composed front the path.

static std::string SmartIndent(const std::string &rssStr, const std::string &rssIndent)#

Insert indentation before each text within a (multi-line) string.

If the line doesn’t start with a number sign insert an indentation before each line. Also a line-concatinating character (back-slash before end of line) will be removed. Independent of the number sign, any whitespace at the end of each line will be removed.

Parameters:
  • rssStr[in] Reference to the string to adapt.

  • rssIndent[in] Reference to the indentation string to insert.

Returns:

Returns the string with inserted indentations

static std::string QualifyName(const std::string &rssName)#

Make a qualified identifier from a fully scoped name with array brackets.

A fully scoped name contains all the namespace and struct definitions that define the context of the supplied name. The names of each level is separated by the scope separator (::). Also any member declaration is separated by the member separator (.). The name could also contain square brackets to identify an array. This function replaces the scope operator by a double underscore (__), the array operator by a single underscore and the array brackets by a single underscore. In the end, the name results in a qualified C++ name.

Parameters:

rssName[in] Reference to the name string to qualify.

Returns:

Returns the qualified name sstring.

static std::string ReplaceKeywords(const std::string &rssStr, const CKeywordMap &rmapKeywords, char cMarker = '%')#

Replace keywords in a string.

Parameters:
  • rssStr[in] Reference to the string containing the keywords.

  • rmapKeywords[in] Map with keywords to replace.

  • cMarker[in] Character to identify the keyword with (placed before and after the keyword; e.g. keyword%).

Returns:

Returns the string with replacements.

static std::string GetIndentChars()#

Get indentation string (represents one tab).

Returns:

Reference to the string with the indentation.

static std::string MapEntityType2CType(sdv::idl::EEntityType eEntityType)#

Map the IDL type to the C type (if possible).

Parameters:

eEntityType[in] The entity type to map.

Returns:

Returns a string representing the C type or empty if there is no C type or “invalid” if the type is invalid.

static std::string MapDeclType2CType(sdv::idl::EDeclType eDeclType)#

Map the IDL type to the C type (if possible).

Parameters:

eDeclType[in] The declaration type to map.

Returns:

Returns a string representing the C type or empty if there is no C type or “invalid” if the type is invalid.

static std::string GetRelativeScopedName(const std::string &ssScopedName, const std::string &rssScope)#

Get a relative scoped name based on the provided scope entity.

Parameters:
  • ssScopedName[in] Reference to the fully scoped name of the entity.

  • rssScope[in] Reference to the current scope.

Returns:

String with the relatively scoped name.

struct SCDeclInfo#

Declaration information.

Subclassed by CPSClassGeneratorBase::SParamInfo

Public Members

sdv::idl::EDeclType eBaseType = sdv::idl::EDeclType::decltype_unknown#

Base type.

std::string ssDeclType#

Declaration type (incl. pointer addition for every array extend).

bool bIsPointer = false#

Type is represented as a pointer to dynamic data or an interface.

bool bIsComplex = false#

Complex data type; use by-ref for parameters.

bool bTemplated = false#

Type has template parameters.

bool bIsInterface = false#

Type is an interface pointer.

bool bIsString = false#

Set when the type represents a string object.

bool bIsDynamic = false#

Type is dynamic.

bool bValidType = false#

Type is not void.