OMNeT++ NEDXML  6.0.3
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)
 
void analyzeCplusplusBlockTarget (CplusplusElement *cppElem, const std::string &currentNamespace)
 

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_ABSTRACT = "abstract"
 
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_POLYMORPHIC = "polymorphic"
 
static constexpr const char * PROP_DEFAULTVALUE = "defaultValue"
 
static constexpr const char * PROP_CPPTYPE = "cppType"
 
static constexpr const char * PROP_DATAMEMBERTYPE = "datamemberType"
 
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_TOVALUE = "toValue"
 
static constexpr const char * PROP_FROMVALUE = "fromValue"
 
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_CASTFUNCTION = "castFunction"
 
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_REPLACEABLE = "replaceable"
 
static constexpr const char * PROP_RESIZABLE = "resizable"
 
static constexpr const char * PROP_READONLY = "readonly"
 
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_APPENDER = "appender"
 
static constexpr const char * PROP_ERASER = "eraser"
 
static constexpr const char * PROP_REMOVER = "remover"
 
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 constexpr const char * PROP_CUSTOM = "custom"
 
static constexpr const char * PROP_CUSTOMIMPL = "customImpl"
 

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 getMethodProperty (const Properties &props, const char *propName, bool existingClass)
 
std::string decorateType (const std::string &typeName, bool isConst, bool isPointer, bool isRef)
 
std::string makeRelative (const std::string &qname, const std::string &namespaceName)
 
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

◆ StringSet

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

◆ StringVector

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

◆ Property

◆ Properties

◆ FieldInfo

◆ ClassInfo

◆ EnumItem

◆ EnumInfo

Constructor & Destructor Documentation

◆ MsgAnalyzer()

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

◆ ~MsgAnalyzer()

~MsgAnalyzer ( )
inline

Member Function Documentation

◆ extractFields()

void extractFields ( ClassInfo classInfo)
protected

◆ analyzeClassOrStruct()

void analyzeClassOrStruct ( ClassInfo classInfo,
const std::string &  namespaceName 
)
protected

◆ analyzeFields()

void analyzeFields ( ClassInfo classInfo,
const std::string &  namespaceName 
)
protected

◆ analyzeField()

void analyzeField ( ClassInfo classInfo,
FieldInfo field,
const std::string &  namespaceName 
)
protected

◆ analyzeInheritedField()

void analyzeInheritedField ( ClassInfo classInfo,
FieldInfo field 
)
protected

◆ prefixWithNamespace()

std::string prefixWithNamespace ( const std::string &  name,
const std::string &  namespaceName 
)
protected

◆ extractProperties()

Properties extractProperties ( ASTNode node)
protected

◆ hasSuperclass()

bool hasSuperclass ( ClassInfo classInfo,
const std::string &  superclassQName 
)
protected

◆ findField()

FieldInfo* findField ( ClassInfo classInfo,
const std::string &  name 
)
protected

◆ findSuperclassField()

FieldInfo* findSuperclassField ( ClassInfo classInfo,
const std::string &  fieldName 
)
protected

◆ hasProperty()

bool hasProperty ( const Properties p,
const char *  name 
)
inlineprotected

◆ getPropertyAsBool()

bool getPropertyAsBool ( const Properties p,
const char *  name,
bool  defval 
)
protected

◆ getProperty()

std::string getProperty ( const Properties p,
const char *  name,
const std::string &  defval = std::string() 
)
protected

◆ getMethodProperty()

std::string getMethodProperty ( const Properties props,
const char *  propName,
bool  existingClass 
)
protected

◆ decorateType()

std::string decorateType ( const std::string &  typeName,
bool  isConst,
bool  isPointer,
bool  isRef 
)
protected

◆ makeRelative()

std::string makeRelative ( const std::string &  qname,
const std::string &  namespaceName 
)
protected

◆ lookupExistingClassName()

std::string lookupExistingClassName ( const std::string &  name,
const std::string &  contextNamespace,
ClassInfo contextClass = nullptr 
)
protected

◆ validateProperty()

void validateProperty ( const Property property,
const char *  usage 
)
protected

