Skip to content
Snippets Groups Projects
Commit cc094aa7 authored by Patrick Dular's avatar Patrick Dular
Browse files

Append for non-existing Struct

parent a650fae6
No related branches found
No related tags found
No related merge requests found
...@@ -46,10 +46,10 @@ public: ...@@ -46,10 +46,10 @@ public:
std::map<std::string, std::vector<std::string> > & copt, std::map<std::string, std::vector<std::string> > & copt,
int member_ValMax) int member_ValMax)
{ {
if (tag >= 0) _tag = tag;
_member_ValMax = member_ValMax;
_fopt.insert(fopt.begin(), fopt.end()); _fopt.insert(fopt.begin(), fopt.end());
_copt.insert(copt.begin(), copt.end()); _copt.insert(copt.begin(), copt.end());
_member_ValMax = member_ValMax;
if (tag >= 0) _tag = tag;
return _tag; return _tag;
} }
...@@ -213,10 +213,13 @@ public: ...@@ -213,10 +213,13 @@ public:
int & tag_out, int member_ValMax, bool append = false) int & tag_out, int member_ValMax, bool append = false)
{ {
Structs * structs_P = &(*this)[key_namespace]; Structs * structs_P = &(*this)[key_namespace];
if (!append && structs_P->count(key_name)) { if (structs_P->count(key_name)) {
tag_out = (*structs_P)[key_name].getTag(); if (!append) {
return 1; // 1: Error: Redefinition of Struct tag_out = (*structs_P)[key_name].getTag();
return 1; // 1: Error: Redefinition of Struct
}
} }
else if (append) append = false; // non-existing Struct
tag_out = structs_P->defStruct(key_name, fopt, copt, member_ValMax, append); tag_out = structs_P->defStruct(key_name, fopt, copt, member_ValMax, append);
return 0; // 0: no error return 0; // 0: no error
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment