OMNeT++ NEDXML  5.4.1
MsgAnalyzer Class Reference

#include <msganalyzer.h>

Description

Part of the message compiler. Produces ClassInfo/EnumInfo objects from the ASTNode tree. Assumes object tree has already passed all validation stages (DTD, syntax, semantic).

Public Types

typedef std::set< std::string > StringSet
 
typedef std::vector< std::string > StringVector
 
typedef MsgTypeTable::Property Property
 
typedef MsgTypeTable::Properties Properties
 
typedef MsgTypeTable::FieldInfo FieldInfo
 
typedef MsgTypeTable::ClassInfo ClassInfo
 
typedef MsgTypeTable::EnumItem EnumItem
 
typedef MsgTypeTable::EnumInfo EnumInfo
 

Public Member Functions

 MsgAnalyzer (const MsgCompilerOptions &opts, MsgTypeTable *typeTable, ErrorStore *errors)
 
 ~MsgAnalyzer ()
 
ClassInfo extractClassInfo (ASTNode *node, const std::string &namespaceName, bool isImported)
 
void ensureAnalyzed (ClassInfo &classInfo)
 
void ensureFieldsAnalyzed (ClassInfo &classInfo)
 
EnumInfo extractEnumDecl (EnumDeclElement *node, const std::string &namespaceName)
 
EnumInfo extractEnumInfo (EnumElement *node, const std::string &namespaceName)
 
ClassInfo extractClassInfoFromEnum (EnumElement *node, const std::string &namespaceName, bool isImported)
 
Property extractProperty (PropertyElement *propertyElem)
 
void validateFileProperty (const Property &property)
 

Static Public Attributes

static StringSet RESERVED_WORDS
 
static constexpr const char * ATT_NAME = "name"
 
static constexpr const char * ATT_EXTENDS_NAME = "extends-name"
 
static constexpr const char * PROP_PROPERTY = "property"
 
static constexpr const char * PROP_ACTUALLY = "actually"
 
static constexpr const char * PROP_PRIMITIVE = "primitive"
 
static constexpr const char * PROP_OPAQUE = "opaque"
 
static constexpr const char * PROP_BYVALUE = "byValue"
 
static constexpr const char * PROP_SUPPORTSPTR = "supportsPtr"
 
static constexpr const char * PROP_SUBCLASSABLE = "subclassable"
 
static constexpr const char * PROP_DEFAULTVALUE = "defaultValue"
 
static constexpr const char * PROP_CPPTYPE = "cppType"
 
static constexpr const char * PROP_ARGTYPE = "argType"
 
static constexpr const char * PROP_RETURNTYPE = "returnType"
 
static constexpr const char * PROP_TOSTRING = "toString"
 
static constexpr const char * PROP_FROMSTRING = "fromString"
 
static constexpr const char * PROP_GETTERCONVERSION = "getterConversion"
 
static constexpr const char * PROP_CLONE = "clone"
 
static constexpr const char * PROP_EXISTINGCLASS = "existingClass"
 
static constexpr const char * PROP_DESCRIPTOR = "descriptor"
 
static constexpr const char * PROP_OMITGETVERB = "omitGetVerb"
 
static constexpr const char * PROP_FIELDNAMESUFFIX = "fieldNameSuffix"
 
static constexpr const char * PROP_BEFORECHANGE = "beforeChange"
 
static constexpr const char * PROP_IMPLEMENTS = "implements"
 
static constexpr const char * PROP_NOPACK = "nopack"
 
static constexpr const char * PROP_OWNED = "owned"
 
static constexpr const char * PROP_EDITABLE = "editable"
 
static constexpr const char * PROP_OVERRIDEGETTER = "overrideGetter"
 
static constexpr const char * PROP_OVERRIDESETTER = "overrideSetter"
 
static constexpr const char * PROP_ENUM = "enum"
 
static constexpr const char * PROP_SIZETYPE = "sizeType"
 
static constexpr const char * PROP_SETTER = "setter"
 
static constexpr const char * PROP_GETTER = "getter"
 
static constexpr const char * PROP_GETTERFORUPDATE = "getterForUpdate"
 
static constexpr const char * PROP_SIZESETTER = "sizeSetter"
 
static constexpr const char * PROP_SIZEGETTER = "sizeGetter"
 
static constexpr const char * PROP_INSERTER = "inserter"
 
static constexpr const char * PROP_ERASER = "eraser"
 
static constexpr const char * PROP_ALLOWREPLACE = "allowReplace"
 
static constexpr const char * PROP_STR = "str"
 
static constexpr const char * PROP_CUSTOMIZE = "customize"
 
static constexpr const char * PROP_OVERWRITEPREVIOUSDEFINITION = "overwritePreviousDefinition"
 

Protected Member Functions

void extractFields (ClassInfo &classInfo)
 
void analyzeClassOrStruct (ClassInfo &classInfo, const std::string &namespaceName)
 
void analyzeFields (ClassInfo &classInfo, const std::string &namespaceName)
 
void analyzeField (ClassInfo &classInfo, FieldInfo *field, const std::string &namespaceName)
 
void analyzeInheritedField (ClassInfo &classInfo, FieldInfo *field)
 
std::string prefixWithNamespace (const std::string &name, const std::string &namespaceName)
 
Properties extractProperties (ASTNode *node)
 
bool hasSuperclass (ClassInfo &classInfo, const std::string &superclassQName)
 
FieldInfofindField (ClassInfo &classInfo, const std::string &name)
 
FieldInfofindSuperclassField (ClassInfo &classInfo, const std::string &fieldName)
 
bool hasProperty (const Properties &p, const char *name)
 
bool getPropertyAsBool (const Properties &p, const char *name, bool defval)
 
std::string getProperty (const Properties &p, const char *name, const std::string &defval=std::string())
 
std::string decorateType (const std::string &typeName, bool isConst, bool isPointer, bool isRef)
 
std::string lookupExistingClassName (const std::string &name, const std::string &contextNamespace, ClassInfo *contextClass=nullptr)
 
void validateProperty (const Property &property, const char *usage)
 

Protected Attributes

ErrorStoreerrors
 
MsgTypeTabletypeTable
 
const MsgCompilerOptionsopts
 

Member Typedef Documentation

typedef std::set<std::string> StringSet
typedef std::vector<std::string> StringVector

Constructor & Destructor Documentation

MsgAnalyzer ( const MsgCompilerOptions opts,
MsgTypeTable typeTable,
ErrorStore errors 
)

Member Function Documentation

void extractFields ( ClassInfo classInfo)
protected
void analyzeClassOrStruct ( ClassInfo classInfo,
const std::string &  namespaceName 
)
protected
void analyzeFields ( ClassInfo classInfo,
const std::string &  namespaceName 
)
protected
void analyzeField ( ClassInfo classInfo,
FieldInfo field,
const std::string &  namespaceName 
)
protected
void analyzeInheritedField ( ClassInfo classInfo,
FieldInfo field 
)
protected
std::string prefixWithNamespace ( const std::string &  name,
const std::string &  namespaceName 
)
protected
Properties extractProperties ( ASTNode node)
protected
bool hasSuperclass ( ClassInfo classInfo,
const std::string &  superclassQName 
)
protected
FieldInfo* findField ( ClassInfo classInfo,
const std::string &  name 
)
protected
FieldInfo* findSuperclassField ( ClassInfo classInfo,
const std::string &  fieldName 
)
protected
bool hasProperty ( const Properties p,
const char *  name 
)
inlineprotected
bool getPropertyAsBool ( const Properties p,
const char *  name,
bool  defval 
)
protected
std::string getProperty ( const Properties p,
const char *  name,
const std::string &  defval = std::string() 
)
protected
std::string decorateType ( const std::string &  typeName,
bool  isConst,
bool  isPointer,
bool  isRef 
)
protected
std::string lookupExistingClassName ( const std::string &  name,
const std::string &  contextNamespace,
ClassInfo contextClass = nullptr 
)
protected
void validateProperty ( const Property property,
const char *  usage 
)
protected
ClassInfo extractClassInfo ( ASTNode node,
const std::string &  namespaceName,
bool  isImported 
)
void ensureAnalyzed ( ClassInfo classInfo)
void ensureFieldsAnalyzed ( ClassInfo classInfo)
EnumInfo extractEnumDecl ( EnumDeclElement *  node,
const std::string &  namespaceName 
)
EnumInfo extractEnumInfo ( EnumElement *  node,
const std::string &  namespaceName 
)
ClassInfo extractClassInfoFromEnum ( EnumElement *  node,
const std::string &  namespaceName,
bool  isImported 
)
Property extractProperty ( PropertyElement *  propertyElem)
void validateFileProperty ( const Property property)