◆ extractClassInfo()

ClassInfo extractClassInfo ( ASTNode node,
const std::string &  namespaceName,
bool  isImported 
)

◆ ensureAnalyzed()

void ensureAnalyzed ( ClassInfo classInfo)

◆ ensureFieldsAnalyzed()

void ensureFieldsAnalyzed ( ClassInfo classInfo)

◆ extractEnumDecl()

EnumInfo extractEnumDecl ( EnumDeclElement *  node,
const std::string &  namespaceName 
)

◆ extractEnumInfo()

EnumInfo extractEnumInfo ( EnumElement *  node,
const std::string &  namespaceName 
)

◆ extractClassInfoFromEnum()

ClassInfo extractClassInfoFromEnum ( EnumElement *  node,
const std::string &  namespaceName,
bool  isImported 
)

◆ extractProperty()

Property extractProperty ( PropertyElement *  propertyElem)

◆ validateFileProperty()

void validateFileProperty ( const Property property)

◆ analyzeCplusplusBlockTarget()

void analyzeCplusplusBlockTarget ( CplusplusElement *  cppElem,
const std::string &  currentNamespace 
)

Member Data Documentation

◆ RESERVED_WORDS

StringSet RESERVED_WORDS
static

◆ errors

ErrorStore* errors
protected

◆ typeTable

MsgTypeTable* typeTable
protected

◆ opts

const MsgCompilerOptions& opts
protected

◆ ATT_NAME

constexpr const char* ATT_NAME = "name"
staticconstexpr

◆ ATT_EXTENDS_NAME

constexpr const char* ATT_EXTENDS_NAME = "extends-name"
staticconstexpr

◆ PROP_PROPERTY

constexpr const char* PROP_PROPERTY = "property"
staticconstexpr

◆ PROP_ABSTRACT

constexpr const char* PROP_ABSTRACT = "abstract"
staticconstexpr

◆ PROP_ACTUALLY

constexpr const char* PROP_ACTUALLY = "actually"
staticconstexpr

◆ PROP_PRIMITIVE

constexpr const char* PROP_PRIMITIVE = "primitive"
staticconstexpr

◆ PROP_OPAQUE

constexpr const char* PROP_OPAQUE = "opaque"
staticconstexpr

◆ PROP_BYVALUE

constexpr const char* PROP_BYVALUE = "byValue"
staticconstexpr

◆ PROP_SUPPORTSPTR

constexpr const char* PROP_SUPPORTSPTR = "supportsPtr"
staticconstexpr

◆ PROP_SUBCLASSABLE

constexpr const char* PROP_SUBCLASSABLE = "subclassable"
staticconstexpr

◆ PROP_POLYMORPHIC

constexpr const char* PROP_POLYMORPHIC = "polymorphic"
staticconstexpr

◆ PROP_DEFAULTVALUE

constexpr const char* PROP_DEFAULTVALUE = "defaultValue"
staticconstexpr

◆ PROP_CPPTYPE

constexpr const char* PROP_CPPTYPE = "cppType"
staticconstexpr

◆ PROP_DATAMEMBERTYPE

constexpr const char* PROP_DATAMEMBERTYPE = "datamemberType"
staticconstexpr

◆ PROP_ARGTYPE

constexpr const char* PROP_ARGTYPE = "argType"
staticconstexpr

◆ PROP_RETURNTYPE

constexpr const char* PROP_RETURNTYPE = "returnType"
staticconstexpr

◆ PROP_TOSTRING

constexpr const char* PROP_TOSTRING = "toString"
staticconstexpr

◆ PROP_FROMSTRING

constexpr const char* PROP_FROMSTRING = "fromString"
staticconstexpr

◆ PROP_TOVALUE

constexpr const char* PROP_TOVALUE = "toValue"
staticconstexpr

◆ PROP_FROMVALUE

constexpr const char* PROP_FROMVALUE = "fromValue"
staticconstexpr

◆ PROP_GETTERCONVERSION

constexpr const char* PROP_GETTERCONVERSION = "getterConversion"
staticconstexpr

◆ PROP_CLONE

constexpr const char* PROP_CLONE = "clone"
staticconstexpr

◆ PROP_EXISTINGCLASS

constexpr const char* PROP_EXISTINGCLASS = "existingClass"
staticconstexpr

◆ PROP_DESCRIPTOR

constexpr const char* PROP_DESCRIPTOR = "descriptor"
staticconstexpr

◆ PROP_CASTFUNCTION

constexpr const char* PROP_CASTFUNCTION = "castFunction"
staticconstexpr

◆ PROP_OMITGETVERB

constexpr const char* PROP_OMITGETVERB = "omitGetVerb"
staticconstexpr

◆ PROP_FIELDNAMESUFFIX

constexpr const char* PROP_FIELDNAMESUFFIX = "fieldNameSuffix"
staticconstexpr

◆ PROP_BEFORECHANGE

constexpr const char* PROP_BEFORECHANGE = "beforeChange"
staticconstexpr

◆ PROP_IMPLEMENTS

constexpr const char* PROP_IMPLEMENTS = "implements"
staticconstexpr

◆ PROP_NOPACK

constexpr const char* PROP_NOPACK = "nopack"
staticconstexpr

◆ PROP_OWNED

constexpr const char* PROP_OWNED = "owned"
staticconstexpr

◆ PROP_EDITABLE

constexpr const char* PROP_EDITABLE = "editable"
staticconstexpr

◆ PROP_REPLACEABLE

constexpr const char* PROP_REPLACEABLE = "replaceable"
staticconstexpr

◆ PROP_RESIZABLE

constexpr const char* PROP_RESIZABLE = "resizable"
staticconstexpr

◆ PROP_READONLY

constexpr const char* PROP_READONLY = "readonly"
staticconstexpr

◆ PROP_OVERRIDEGETTER

constexpr const char* PROP_OVERRIDEGETTER = "overrideGetter"
staticconstexpr

◆ PROP_OVERRIDESETTER

constexpr const char* PROP_OVERRIDESETTER = "overrideSetter"
staticconstexpr

◆ PROP_ENUM

constexpr const char* PROP_ENUM = "enum"
staticconstexpr

◆ PROP_SIZETYPE

constexpr const char* PROP_SIZETYPE = "sizeType"
staticconstexpr

◆ PROP_SETTER

constexpr const char* PROP_SETTER = "setter"
staticconstexpr

◆ PROP_GETTER

constexpr const char* PROP_GETTER = "getter"
staticconstexpr

◆ PROP_GETTERFORUPDATE

constexpr const char* PROP_GETTERFORUPDATE = "getterForUpdate"
staticconstexpr

◆ PROP_SIZESETTER

constexpr const char* PROP_SIZESETTER = "sizeSetter"
staticconstexpr

◆ PROP_SIZEGETTER

constexpr const char* PROP_SIZEGETTER = "sizeGetter"
staticconstexpr

◆ PROP_INSERTER

constexpr const char* PROP_INSERTER = "inserter"
staticconstexpr

◆ PROP_APPENDER

constexpr const char* PROP_APPENDER = "appender"
staticconstexpr

◆ PROP_ERASER

constexpr const char* PROP_ERASER = "eraser"
staticconstexpr

◆ PROP_REMOVER

constexpr const char* PROP_REMOVER = "remover"
staticconstexpr

◆ PROP_ALLOWREPLACE

constexpr const char* PROP_ALLOWREPLACE = "allowReplace"
staticconstexpr

◆ PROP_STR

constexpr const char* PROP_STR = "str"
staticconstexpr

◆ PROP_CUSTOMIZE

constexpr const char* PROP_CUSTOMIZE = "customize"
staticconstexpr

◆ PROP_OVERWRITEPREVIOUSDEFINITION

constexpr const char* PROP_OVERWRITEPREVIOUSDEFINITION = "overwritePreviousDefinition"
staticconstexpr

◆ PROP_CUSTOM

constexpr const char* PROP_CUSTOM = "custom"
staticconstexpr

◆ PROP_CUSTOMIMPL

constexpr const char* PROP_CUSTOMIMPL = "customImpl"
staticconstexpr

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