50 #define NCBI_USE_ERRCODE_X Serial_TypeInfo
54 #define STATE_ENUM "E_Choice"
55 #define STATE_MEMBER "m_choice"
56 #define STRING_TYPE_FULL "NCBI_NS_STD::string"
57 #define STRING_TYPE "string"
58 #define STRING_MEMBER "m_string"
59 #define UTF8_STRING_MEMBER "m_string_utf8"
60 #define OBJECT_TYPE_FULL "NCBI_NS_NCBI::CSerialObject"
61 #define OBJECT_TYPE "CSerialObject"
62 #define OBJECT_MEMBER "m_object"
63 #define STATE_PREFIX "e_"
64 #define STATE_NOT_SET "e_not_set"
65 #define DELAY_MEMBER "m_delayBuffer"
66 #define DELAY_TYPE_FULL "NCBI_NS_NCBI::CDelayBuffer"
69 const string& className,
70 const string& namespaceName,
73 :
CParent(externalName, className, namespaceName, dataType, comments),
74 m_HaveAssignment(
false)
85 bool delayed,
bool in_union,
int tag,
86 bool noPrefix,
bool attlist,
bool noTag,
91 noPrefix,attlist,noTag,simple,dataType,
98 bool del,
bool in_un,
int tag,
99 bool noPrefx,
bool attlst,
100 bool noTg,
bool simpl,
103 : externalName(external_name), cName(
Identifier(name)),
104 type(
t), delayed(del), in_union(in_un), memberTag(
tag),
105 noPrefix(noPrefx), attlist(attlst), noTag(noTg), simple(simpl),
106 dataType(dataTp), comments(commnts)
108 switch (
type->GetKind() ) {
145 const CDataType* resolved =
i->dataType->Resolve();
146 if (resolved && resolved !=
i->dataType) {
163 const string& methodPrefix,
165 const string& classPrefix)
const
167 bool haveObjectPointer =
false;
168 bool havePointers =
false;
169 bool haveSimple =
false;
170 bool haveString =
false, haveUtf8String =
false;
171 bool delayed =
false;
172 bool haveAttlist =
false;
173 bool haveBuffer =
false;
177 codeClassName +=
"_Base";
181 switch (
i->memberType ) {
184 i->type->GeneratePointerTypeCode(
code);
190 haveObjectPointer =
true;
192 i->type->GeneratePointerTypeCode(
code);
196 i->type->GenerateTypeCode(
code);
200 i->type->GenerateTypeCode(
code);
207 i->type->GenerateTypeCode(
code);
213 haveUtf8String =
true;
214 i->type->GenerateTypeCode(
code);
215 utf8CType =
i->type->GetCType(
code.GetNamespace());
223 code.HPPIncludes().insert(
"serial/delaybuf");
225 bool haveUnion = havePointers || haveSimple || haveBuffer ||
226 ((haveString || haveUtf8String) && haveObjectPointer);
227 if ( (haveString || haveUtf8String) && haveUnion && !haveBuffer ) {
231 bool haveUnionData =
false;
235 haveUnionData =
true;
241 string stdNamespace =
243 string ncbiNamespace =
247 code.ClassPublic() <<
248 " /// Copy constructor.\n"
249 " "<<codeClassName<<
"(const "<<codeClassName<<
"& src);\n\n"
250 " /// Assignment operator\n"
251 " "<<codeClassName<<
"& operator=(const "<<codeClassName<<
"& src);\n\n\n";
253 code.ClassPrivate() <<
254 " // copy constructor and assignment operator\n"
255 " "<<codeClassName<<
"(const "<<codeClassName<<
"& );\n"
256 " "<<codeClassName<<
"& operator=(const "<<codeClassName<<
"& );\n";
262 size_t currlen, maxlen = cName.size() + 2;
265 maxlen =
max(maxlen,
i->cName.size());
268 code.ClassPublic() <<
269 "\n /// Choice variants.\n"
273 for (currlen = strlen(
STATE_NOT_SET)+2; currlen < maxlen; ++currlen) {
274 code.ClassPublic() <<
" ";
277 <<
" ///< No variant selected\n" ;
279 bool needIni =
false;
287 code.ClassPublic() <<
" = "<<currIndex;
292 code.ClassPublic() <<
",";
293 }
else if ( !comments.
Empty() ) {
294 code.ClassPublic() <<
" ";
296 if ( !comments.
Empty() ) {
297 code.ClassPublic() <<
string(maxlen-cName.size(),
' ');
301 code.ClassPublic() <<
"\n";
307 code.ClassPublic() <<
" };\n";
309 code.ClassPublic() <<
" /// Maximum+1 value of the choice variant enumerator.\n";
310 code.ClassPublic() <<
311 " enum E_ChoiceStopper {\n"
312 " e_MaxChoice = " << currIndex+1 <<
" ///< == " STATE_PREFIX
318 code.ClassPublic() <<
319 " /// Reset the whole object\n"
322 code.ClassPublic() <<
"virtual ";
323 code.ClassPublic() <<
"void Reset(void);\n\n";
325 code.ClassPublic() <<
329 code.ClassPublic() <<
"virtual ";
330 code.ClassPublic() <<
"void ResetSelection(void);\n\n";
333 code.ClassPublic() <<
334 " /// Which variant is currently selected.\n";
336 code.ClassPublic() <<
339 " /// Choice state enumerator.\n";
341 code.ClassPublic() <<
343 " /// Verify selection, throw exception if it differs from the expected.\n";
345 code.ClassPublic() <<
347 " /// @param index\n"
348 " /// Expected selection.\n";
350 code.ClassPublic() <<
351 " void CheckSelected(" STATE_ENUM " index) const;\n\n"
352 " /// Throw \'InvalidSelection\' exception.\n";
354 code.ClassPublic() <<
356 " /// @param index\n"
357 " /// Expected selection.\n";
359 code.ClassPublic() <<
360 " NCBI_NORETURN void ThrowInvalidSelection(" STATE_ENUM " index) const;\n\n"
361 " /// Retrieve selection name (for diagnostic purposes).\n";
363 code.ClassPublic() <<
365 " /// @param index\n"
366 " /// One of possible selection states.\n"
368 " /// Name string.\n";
370 code.ClassPublic() <<
371 " static "<<stdNamespace<<
"string SelectionName(" STATE_ENUM " index);\n"
374 " /// Select the requested variant if needed.\n";
378 " /// @param index\n"
379 " /// New selection state.\n"
380 " /// @param reset\n"
381 " /// Flag that defines the resetting of the variant data. The data will\n"
382 " /// be reset if either the current selection differs from the new one,\n"
383 " /// or the flag is set to eDoResetVariant.\n";
386 " void Select(" STATE_ENUM " index, "<<ncbiNamespace<<
"EResetVariant reset = "<<ncbiNamespace<<
"eDoResetVariant);\n";
388 " /// Select the requested variant if needed,\n"
389 " /// allocating CObject variants from memory pool.\n";
392 " "<<ncbiNamespace<<
"EResetVariant reset,\n"
393 " "<<ncbiNamespace<<
"CObjectMemoryPool* pool);\n";
396 " /// Select the requested variant using delay buffer (for internal use).\n";
400 " /// @param index\n"
401 " /// New selection state.\n";
404 " void SelectDelayBuffer(" STATE_ENUM " index);\n";
414 methodPrefix<<
STATE_ENUM " "<<methodPrefix<<
"Which(void) const\n"
420 "void "<<methodPrefix<<
"CheckSelected(" STATE_ENUM " index) const\n"
423 " ThrowInvalidSelection(index);\n"
427 "void "<<methodPrefix<<
"Select(" STATE_ENUM " index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)\n"
429 " if ( reset == NCBI_NS_NCBI::eDoResetVariant || " STATE_MEMBER " != index ) {\n"
431 " ResetSelection();\n"
432 " DoSelect(index, pool);\n"
437 "void "<<methodPrefix<<
"Select(" STATE_ENUM " index, NCBI_NS_NCBI::EResetVariant reset)\n"
439 " Select(index, reset, 0);\n"
445 "void "<<methodPrefix<<
"SelectDelayBuffer(" STATE_ENUM " index)\n"
448 " NCBI_THROW(ncbi::CSerialException,eIllegalCall, \"illegal call\");\n"
457 methodPrefix<<codeClassName<<
"(const "<<codeClassName<<
"& src)\n"
463 methodPrefix<<codeClassName<<
"& "<<methodPrefix<<
"operator=(const "<<codeClassName<<
"& src)\n"
465 " if ( this != &src ) {\n"
475 code.ClassPrivate() <<
478 " // helper methods\n"
479 " void DoSelect(" STATE_ENUM " index, "<<ncbiNamespace<<
"CObjectMemoryPool* pool = 0);\n";
481 code.ClassPrivate() <<
482 " void DoAssign(const "<<codeClassName<<
"& src);\n";
485 code.ClassPrivate() <<
495 string init(
"new C_");
504 code.AddDestructionCode(
"Reset();");
509 "void "<<methodPrefix<<
"Reset(void)\n"
513 methods <<
" Reset" <<
i->cName <<
"();\n";
517 <<
" ResetSelection();\n";
522 "void "<<methodPrefix<<
"ResetSelection(void)\n"
524 if ( haveObjectPointer || havePointers || haveString || haveUtf8String || haveBuffer ) {
542 i->type->GetDestructionCode(
"*m_"+
i->cName),
545 " delete m_"<<
i->cName<<
";\n"
552 i->type->GetDestructionCode(
"*m_"+
i->cName),
555 " m_"<<
i->cName<<
".Destruct();\n"
588 if ( haveUtf8String ) {
617 if ( haveObjectPointer ) {
646 "void "<<methodPrefix<<
"DoAssign(const "<<codeClassName<<
"& src)\n"
649 " switch ( index ) {\n";
651 switch (
i->memberType ) {
655 " m_"<<
i->cName<<
" = src.m_"<<
i->cName<<
";\n"
661 " m_"<<
i->cName<<
" = new T"<<
i->cName<<
"(*src.m_"<<
i->cName<<
");\n"
667 " m_"<<
i->cName<<
".Construct();\n"
668 " *m_"<<
i->cName<<
" = *src.m_"<<
i->cName<<
";\n"
712 if ( haveUtf8String ) {
741 if ( haveObjectPointer ) {
766 "void "<<methodPrefix<<
"DoSelect(" STATE_ENUM " index, NCBI_NS_NCBI::CObjectMemoryPool* ";
767 if ( haveUnion || haveObjectPointer ) {
776 if ( ( (haveUnion && haveUnionData) || haveObjectPointer) ) {
778 " switch ( index ) {\n";
783 switch (
i->memberType ) {
786 string init =
i->type->GetInitializer();
789 " m_"<<
i->cName<<
" = "<<
init<<
";\n"
802 " m_"<<
i->cName<<
".Construct();\n"
835 if ( haveUtf8String ) {
866 code.ClassPrivate() <<
867 " static const char* const sm_SelectionNames[];\n";
870 "const char* const "<<methodPrefix<<
"sm_SelectionNames[] = {\n"
874 " \""<<
i->externalName<<
"\"";
876 methods <<
" /* place holder */";
882 "NCBI_NS_STD::string "<<methodPrefix<<
"SelectionName(" STATE_ENUM " index)\n"
884 " return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));\n"
887 "void "<<methodPrefix<<
"ThrowInvalidSelection(" STATE_ENUM " index) const\n"
889 " throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO";
893 methods <<
", m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));\n"
900 code.ClassPublic() <<
903 string cType =
i->type->GetCType(
code.GetNamespace());
905 code.ClassPublic() <<
906 " typedef "<<cType<<
" T"<<
i->cName<<
";\n";
909 code.ClassPublic() <<
915 code.ClassPublic() <<
920 string cType =
i->type->GetCType(
code.GetNamespace());
921 string tType =
"T" +
i->cName;
922 string tTypeStorage = tType;
923 string cTypeStorage =
i->type->GetStorageType(
code.GetNamespace());
924 if (cTypeStorage != cType) {
925 tTypeStorage = cTypeStorage;
928 string rType =
i->type->GetPrefixedCType(
code.GetNamespace(),methodPrefix);
931 string rType = methodPrefix + tType;
941 <<
" // typedef "<< cType <<
" "<<tType<<
"\n";
943 code.ClassPublic() <<
"\n";
948 code.ClassPublic() <<
949 " /// Reset the attribute list.\n";
951 code.ClassPublic() <<
952 " void Reset"<<
i->cName<<
"(void);\n";
955 code.ClassPublic() <<
957 " /// Check if variant "<<
i->cName<<
" is selected.\n"
961 <<
" /// "<<
i->cName<<
" type is defined as \'typedef "<< cType <<
" "<<tType<<
"\'.\n";
963 code.ClassPublic() <<
965 " /// - true, if the variant is selected.\n"
966 " /// - false, otherwise.\n";
968 code.ClassPublic() <<
969 " bool Is"<<
i->cName<<
"(void) const;\n";
971 if (kind ==
eKindEnum || (
i->dataType &&
i->dataType->IsPrimitive())) {
973 code.ClassPublic() <<
975 " /// Get the variant data.\n"
978 " /// Copy of the variant data.\n";
980 code.ClassPublic() <<
981 " "<<tType<<
" Get"<<
i->cName<<
"(void) const;\n";
986 code.ClassPublic() <<
988 " /// Get the attribute list data.\n";
990 code.ClassPublic() <<
992 " /// Get the variant data.\n";
994 code.ClassPublic() <<
997 " /// Reference to the data.\n";
999 code.ClassPublic() <<
1000 " const "<<tType<<
"& Get"<<
i->cName<<
"(void) const;\n";
1007 " /// Select the variant.\n";
1010 " void Set"<<
i->cName<<
"(void);\n";
1016 " /// Set the attribute list data.\n"
1019 " /// Reference to the data.\n";
1023 " /// Select the variant.\n"
1026 " /// Reference to the variant data.\n";
1030 " "<<tType<<
"& Set"<<
i->cName<<
"(void);\n";
1032 if (
i->type->CanBeCopied() ) {
1037 " /// Set the attribute list data.\n"
1039 " /// @param value\n"
1040 " /// Reference to data.\n";
1043 " void Set"<<
i->cName<<
"("<<tType<<
"& value);\n";
1049 " /// Select the variant and set its data.\n"
1051 " /// @param value\n"
1052 " /// Variant data.\n";
1054 if (kind ==
eKindEnum || (
i->dataType &&
i->dataType->IsPrimitive())) {
1056 " void Set"<<
i->cName<<
"("<<tType<<
" value);\n";
1059 " void Set"<<
i->cName<<
"(const "<<tType<<
"& value);\n";
1069 " /// Set the attribute list data.\n";
1072 " /// Select the variant and set its data.\n";
1076 " /// @param value\n"
1077 " /// Reference to the data.\n";
1080 " void Set"<<
i->cName<<
"("<<tType<<
"& value);\n";
1083 string constMemberRef;
1085 switch (
i->memberType ) {
1087 memberRef = constMemberRef =
"m_"+
i->cName;
1088 if (tTypeStorage != tType) {
1089 constMemberRef =
"reinterpret_cast<const " + tType +
"&>(m_" +
i->cName +
")";
1090 memberRef =
"reinterpret_cast<" + tType +
"&>(m_" +
i->cName +
")";
1095 memberRef = constMemberRef =
"*m_"+
i->cName;
1101 memberRef =
'*'+memberRef;
1103 constMemberRef = memberRef;
1109 memberRef =
'*'+memberRef;
1111 constMemberRef = memberRef;
1115 constMemberRef =
"*static_cast<const T"+
i->cName+
"*>(" OBJECT_MEMBER ")";
1122 code.MethodStart(inl) <<
1123 "void "<<methodPrefix<<
"Reset"<<
i->cName<<
"(void)\n"
1125 " (*m_" <<
i->cName<<
").Reset();\n"
1128 if (
i->dataType &&
i->dataType->IsPrimitive()) {
1129 code.MethodStart(inl) << rType;
1131 code.MethodStart(inl) <<
"const "<<rType<<
"&";
1133 code.Methods(inl) <<
1134 " "<<methodPrefix<<
"Get"<<
i->cName<<
"(void) const\n"
1136 code.Methods(inl) <<
1137 " return (*m_"<<
i->cName<<
");\n"
1140 code.MethodStart(inl) <<
1141 rType<<
"& "<<methodPrefix<<
"Set"<<
i->cName<<
"(void)\n"
1143 code.Methods(inl) <<
1144 " return (*m_"<<
i->cName<<
");\n"
1147 code.MethodStart(inl) <<
1148 "void "<<methodPrefix<<
"Set"<<
i->cName<<
"("<<rType<<
"& value)\n"
1150 code.Methods(inl) <<
1151 " m_"<<
i->cName<<
".Reset(&value);\n"
1157 "bool "<<methodPrefix<<
"Is"<<
i->cName<<
"(void) const\n"
1162 if (kind ==
eKindEnum || (
i->dataType &&
i->dataType->IsPrimitive())) {
1163 code.MethodStart(inl) << rType;
1164 }
else if (!isNull) {
1165 code.MethodStart(inl) <<
"const "<<rType<<
"&";
1168 code.Methods(inl) <<
1169 " "<<methodPrefix<<
"Get"<<
i->cName<<
"(void) const\n"
1173 code.Methods(inl) <<
1176 code.Methods(inl) <<
1177 " return "<<constMemberRef<<
";\n"
1182 code.MethodStart(inl) <<
1183 "void "<<methodPrefix<<
"Set"<<
i->cName<<
"(void)\n";
1185 code.MethodStart(inl) <<
1186 rType<<
"& "<<methodPrefix<<
"Set"<<
i->cName<<
"(void)\n";
1188 code.Methods(inl) <<
1190 " Select(" STATE_PREFIX<<
i->cName<<
", NCBI_NS_NCBI::eDoNotResetVariant);\n";
1193 code.Methods(inl) <<
1196 if (isNullWithAtt) {
1197 code.Methods(inl) <<
1198 " "<<rType<<
"& value = "<<memberRef<<
";\n" <<
1199 " value.Set"<<extname<<
"();\n" <<
1202 code.Methods(inl) <<
1203 " return "<<memberRef<<
";\n";
1206 code.Methods(inl) <<
1209 if (
i->type->CanBeCopied() ) {
1210 bool set_inl = (kind ==
eKindEnum || (
i->dataType &&
i->dataType->IsPrimitive()));
1212 code.MethodStart(set_inl) <<
1213 "void "<<methodPrefix<<
"Set"<<
i->cName<<
"(";
1215 code.Methods(set_inl) << rType;
1217 code.Methods(set_inl) <<
"const " << rType <<
"&";
1219 code.Methods(set_inl) <<
" value)\n"
1221 " Select(" STATE_PREFIX<<
i->cName<<
", NCBI_NS_NCBI::eDoNotResetVariant);\n";
1223 code.Methods(set_inl) <<
1226 code.Methods(set_inl) <<
1227 " "<<memberRef<<
" = value;\n"
1234 "void "<<methodPrefix<<
"Set"<<
i->cName<<
"("<<rType<<
"& value)\n"
1236 " T"<<
i->cName<<
"* ptr = &value;\n";
1246 " ResetSelection();\n"
1253 const CDataType* resolved =
i->dataType->Resolve();
1254 if (resolved && resolved !=
i->dataType) {
1259 if (!ir->dataType || !ir->dataType->IsPrimitive()) {
1262 string ircType(ir->type->GetCType(
1263 code.GetNamespace()));
1267 " /// Select the variant and set its data.\n"
1269 " /// @param value\n"
1270 " /// Reference to variant data.\n";
1273 " void Set"<<
i->cName<<
"(const "<<
1274 ircType<<
"& value);\n";
1276 "void "<<methodPrefix<<
"Set"<<
1277 i->cName<<
"(const "<<ircType<<
1281 " Set" <<
i->cName <<
1299 code.ClassPrivate() <<
1304 code.ClassPrivate() <<
1305 " "<<ncbiNamespace<<
"CRef< T"<<
i->cName<<
" > m_"<<
i->cName<<
";\n";
1309 if ( haveUnion && haveUnionData) {
1310 code.ClassPrivate() <<
" union {\n";
1314 string tType =
"T" +
i->cName;
1315 string cTypeStorage =
i->type->GetStorageType(
code.GetNamespace());
1316 if (cTypeStorage !=
i->type->GetCType(
code.GetNamespace())) {
1317 tType = cTypeStorage;
1319 code.ClassPrivate() <<
1320 " "<<tType<<
" m_"<<
i->cName<<
";\n";
1324 code.ClassPrivate() <<
1325 " T"<<
i->cName<<
" *m_"<<
i->cName<<
";\n";
1328 code.ClassPrivate() <<
1329 " NCBI_NS_NCBI::CUnionBuffer<T"<<
i->cName<<
"> m_"<<
i->cName<<
";\n";
1334 code.ClassPrivate() <<
1338 code.ClassPrivate() <<
1342 if ( haveUtf8String ) {
1344 code.ClassPrivate() <<
1345 " NCBI_NS_NCBI::CUnionBuffer<" <<
1350 code.ClassPrivate() <<
1356 if ( haveObjectPointer ) {
1357 code.ClassPrivate() <<
1360 if ( haveBuffer && !havePointers && !haveObjectPointer ) {
1363 code.ClassPrivate() <<
1364 " void* m_dummy_pointer_for_alignment;\n";
1366 code.ClassPrivate() <<
1369 else if ( haveString || haveUtf8String ) {
1371 code.ClassPrivate() <<
1374 if (haveUtf8String) {
1375 code.ClassPrivate() <<
1381 else if ( haveObjectPointer ) {
1382 code.ClassPrivate() <<
1386 code.ClassPrivate() <<
1393 "// helper methods\n"
1396 if ( haveUserClass )
1397 methods <<
"BEGIN_NAMED_BASE_CHOICE_INFO";
1399 methods <<
"BEGIN_NAMED_CHOICE_INFO";
1408 " SET_INTERNAL_NAME(\""<<
names.m_OwnerName<<
"\", ";
1409 if ( !
names.m_MemberName.empty() )
1410 methods <<
"\""<<
names.m_MemberName<<
"\"";
1415 if ( !module_name.empty() ) {
1417 " SET_CHOICE_MODULE(\""<<module_name<<
"\");\n";
1421 if (dataType->
HasTag()) {
1423 " SET_ASN_TAGGED_TYPE_INFO(" <<
"SetTag, (" << dataType->
GetTag() <<
',' <<
1428 " SET_ASN_TAGGED_TYPE_INFO(" <<
"SetTagType, (" <<
1447 methods <<
"->SetNsQualified(";
1459 " SET_CHOICE_DELAYED();\n";
1463 methods <<
" ADD_NAMED_";
1469 bool addNamespace =
false;
1470 bool addCType =
false;
1471 bool addEnum =
false;
1472 bool addRef =
false;
1474 switch (
i->memberType ) {
1491 if ( !
i->type->GetNamespace().IsEmpty() &&
1492 code.GetNamespace() !=
i->type->GetNamespace() ) {
1493 _TRACE(
"EnumNamespace: "<<
i->type->GetNamespace()<<
" from "<<
code.GetNamespace());
1495 addNamespace =
true;
1498 else if (
i->type->HaveSpecialRef() ) {
1516 else if (
i->type->HaveSpecialRef() ) {
1526 methods <<
"MEMBER(\"";
1528 methods <<
"CHOICE_VARIANT(\"";
1530 methods <<
i->externalName<<
"\"";
1534 switch (
i->memberType ) {
1537 methods <<
"m_" <<
i->cName;
1550 methods <<
"m_"<<
i->cName;
1555 methods <<
", "<<
i->type->GetNamespace();
1557 methods <<
", "<<
i->type->GetCType(
code.GetNamespace());
1559 methods <<
", "<<
i->type->GetEnumName();
1561 methods <<
", "<<
i->type->GetRef(
code.GetNamespace());
1565 methods <<
"->SetDelayBuffer(MEMBER_PTR(m_delayBuffer))";
1567 if (
i->dataType &&
i->dataType->GetDataMember() &&
i->dataType->GetDataMember()->Optional()) {
1568 methods <<
"->SetOptional()";
1572 methods <<
"->SetNoPrefix()";
1576 methods <<
"->SetAttlist()";
1579 methods <<
"->SetNotag()";
1581 if (
i->memberTag >= 0 ) {
1582 methods <<
"->GetId().SetTag(" <<
i->memberTag;
1596 if (!octets && uniseq) {
1601 methods <<
"->SetCompressed()";
1605 methods <<
"->SetNonEmpty()";
1609 if (memNsqMode != defNsqMode) {
1610 methods <<
"->SetNsQualified(";
1617 }
else if (defNsqMode ==
eNSUnqualified &&
i->dataType->IsReference()) {
1618 methods <<
"->SetNsQualified(true)";
1623 const list<CMemberFacet>& con =
i->dataType->GetDataMember()->GetRestrictions();
1635 methods <<
"->RestrictV<decltype(" <<
"m_"<<
i->cName <<
")>(";
1638 methods <<
"->Restrict(";
1642 methods <<
"\"" << c.GetValue() <<
"\"";
1644 methods << c.GetValue();
1663 const string& fileName,
1665 :
CParent(className, ns, fileName, comments)
#define UTF8_STRING_MEMBER
CChoiceRefTypeStrings(const string &className, const CNamespace &ns, const string &fileName, const CComments &comments)
CChoiceTypeStrings(const string &externalName, const string &className, const string &namespaceName, const CDataType *dataType, const CComments &comments)
virtual void GenerateClassCode(CClassCode &code, CNcbiOstream &getters, const string &methodPrefix, bool haveUserClass, const string &classPrefix) const override
~CChoiceTypeStrings(void)
list< SVariantInfo > TVariants
void AddVariant(const string &external_name, const string &name, const AutoPtr< CTypeStrings > &type, bool delayed, bool in_union, int tag, bool noPrefix, bool attlist, bool noTag, bool simple, const CDataType *dataType, const CComments &commnts)
bool HaveAssignment(void) const
bool x_IsNullType(TVariants::const_iterator i) const
bool x_IsNullWithAttlist(TVariants::const_iterator i, string &name) const
static bool GetDoxygenComments(void)
const string & GetExternalName(void) const
bool x_IsNullType(TMembers::const_iterator i) const
list< SMemberInfo > TMembers
bool HaveUserClass(void) const
const string & GetClassNameDT(void) const
static string GetSourceDataSpecString(void)
const CDataMember * GetDataMember(void) const
CAsnBinaryDefs::ETagClass GetTagClass(void) const
CClassTypeStrings * GetTypeStr(void) const
static string GetTagClassString(CAsnBinaryDefs::ETagClass tclass)
CAsnBinaryDefs::ETagType GetTagType(void) const
static string GetTagTypeString(CAsnBinaryDefs::ETagType ttype)
ENsQualifiedMode IsNsQualified(void) const
CAsnBinaryDefs::TLongTag GetTag(void) const
static const CNamespace KNCBINamespace
static const CNamespace KSTDNamespace
virtual bool IsCompressed(void) const
EType GetStringType(void) const
const CTypeStrings * GetArg1Type(void) const
const CDataType * DataType(void) const
virtual string GetCType(const CNamespace &ns) const =0
static const char * GetFacetString(ESerialFacet c)
const string & GetNamespaceName(void) const
virtual const CNamespace & GetNamespace(void) const
const string & GetModuleName(void) const
bool IsNonEmpty(void) const
CDataType * GetElementType(void)
CNcbiOstream & WriteTabbed(CNcbiOstream &out, const CNcbiOstrstream &code, const char *tab)
static const struct name_t names[]
static void DLIST_NAME() init(DLIST_LIST_TYPE *list)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
ENsQualifiedMode
Defines namespace qualification of XML tags.
const TMemberIndex kEmptyChoice
Special value for marking empty choice.
size_t TMemberIndex
Type used for indexing class members and choice variants.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition of all error codes used in serial libraries (xser.lib, xcser.lib).
constexpr bool empty(list< Ts... >) noexcept
Useful/utility classes and methods.
string Identifier(const string &typeName, bool capitalize)
SVariantInfo(const string &external_name, const string &name, const AutoPtr< CTypeStrings > &type, bool delayed, bool in_union, int tag, bool noPrefx, bool attlst, bool noTg, bool simpl, const CDataType *dataTp, const CComments &commnts)
const CDataType * dataType