Member Data Documentation

StringSet RESERVED_WORDS
static
ErrorStore* errors
protected
MsgTypeTable* typeTable
protected
const MsgCompilerOptions& opts
protected
constexpr const char* ATT_NAME = "name"
static
constexpr const char* ATT_EXTENDS_NAME = "extends-name"
static
constexpr const char* PROP_PROPERTY = "property"
static
constexpr const char* PROP_ACTUALLY = "actually"
static
constexpr const char* PROP_PRIMITIVE = "primitive"
static
constexpr const char* PROP_OPAQUE = "opaque"
static
constexpr const char* PROP_BYVALUE = "byValue"
static
constexpr const char* PROP_SUPPORTSPTR = "supportsPtr"
static
constexpr const char* PROP_SUBCLASSABLE = "subclassable"
static
constexpr const char* PROP_DEFAULTVALUE = "defaultValue"
static
constexpr const char* PROP_CPPTYPE = "cppType"
static
constexpr const char* PROP_ARGTYPE = "argType"
static
constexpr const char* PROP_RETURNTYPE = "returnType"
static
constexpr const char* PROP_TOSTRING = "toString"
static
constexpr const char* PROP_FROMSTRING = "fromString"
static
constexpr const char* PROP_GETTERCONVERSION = "getterConversion"
static
constexpr const char* PROP_CLONE = "clone"
static
constexpr const char* PROP_EXISTINGCLASS = "existingClass"
static
constexpr const char* PROP_DESCRIPTOR = "descriptor"
static
constexpr const char* PROP_OMITGETVERB = "omitGetVerb"
static
constexpr const char* PROP_FIELDNAMESUFFIX = "fieldNameSuffix"
static
constexpr const char* PROP_BEFORECHANGE = "beforeChange"
static
constexpr const char* PROP_IMPLEMENTS = "implements"
static
constexpr const char* PROP_NOPACK = "nopack"
static
constexpr const char* PROP_OWNED = "owned"
static
constexpr const char* PROP_EDITABLE = "editable"
static
constexpr const char* PROP_OVERRIDEGETTER = "overrideGetter"
static
constexpr const char* PROP_OVERRIDESETTER = "overrideSetter"
static
constexpr const char* PROP_ENUM = "enum"
static
constexpr const char* PROP_SIZETYPE = "sizeType"
static
constexpr const char* PROP_SETTER = "setter"
static
constexpr const char* PROP_GETTER = "getter"
static
constexpr const char* PROP_GETTERFORUPDATE = "getterForUpdate"
static
constexpr const char* PROP_SIZESETTER = "sizeSetter"
static
constexpr const char* PROP_SIZEGETTER = "sizeGetter"
static
constexpr const char* PROP_INSERTER = "inserter"
static
constexpr const char* PROP_ERASER = "eraser"
static
constexpr const char* PROP_ALLOWREPLACE = "allowReplace"
static
constexpr const char* PROP_STR = "str"
static
constexpr const char* PROP_CUSTOMIZE = "customize"
static
constexpr const char* PROP_OVERWRITEPREVIOUSDEFINITION = "overwritePreviousDefinition"
static

The documentation for this class was generated from the following file: