17 #ifndef __OMNETPP_NEDXML_MSGCOMPILEROLD_H 18 #define __OMNETPP_NEDXML_MSGCOMPILEROLD_H 28 #include "msgelements.h" 46 generateClasses(true),
47 generateDescriptors(true),
48 generateSettersInDescriptors(true)
88 static const char *_RESERVED_WORDS[];
157 FieldInfo() : astNode(nullptr), fisabstract(false), fispointer(false), fisarray(false), classtype(UNKNOWN), fnopack(false), feditable(false),fopaque(false) {}
188 ClassInfo() : nedElement(nullptr), gap(false), omitgetverb(false), classtype(UNKNOWN),
189 generate_class(true), generate_descriptor(true), generate_setters_in_descriptor(true) {}
216 void initDescriptors();
217 std::string prefixWithNamespace(
const std::string& s);
218 StringVector lookupExistingClassName(
const std::string& s);
219 StringVector lookupExistingEnumName(
const std::string& s);
220 bool isClassDeclared(
const std::string& classqname) {
return classType.find(classqname) != classType.end(); }
221 void addClassType(
const std::string& classqname,
ClassType type,
ASTNode *context);
222 ClassType getClassType(
const std::string& classqname);
224 void extractClassDecl(
ASTNode *node);
225 Properties extractPropertiesOf(
ASTNode *node);
227 void prepareForCodeGeneration(
ClassInfo& classInfo);
228 EnumInfo extractEnumInfo(EnumElement *node);
229 void generateClass(
const ClassInfo& classInfo);
230 void generateStruct(
const ClassInfo& classInfo);
231 void generateDescriptorClass(
const ClassInfo& a);
232 void generateEnum(
const EnumInfo& enumInfo);
233 void generateNamespaceBegin(
ASTNode *element);
234 void generateNamespaceEnd();
235 std::string generatePreComment(
ASTNode *nedElement);
236 void generateTemplates();
237 bool getPropertyAsBool(
const Properties& p,
const char *name,
bool defval);
238 std::string getProperty(
const Properties& p,
const char *name,
const std::string& defval = std::string());
239 void generate(MsgFileElement *fileElement);
240 std::string makeFuncall(
const std::string& var,
const std::string& funcTemplate,
bool withIndex=
false,
const std::string& value=
"");
257 void generate(MsgFileElement *fileElement,
const char *hFile,
const char *ccFile);
std::string value
Definition: msgcompilerold.h:200
std::set< std::string > WordSet
Definition: msgcompilerold.h:89
const char * cppTypeName
Definition: msgcompilerold.h:78
std::string ccFilename
Definition: msgcompilerold.h:93
std::string maybe_c_str
Definition: msgcompilerold.h:148
#define NEDXML_API
Definition: nedxmldefs.h:31
bool generateSettersInDescriptors
Definition: msgcompilerold.h:43
bool generateClasses
Definition: msgcompilerold.h:41
std::string msgdescclass
Definition: msgcompilerold.h:173
std::map< std::string, ClassType > classType
Definition: msgcompilerold.h:97
std::string fieldnamesuffix
Definition: msgcompilerold.h:174
Fieldlist baseclassFieldlist
Definition: msgcompilerold.h:176
std::string fname
Definition: msgcompilerold.h:114
FieldList fieldlist
Definition: msgcompilerold.h:210
std::string tostring
Definition: msgcompilerold.h:138
Definition: msgcompilerold.h:69
bool generate_class
Definition: msgcompilerold.h:178
std::string exportDef
Definition: msgcompilerold.h:40
std::map< std::string, TypeDesc > TypeDescMap
Definition: msgcompilerold.h:85
std::string setter
Definition: msgcompilerold.h:135
FieldInfo()
Definition: msgcompilerold.h:157
const char * fromstring
Definition: msgcompilerold.h:79
std::string name
Definition: msgcompilerold.h:199
const char * msgTypeName
Definition: msgcompilerold.h:77
const char * emptyValue
Definition: msgcompilerold.h:81
StringVector namespaceNameVector
Definition: msgcompilerold.h:100
bool fisabstract
Definition: msgcompilerold.h:118
std::string datatype
Definition: msgcompilerold.h:127
Definition: msgcompilerold.h:75
std::string varsize
Definition: msgcompilerold.h:132
std::string var
Definition: msgcompilerold.h:130
bool omitgetverb
Definition: msgcompilerold.h:168
ASTNode * nedElement
Definition: msgcompilerold.h:161
std::string alloc
Definition: msgcompilerold.h:136
std::string argname
Definition: msgcompilerold.h:131
Definition: msgcompilerold.h:192
std::string fval
Definition: msgcompilerold.h:117
std::string msgbaseclass
Definition: msgcompilerold.h:172
bool fopaque
Definition: msgcompilerold.h:154
ASTNode * astNode
Definition: msgcompilerold.h:112
ASTNode * nedElement
Definition: msgcompilerold.h:198
Properties props
Definition: msgcompilerold.h:165
const char * tostring
Definition: msgcompilerold.h:80
EnumInfo()
Definition: msgcompilerold.h:212
EnumItem()
Definition: msgcompilerold.h:203
std::string fsizetype
Definition: msgcompilerold.h:133
std::string farraysize
Definition: msgcompilerold.h:121
bool feditable
Definition: msgcompilerold.h:152
std::string msgbase
Definition: msgcompilerold.h:164
Definition: msgcompilerold.h:68
ClassType classtype
Definition: msgcompilerold.h:126
ClassInfo()
Definition: msgcompilerold.h:188
bool generate_setters_in_descriptor
Definition: msgcompilerold.h:180
Definition: msgcompilerold.h:67
StringVector implements
Definition: msgcompilerold.h:185
std::string comment
Definition: msgcompilerold.h:201
std::vector< FieldInfo > Fieldlist
Definition: msgcompilerold.h:159
std::map< std::string, std::string > enumType
Definition: msgcompilerold.h:98
std::string msgclass
Definition: msgcompilerold.h:170
Definition: msgcompilerold.h:110
std::string enumqname
Definition: msgcompilerold.h:150
std::string getsize
Definition: msgcompilerold.h:137
bool fnopack
Definition: msgcompilerold.h:151
std::string getter
Definition: msgcompilerold.h:134
std::string msgbaseqname
Definition: msgcompilerold.h:183
Definition: msgcompilerold.h:70
EnumElement * nedElement
Definition: msgcompilerold.h:206
std::vector< EnumItem > FieldList
Definition: msgcompilerold.h:209
Generates C++ code from a MSG file. Covers the MSG language of OMNeT++ 4.x, and 5.x up to 5.2.
Definition: msgcompilerold.h:60
std::vector< std::string > StringVector
Definition: msgcompilerold.h:63
bool gap
Definition: msgcompilerold.h:167
Definition: msgcompilerold.h:108
std::string ftype
Definition: msgcompilerold.h:115
std::string rettype
Definition: msgcompilerold.h:129
Options for MsgCompilerOld.
Definition: msgcompilerold.h:38
std::string argtype
Definition: msgcompilerold.h:128
ClassType classtype
Definition: msgcompilerold.h:169
bool fisarray
Definition: msgcompilerold.h:120
bool fisprimitivetype
Definition: msgcompilerold.h:125
std::string namespaceName
Definition: msgcompilerold.h:99
Properties fprops
Definition: msgcompilerold.h:122
Definition: astbuilder.h:25
std::string fromstring
Definition: msgcompilerold.h:146
std::string enumQName
Definition: msgcompilerold.h:208
bool fispointer
Definition: msgcompilerold.h:119
bool generate_descriptor
Definition: msgcompilerold.h:179
std::string msgqname
Definition: msgcompilerold.h:182
std::string msgname
Definition: msgcompilerold.h:163
std::string enumName
Definition: msgcompilerold.h:207
bool isClassDeclared(const std::string &classqname)
Definition: msgcompilerold.h:220
std::map< std::string, std::string > Properties
Definition: msgcompilerold.h:106
std::string realmsgclass
Definition: msgcompilerold.h:171
bool generateDescriptors
Definition: msgcompilerold.h:42
std::string enumname
Definition: msgcompilerold.h:149
ErrorStore * errors
Definition: msgcompilerold.h:96
Definition: errorstore.h:37
std::ostream * ccOutp
Definition: msgcompilerold.h:95
Fieldlist fieldlist
Definition: msgcompilerold.h:175
std::string keyword
Definition: msgcompilerold.h:162
bool editNotDisabled
Definition: msgcompilerold.h:153
ClassType
Definition: msgcompilerold.h:65
MsgCompilerOptionsOld opts
Definition: msgcompilerold.h:103
std::string hFilename
Definition: msgcompilerold.h:92
WordSet RESERVED_WORDS
Definition: msgcompilerold.h:90
std::ostream * hOutp
Definition: msgcompilerold.h:94
Definition: msgcompilerold.h:195
std::string ftypeqname
Definition: msgcompilerold.h:116
TypeDescMap PRIMITIVE_TYPES
Definition: msgcompilerold.h:86
MsgCompilerOptionsOld()
Definition: msgcompilerold.h:45