& className,
55 const string& namespaceName,
58:
CParent(namespaceName,dataType,comments),
59m_IsObject(
true), m_HaveUserClass(
true), m_HaveTypeInfo(
true),
60m_ExternalName(externalName), m_ClassName(className)
81 if(
i->ref &&
i->dataType) {
82 const CDataType* resolved =
i->dataType->Resolve();
83 if(resolved && resolved !=
i->dataType) {
109 return i->dataType &&
i->dataType->IsUniSeq();
115 const string& pointerType,
118 booldelayed,
int tag,
119 boolnoPrefix,
boolattlist,
boolnoTag,
121 boolnonempty,
const CComments& comments)
126delayed,
tag, noPrefix,attlist,noTag,
127simple,dataType,nonempty, comments));
133 const string& pType,
134 boolopt,
const string& defValue,
135 booldel,
int tag,
boolnoPrefx,
136 boolattlst,
boolnoTg,
boolsimpl,
139: externalName(external_name), cName(
Identifier(name)),
140mName(
"m_"+cName), tName(
'T'+cName),
141 type(
t), ptrType(pType),
142optional(opt), delayed(del), memberTag(
tag),
143 defaultValue(defValue), noPrefix(noPrefx), attlist(attlst), noTag(noTg),
144simple(simpl),dataType(dataTp),nonEmpty(nEmpty), comments(commnts)
146 if(
cName.empty() ) {
153haveDefault =
false;
155 if( haveDefault &&
type) {
177 else if(
ptrType==
"false") {
207 const string& methodPrefix)
const 223 returnvar+
".Reset();\n";
228 const string& fileName)
240 " "<<className<<
"(void);\n";
252 return out<<
'~'<<className<<
"(void);\n" 261codeClassName +=
"_Base";
271 stringmethodPrefix =
code.GetMethodPrefix();
276 stringncbiNamespace =
280 code.ClassPublic() <<
282 " DECLARE_INTERNAL_TYPE_INFO();\n" 289methodPrefix, haveUserClass,
ctx.GetMethodPrefix());
293 "// constructor\n"<<
294methodPrefix<<codeClassName<<
"(void)\n";
295 if(
code.HaveInitializers() ) {
298 code.WriteInitializers(
code.Methods());
299 code.Methods() <<
'\n';
304 code.WriteConstructionCode(
code.Methods());
311methodPrefix<<
"~"<<codeClassName<<
"(void)\n" 313 code.WriteDestructionCode(
code.Methods());
321 const string& methodPrefix,
323 const string& classPrefix)
const 325 booldelayed =
false;
326 boolgenerateDoNotDeleteThisObject =
false;
329 boolthisNullWithAtt;
334 i->type->GeneratePointerTypeCode(
code);
337 i->type->GenerateTypeCode(
code);
339generateDoNotDeleteThisObject =
true;
344TMembers::const_iterator j=
m_Members.begin();
350TMembers::const_iterator
i=
m_Members.begin();
352 const CDataType* t2 =
i->dataType->GetParentType();
359generateDoNotDeleteThisObject =
false;
361 code.HPPIncludes().insert(
"serial/delaybuf");
365 code.ClassPublic() <<
369 if(!ce_defined &&
i->dataType) {
382 code.ClassPublic() <<
383 " typedef "<< name <<
" "<<
"C_E;\n";
390 if(resolved && resolved != reftype) {
395 code.ClassPublic() <<
396 " typedef "<< name <<
" "<<
"C_E;\n";
406 stringcType =
i->type->GetCType(
code.GetNamespace());
408 code.ClassPublic() <<
409 " typedef "<<cType<<
" "<<
i->tName<<
";\n";
410 if(
i->dataType &&
i->dataType->IsTypeAlias() &&
i->dataType->IsXMLDataSpec()) {
412 stringdt(
i->dataType->ClassName());
414 code.ClassPublic() <<
415 " typedef "<<cType<<
" "<<dt<<
";\n";
420 code.ClassPublic() <<
427 code.ClassPublic() <<
428 " // member index\n";
429 code.ClassPublic() <<
430 " enum class E_memberIndex {\n"<<
431 " e__allMandatory = 0";
434 code.ClassPublic() <<
",\n e_";
435 if(!
i->externalName.empty()) {
438 code.ClassPublic() << ind;
442 code.ClassPublic() <<
444 " typedef Tparent::CMemberIndex<E_memberIndex, "<< ind <<
"> TmemberIndex;\n"<<
448 stringncbiNamespace =
455 if( wrapperClass ) {
458 stringcType =
info.type->GetCType(
code.GetNamespace());
459 stringtname =
info.tName;
460 code.ClassPublic() <<
461 " /// Constructor from the primitive type\n" 462 " "<<
code.GetClassNameDT()<<
"(const "<<tname<<
"& value);\n" 463 " /// Assignment operator.\n" 464 " void operator=(const "<<tname<<
"& value);\n" 468methodPrefix<<
code.GetClassNameDT()<<
"(const "<<
info.tName<<
"& value)\n" 474 "void "<<methodPrefix<<
"operator=(const "<<
info.tName<<
"& value)\n" 485 code.ClassPublic() <<
489 size_tmember_index = (size_t)-1;
492 Uint4set_mask, set_mask_maybe;
493 boolisNull, isNullWithAtt, as_ref, mem_simple;
494 stringextname, mem_cName;
498set_index = (2*member_index)/(8*
sizeof(
Uint4));
499set_offset = (2*member_index)%(8*
sizeof(
Uint4));
500set_mask = (0x03 << set_offset);
501set_mask_maybe = (0x01 << set_offset);
510mem_cName = mem_simple ?
kEmptyStr:
i->cName;
515 i->comments.PrintHPPMember(
code.ClassPublic());
517 code.ClassPublic() <<
518 " /// Check if a value has been assigned to "<<
i->cName<<
" data member.\n" 520 " /// Data member "<<
i->cName<<
" is ";
522 code.ClassPublic() <<
527 if(
i->defaultValue.empty()) {
528 code.ClassPublic() <<
"optional";
530 code.ClassPublic() <<
"optional with default " 534 if(
i->defaultValue.empty()) {
535 code.ClassPublic() <<
"mandatory";
537 code.ClassPublic() <<
"mandatory with default " 545<<
";\n /// its type is defined as \'typedef " 546<<
i->type->GetCType(
code.GetNamespace())
547<<
" "<<
i->tName<<
"\'\n";
551<<
i->type->GetCType(
code.GetNamespace())
552<<
" "<<
i->tName<<
"\n";
555 code.ClassPublic() <<
"\n";
558 code.ClassPublic() <<
560 " /// - true, if a value has been assigned.\n" 561 " /// - false, otherwise.\n";
563 code.ClassPublic() <<
564 " /// Check whether the "<<
i->cName<<
" data member has been assigned a value.\n";
567 code.ClassPublic() <<
568 " NCBI_DEPRECATED bool IsSet"<<
i->cName<<
"(void) const {return IsSet();}\n";
570 code.ClassPublic() <<
571 " bool IsSet"<< mem_cName<<
"(void) const;\n";
574 if(!
i->haveFlag && as_ref && isNullWithAtt) {
576 "bool "<<methodPrefix<<
"IsSet"<<mem_cName<<
"(void) const\n{\n"<<
577 " return "<<
i->mName<<
" ? "<<
i->mName<<
"->IsSet"<<extname<<
"() : false;\n}\n\n";
581 "bool "<<methodPrefix<<
"IsSet"<<mem_cName<<
"(void) const\n" 583 if(
i->haveFlag ) {
586 " return ((" SET_PREFIX "["<<set_index<<
"] & 0x"<<
587 hex<<set_mask<<dec<<
") != 0);\n";
598 " return "<<
i->mName<<
".NotEmpty();\n";
603 " return "<<
i->type->GetIsSetCode(
i->mName)<<
";\n";
613 if(isNull || isNullWithAtt) {
614 code.ClassPublic() <<
616 " /// Check if value of "<<
i->cName<<
" member is getatable.\n" 619 " /// - false; the data member of type \'NULL\' has no value.\n";
621 code.ClassPublic() <<
623 " /// Check if it is safe to call Get"<<
i->cName<<
" method.\n" 626 " /// - true, if the data member is getatable.\n" 627 " /// - false, otherwise.\n";
630 code.ClassPublic() <<
631 " /// Check whether it is safe or not to call Get"<<
i->cName<<
" method.\n";
634 code.ClassPublic() <<
635 " NCBI_DEPRECATED bool CanGet"<<
i->cName<<
"(void) const {return CanGet();}\n";
637 code.ClassPublic() <<
638 " bool CanGet"<< mem_cName<<
"(void) const;\n";
641 "bool "<<methodPrefix<<
"CanGet"<<mem_cName<<
"(void) const\n" 643 if(!
i->defaultValue.empty() ||
645(as_ref && !
i->canBeNull)) {
646inlineMethods <<
" return true;\n";
648 if(isNull || isNullWithAtt) {
649inlineMethods <<
" return false;\n";
651inlineMethods <<
" return IsSet"<<mem_cName<<
"();\n";
661 stringdestructionCode =
i->type->GetDestructionCode(
i->valueName);
664 if( assignValue.empty() && !as_ref ) {
665resetCode =
i->type->GetResetCode(
i->valueName);
666 if( resetCode.empty() )
667assignValue =
i->type->GetInitializer();
672 " /// Reset "<<
i->cName<<
" data member.\n";
675 code.ClassPublic() <<
676 " NCBI_DEPRECATED void Reset"<<
i->cName<<
"(void) {Reset();}\n";
679 " void Reset"<<mem_cName<<
"(void);\n";
681 boolinl = !as_ref && resetCode.empty();
682 code.MethodStart(inl) <<
683 "void "<<methodPrefix<<
"Reset"<<mem_cName<<
"(void)\n" 686 code.Methods(inl) <<
690 if( (as_ref && !
i->canBeNull) ) {
691 if( assignValue.empty() )
692assignValue =
i->type->GetInitializer();
693 code.Methods(inl) <<
694 " if ( !"<<
i->mName<<
" ) {\n" 695 " "<<
i->mName<<
".Reset(new "<<
i->tName<<
"("<<assignValue<<
"));\n" 700 if( !
i->optional && !
i->canBeNull) {
702resetCode =
i->type->GetResetCode(
i->valueName);
703 if( !resetCode.empty() ) {
708 code.Methods(inl) <<
709 " "<<
i->valueName<<
" = "<<
i->type->GetInitializer()<<
";\n";
712 else if( assignValue.empty() ) {
714 code.Methods(inl) <<
715 " "<<
i->mName<<
".Reset();\n";
718 if( assignValue.empty() )
719assignValue =
i->type->GetInitializer();
721 code.Methods(inl) <<
722 " "<<
i->mName<<
".Reset(new "<<
i->tName<<
"("<<assignValue<<
"));\n";
726 if( !assignValue.empty() ) {
729 code.Methods(inl) <<
730 " "<<
i->mName<<
" = "<<assignValue<<
";\n";
738 if(
i->haveFlag ) {
739 code.Methods(inl) <<
740 " " SET_PREFIX "["<<set_index<<
"] &= ~0x"<<
hex<<set_mask<<dec<<
";\n";
742 code.Methods(inl) <<
747 if(!
i->defaultValue.empty() &&
i->type->GetKind() !=
eKindContainer) {\
751 " /// Assign default value to "<<
i->cName<<
" data member.\n";
755 " NCBI_DEPRECTED void SetDefault"<<
i->cName<<
"(void) {SetDefault();}\n";
758 " void SetDefault"<<mem_cName<<
"(void);\n";
759 code.MethodStart(inl) <<
760 "void "<<methodPrefix<<
"SetDefault"<<mem_cName<<
"(void)\n" 762 " Reset"<<
i->cName<<
"();\n";
764 code.Methods(inl) <<
765 " " SET_PREFIX "["<<set_index<<
"] |= 0x"<<
hex<<set_mask_maybe<<dec<<
";\n";
767 code.Methods(inl) <<
772 stringcType =
i->type->GetCType(
code.GetNamespace());
774 stringvalueRef(
i->valueName);
775 stringconstValueRef(
i->valueName);
776 stringcTypeStorage =
i->type->GetStorageType(
code.GetNamespace());
777 if(cTypeStorage != cType) {
778constValueRef =
"reinterpret_cast<const "+
i->tName +
"&>("+
i->valueName +
")";
779valueRef =
"reinterpret_cast<"+
i->tName +
"&>("+
i->valueName +
")";
782 stringrType =
i->type->GetPrefixedCType(
code.GetNamespace(),methodPrefix);
785 stringrType = methodPrefix +
i->tName;
788 boolstring_utf8 =
false;
799 if(kind ==
eKindEnum|| (
i->dataType &&
i->dataType->IsPrimitive() && !
i->simple)) {
801 code.ClassPublic() <<
803 " /// Get the "<<
i->cName<<
" member data.\n" 806 " /// Copy of the member data.\n";
809 code.ClassPublic() <<
810 " NCBI_DEPRECATED "<<
i->tName<<
" Get"<<
i->cName<<
"(void) const {return Get();}\n";
812 code.ClassPublic() <<
813 " "<<
i->tName<<
" Get"<<mem_cName<<
"(void) const;\n";
814 code.MethodStart(inl) <<
815 ""<<rType<<
" "<<methodPrefix<<
"Get"<<mem_cName<<
"(void) const\n" 819 code.ClassPublic() <<
821 " /// Get the "<<
i->cName<<
" member data.\n" 824 " /// Reference to the member data.\n";
827 code.ClassPublic() <<
828 " NCBI_DEPRECATED const "<<
i->tName<<
"& Get"<<
i->cName<<
"(void) const {return Get();}\n";
830 code.ClassPublic() <<
831 " const "<<
i->tName<<
"& Get"<<mem_cName<<
"(void) const;\n";
832 code.MethodStart(inl) <<
833 "const "<<rType<<
"& "<<methodPrefix<<
"Get"<<mem_cName<<
"(void) const\n" 837 code.Methods(inl) <<
840 if( (as_ref && !
i->canBeNull) ) {
841 code.Methods(inl) <<
842 " if ( !"<<
i->mName<<
" ) {\n" 843 " const_cast<"<<
code.GetClassNameDT()<<
"*>(this)->Reset"<<mem_cName<<
"();\n" 846 else if(
i->defaultValue.empty() &&
849 code.Methods(inl) <<
850 " if (!CanGet"<< mem_cName<<
"()) {\n" 851 " ThrowUnassigned("<<member_index;
853 code.Methods(inl) <<
", __FILE__, __LINE__";
855 code.Methods(inl) <<
");\n" 858 code.Methods(inl) <<
859 " return "<<constValueRef<<
";\n" 870 " /// Assign a value to "<<
i->cName<<
" data member.\n" 872 " /// @param value\n" 873 " /// Reference to value.\n";
877 " NCBI_DEPRECATED void Set"<<
i->cName<<
"("<<
i->tName<<
"& value) {Set(value);}\n";
880 " void Set"<<mem_cName<<
"("<<
i->tName<<
"& value);\n";
882 "void "<<methodPrefix<<
"Set"<<mem_cName<<
"("<<rType<<
"& value)\n" 889 " "<<
i->mName<<
".Reset(&value);\n";
890 if(
i->attlist && thisNullWithAtt) {
891TMembers::const_iterator j =
i;
892methods <<
" Set"<< (++j)->cName <<
"();\n";
894 if(
i->haveFlag ) {
896 " " SET_PREFIX "["<<set_index<<
"] |= 0x"<<
hex<<set_mask<<dec<<
";\n";
904 " /// Assign a value to "<<
i->cName<<
" data member.\n" 907 " /// Reference to the data value.\n";
911 " NCBI_DEPRECATED "<<
i->tName<<
"& Set"<<
i->cName<<
"(void) {return Set();}\n";
914 " "<<
i->tName<<
"& Set"<<mem_cName<<
"(void);\n";
915 if(
i->canBeNull ) {
919rType<<
"& "<<methodPrefix<<
"Set"<<mem_cName<<
"(void)\n" 926 " if ( !"<<
i->mName<<
" )\n" 927 " "<<
i->mName<<
".Reset(new "<<
i->tName<<
"("<<assignValue<<
"));\n";
930 " "<<
i->mName<<
"->Set"<<extname<<
"();\n";
933 " return "<<
i->valueName<<
";\n" 940rType<<
"& "<<methodPrefix<<
"Set"<<mem_cName<<
"(void)\n" 943 " if ( !"<<
i->mName<<
" ) {\n" 944 " Reset"<<
i->cName<<
"();\n" 947 " "<<
i->mName<<
"->Set"<<extname<<
"();\n";
949 " return "<<
i->valueName<<
";\n" 956rType<<
"& "<<methodPrefix<<
"Set"<<mem_cName<<
"(void)\n" 962 if( (as_ref && !
i->canBeNull) ) {
964 " if ( !"<<
i->mName<<
" ) {\n" 965 " Reset"<<mem_cName<<
"();\n" 968 if(
i->attlist && thisNullWithAtt) {
969TMembers::const_iterator j =
i;
970inlineMethods <<
" Set"<< (++j)->cName <<
"();\n";
974 " " SET_PREFIX "["<<set_index<<
"] |= 0x"<<
hex<<set_mask<<dec<<
";\n";
977 " return "<<
i->valueName<<
";\n" 982 if(
i->dataType && !isNullWithAtt) {
983 const CDataType* resolved =
i->dataType->Resolve();
984 if(resolved && resolved !=
i->dataType) {
988 if(ir->simple && ir->type->CanBeCopied()) {
989 stringircType(ir->type->GetCType(
990 code.GetNamespace()));
994 " /// Assign a value to "<<
i->cName<<
" data member.\n" 996 " /// @param value\n" 997 " /// Reference to value.\n";
1001 " void Set"<<
i->cName<<
"(const "<<ircType<<
"& value) {Set(value);}\n";
1004 " void Set"<<mem_cName<<
"(const "<<
1005ircType<<
"& value);\n";
1007 "void "<<methodPrefix<<
"Set"<<
1008mem_cName<<
"(const "<<ircType<<
1012 " Set"<< mem_cName <<
1027 " /// Set NULL data member (assign \'NULL\' value to "<<
i->cName<<
" data member).\n";
1031 " NCBI_DEPRECATED void Set"<<
i->cName<<
"(void) {Set();}\n";
1034 " void Set"<<mem_cName<<
"(void);\n";
1037 "void "<<methodPrefix<<
"Set"<<mem_cName<<
"(void)\n" 1040 " " SET_PREFIX "["<<set_index<<
"] |= 0x"<<
hex<<set_mask<<dec<<
";\n";
1045 if(
i->type->CanBeCopied() ) {
1049 " /// Assign a value to "<<
i->cName<<
" data member.\n" 1051 " /// @param value\n" 1052 " /// Value to assign\n";
1054 if(kind ==
eKindEnum|| (
i->dataType &&
i->dataType->IsPrimitive())) {
1057 " NCBI_DEPRECATED void Set"<<
i->cName<<
"("<<
i->tName<<
" value) {Set(value);}\n";
1060 " void Set"<<mem_cName<<
"("<<
i->tName<<
" value);\n";
1063 "void "<<methodPrefix<<
"Set"<<mem_cName<<
"("<<rType<<
" value)\n" 1068 " NCBI_DEPRECATED void Set"<<
i->cName<<
"(const "<<
i->tName<<
"& value) {Set(value);}\n";
1071 " void Set"<<mem_cName<<
"(const "<<
i->tName<<
"& value);\n";
1074 "void "<<methodPrefix<<
"Set"<<mem_cName<<
"(const "<<rType<<
"& value)\n" 1077 if(
i->delayed ) {
1082 " "<<valueRef<<
" = value;\n";
1083 if(
i->haveFlag ) {
1085 " " SET_PREFIX "["<<set_index<<
"] |= 0x"<<
hex<<set_mask<<dec<<
";\n";
1092 " void Set"<<mem_cName<<
"("<<
i->tName<<
"&& value);\n";
1095 "void "<<methodPrefix<<
"Set"<<mem_cName<<
"("<<rType<<
"&& value)\n" 1098 " "<<valueRef<<
" = std::forward<"<<rType<<
">(value);\n";
1099 if(
i->haveFlag ) {
1101 " " SET_PREFIX "["<<set_index<<
"] |= 0x"<<
hex<<set_mask<<dec<<
";\n";
1111 " /// Assign a value to "<<
i->cName<<
" data member.\n" 1114 " /// Reference to the data value.\n";
1118 " NCBI_DEPRECATED "<<
i->tName<<
"& Set"<<
i->cName<<
"(void) {return Set();}\n";
1121 " "<<
i->tName<<
"& Set"<<mem_cName<<
"(void);\n";
1124rType<<
"& "<<methodPrefix<<
"Set"<<mem_cName<<
"(void)\n" 1126 if(
i->delayed ) {
1130 if(
i->haveFlag ) {
1135 " if (!IsSet"<<mem_cName<<
"()) {\n" 1140 i->valueName <<
" = UnassignedStringUTF8();\n";
1143 i->valueName <<
" = UnassignedString();\n";
1147 "memset(&"<<
i->valueName<<
",UnassignedByte(),sizeof("<<
i->valueName<<
"));\n";
1155 " " SET_PREFIX "["<<set_index<<
"] |= 0x"<<
hex<<set_mask_maybe<<dec<<
";\n";
1158 " return "<<valueRef<<
";\n" 1167 if(
i->cName.empty() && !isNull ) {
1168 if(
i->optional ) {
1169 stringloc(
code.GetClassNameDT());
1170 if(
i->dataType) {
1171loc =
i->dataType->LocationString();
1175loc +
": the only member of adaptor class is optional");
1178 code.ClassPublic() <<
"\n" 1179 " /// Conversion operator to \'const "<<
i->tName<<
"\' type.\n" 1180 " operator const "<<
i->tName<<
"& (void) const;\n" 1181 " /// Conversion operator to \'"<<
i->tName<<
"\' type.\n" 1182 " operator "<<
i->tName<<
"& (void);\n";
1185methodPrefix<<
"operator const "<<rType<<
"& (void) const\n" 1187 if(
i->delayed ) {
1191inlineMethods <<
" return ";
1193inlineMethods <<
"*";
1200methodPrefix<<
"operator "<<rType<<
"& (void)\n" 1202 if(
i->delayed ) {
1206 if(
i->haveFlag ) {
1211 " if (!IsSet"<<
i->cName<<
"()) {\n" 1216 i->valueName <<
" = UnassignedStringUTF8();\n";
1219 i->valueName <<
" = UnassignedString();\n";
1223 "memset(&"<<
i->valueName<<
",UnassignedByte(),sizeof("<<
i->valueName<<
"));\n";
1231 " " SET_PREFIX "["<<set_index<<
"] |= 0x"<<
hex<<set_mask_maybe<<dec<<
";\n";
1233inlineMethods <<
" return ";
1235inlineMethods <<
"*";
1249 code.ClassPrivate() <<
1250 " // Prohibit copy constructor and assignment operator\n"<<
1251 " "<<
code.GetClassNameDT() <<
1252 "(const "<<
code.GetClassNameDT() <<
"&);\n"<<
1253 " "<<
code.GetClassNameDT() <<
"& operator=(const "<<
1254 code.GetClassNameDT() <<
"&);\n"<<
1256 code.ClassPrivate() <<
1260 code.ClassPrivate() <<
1267 if(
i->delayed ) {
1268 code.ClassPrivate() <<
1269 " mutable NCBI_NS_NCBI::CDelayBuffer " DELAY_PREFIX<<
i->cName<<
";\n";
1276 code.ClassPrivate() <<
1277 " "<<ncbiNamespace<<
"CRef< "<<
i->tName<<
" > "<<
i->mName<<
";\n";
1282 stringtTypeStorage(
i->tName);
1283 stringcTypeStorage =
i->type->GetStorageType(
code.GetNamespace());
1284 if(cTypeStorage !=
i->tName) {
1285tTypeStorage = cTypeStorage;
1287 code.ClassPrivate() <<
1288 " "<<tTypeStorage<<
" "<<
i->mName<<
";\n";
1297 boolhas_non_null_refs =
false;
1301 if( (as_ref && !
i->canBeNull) ) {
1302has_non_null_refs =
true;
1306 if(
init.empty() )
1307 init=
i->type->GetInitializer();
1308 if( !
init.empty() )
1309 code.AddInitializer(
i->mName,
init);
1312 code.AddConstructionCode
1314 if( has_non_null_refs ) {
1315 code.AddConstructionCode(
"if ( !IsAllocatedInPool() ) {\n");
1318 if( (as_ref && !
i->canBeNull) ) {
1319 code.AddConstructionCode(
" Reset"+
i->cName+
"();\n");
1322 code.AddConstructionCode(
"}\n");
1327 if( !wrapperClass ) {
1328 code.ClassPublic() <<
1329 " /// Reset the whole object\n" 1332 code.ClassPublic() <<
"virtual ";
1333 code.ClassPublic() <<
1334 "void Reset(void);\n";
1336 "void "<<methodPrefix<<
"Reset(void)\n" 1340 " Reset"<<
i->cName<<
"();\n";
1346 code.ClassPublic() <<
"\n";
1348 if( generateDoNotDeleteThisObject ) {
1349 code.ClassPublic() <<
1350 " virtual void DoNotDeleteThisObject(void);\n" 1353 "void "<<methodPrefix<<
"DoNotDeleteThisObject(void)\n" 1355 " "<<
code.GetParentClassName()<<
"::DoNotDeleteThisObject();\n";
1359 " "<<
i->mName<<
".DoNotDeleteThisObject();\n";
1369 for( TMembers::const_reverse_iterator
i=
m_Members.rbegin();
1371 code.AddDestructionCode(
i->type->GetDestructionCode(
i->valueName));
1376methods <<
"BEGIN_NAMED_";
1377 if( haveUserClass )
1378methods <<
"BASE_";
1380methods <<
"IMPLICIT_";
1389 " SET_INTERNAL_NAME(\""<<
names.m_OwnerName<<
"\", ";
1390 if( !
names.m_MemberName.empty() )
1391methods <<
"\""<<
names.m_MemberName<<
"\"";
1396 if( !module_name.empty() ) {
1398 " SET_CLASS_MODULE(\""<<module_name<<
"\");\n";
1402 if(dataType->
HasTag()) {
1404 " SET_ASN_TAGGED_TYPE_INFO("<<
"SetTag, ("<< dataType->
GetTag() <<
','<<
1409 " SET_ASN_TAGGED_TYPE_INFO("<<
"SetTagType, ("<<
1422methods <<
"->SetNsQualified(";
1426methods <<
"false";
1439methods <<
" ADD_NAMED_";
1442methods <<
"NULL_";
1445 booladdNamespace =
false;
1446 booladdCType =
false;
1447 booladdEnum =
false;
1448 booladdRef =
false;
1450 boolref =
i->ref
;
1456 switch(
i->type->GetKind() ) {
1459 if(
i->type->HaveSpecialRef() ) {
1467methods <<
"ENUM_";
1469 if( !
i->type->GetNamespace().IsEmpty() &&
1470 code.GetNamespace() !=
i->type->GetNamespace()) {
1471 _TRACE(
"EnumNamespace: "<<
i->type->GetNamespace()<<
" from "<<
code.GetNamespace());
1473addNamespace =
true;
1482methods <<
"MEMBER(\""<<
i->externalName<<
"\"";
1484methods <<
", "<<
i->mName;
1487methods <<
", "<<
i->type->GetNamespace();
1489methods <<
", "<<
i->type->GetCType(
code.GetNamespace());
1491methods <<
", "<<
i->type->GetEnumName();
1493methods <<
", "<<
i->type->GetRef(
code.GetNamespace());
1496 if( !
i->defaultValue.empty() ) {
1498 stringdefTName(
i->tName);
1499 stringdefset(
"->SetDefault(");
1505defset =
"->SetElementDefault(";
1513defTName +=
"::Tdata";
1521methods <<
"new NCBI_NS_NCBI::CRef< "+defTName+
" >(";
1522methods <<
"new "<<defTName<<
"("<<
i->defaultValue<<
')';
1527 if(
i->haveFlag) {
1529 "->SetSetFlag(MEMBER_PTR(" SET_PREFIX "[0]))";
1531 if(
i->delayed ) {
1536 if(
i->optional ) {
1537methods <<
"->SetOptional()";
1539 if((
i->dataType &&
i->dataType->GetDataMember() &&
i->dataType->GetDataMember()->Nillable()) ||
1541methods <<
"->SetNillable()";
1544 if(
i->noPrefix) {
1545methods <<
"->SetNoPrefix()";
1549methods <<
"->SetAttlist()";
1552methods <<
"->SetNotag()";
1555methods <<
"->SetAnyContent()";
1557 if(
i->memberTag >= 0 ) {
1558methods <<
"->GetId().SetTag("<<
i->memberTag;
1559 if(
i->dataType &&
1567 if(
i->dataType) {
1572 if(!octets && uniseq) {
1577methods <<
"->SetCompressed()";
1582 if(memNsqMode != defNsqMode) {
1583methods <<
"->SetNsQualified(";
1587methods <<
"false";
1590}
else if(defNsqMode ==
eNSUnqualified&&
i->dataType->IsReference()) {
1591methods <<
"->SetNsQualified(true)";
1595 if(
i->nonEmpty) {
1596methods <<
"->SetNonEmpty()";
1599list<CMemberFacet> con;
1600 if(
i->dataType &&
i->dataType->GetDataMember()) {
1601con =
i->dataType->GetDataMember()->GetRestrictions();
1602}
else if(wrapperClass) {
1616methods <<
"->RestrictV<decltype("<<
i->mName <<
")>(";
1619methods <<
"->Restrict(";
1623methods <<
"\""<< c.GetValue() <<
"\"";
1625methods << c.GetValue();
1635methods <<
" info->SetRandomOrder(true);\n";
1639methods <<
" info->RandomOrder();\n";
1654<<
"/** @addtogroup ";
1665 boolwrapperClass = (
m_Members.size() == 1) &&
1667 boolgenerateCopy = wrapperClass &&
m_Members.front().type->CanBeCopied()
1671 "/////////////////////////////////////////////////////////////////////////////\n";
1697 if( generateCopy ) {
1700 stringtname =
info.tName;
1701 out<<
" // typedef "<< cType <<
" "<<
info.tName <<
";\n\n";
1703 " /// Constructor from the primitive type.\n" 1705 " /// Assignment operator\n" 1706 " "<<
GetClassNameDT()<<
"& operator=(const "<<tname<<
"& value);\n\n";
1711 stringtname =
i->tName;
1712 out<<
" // typedef "<< cType <<
" "<<
i->tName <<
";\n\n";
1714 " /// Conversion operator to \'"<< tname <<
"\' type.\n" 1715 " operator const "<< tname <<
"&(void) const;\n";
1717 " /// Assignment operator.\n" 1719tname <<
"& value);\n\n";
1723 out<<
"private:\n"<<
1724 " // Prohibit copy constructor and assignment operator\n" 1732 out<<
"/* @} */\n";
1736 "/////////////////// "<<
GetClassNameDT()<<
" inline methods\n" 1751 " Set"<<
i->cName <<
"(value);\n"<<
1756 if( generateCopy ) {
1759 "// data copy constructors\n" 1766 "// data assignment operators\n" 1781 " return Get"<<
i->cName <<
"();\n"<<
1787 i->tName <<
"& value)\n"<<
1789 " Set"<<
i->cName <<
"(value);\n"<<
1790 " return *this;\n"<<
1798 "/////////////////// end of "<<
GetClassNameDT()<<
" inline methods\n" 1806 "// destructor\n"<<
1815 const string& fileName,
1820m_FileName(fileName)
1838 while(dt !=
nullptr) {
1871 const string&
)
const 1878 return "CLASS, ("+
GetCType(ns)+
')';
1883 returnvar+
".Reset();\n";
static const string & GetExportSpecifier(void)
static const string & GetDoxygenGroup(void)
static bool GetDoxygenComments(void)
string GetClassName(void) const
virtual string GetResetCode(const string &var) const override
virtual string GetRef(const CNamespace &ns) const override
virtual void GeneratePointerTypeCode(CClassContext &ctx) const override
virtual EKind GetKind(void) const override
virtual string GetPrefixedCType(const CNamespace &ns, const string &methodPrefix) const override
virtual string GetCType(const CNamespace &ns) const override
virtual const CNamespace & GetNamespace(void) const override
virtual void GenerateTypeCode(CClassContext &ctx) const override
CClassRefTypeStrings(const string &className, const CNamespace &ns, const string &fileName, const CComments &comments)
const string & GetExternalName(void) const
bool x_IsNullType(TMembers::const_iterator i) const
virtual void GenerateUserCPPCode(CNcbiOstream &out) const override
virtual string GetCType(const CNamespace &ns) const override
string m_ParentClassFileName
virtual string GetResetCode(const string &var) const override
void SetParentClass(const string &className, const CNamespace &ns, const string &fileName)
virtual void GenerateClassCode(CClassCode &code, CNcbiOstream &getters, const string &methodPrefix, bool haveUserClass, const string &classPrefix) const
bool x_IsUniSeq(TMembers::const_iterator i) const
CClassTypeStrings(const string &externalName, const string &className, const string &namespaceName, const CDataType *dataType, const CComments &comments)
virtual void GenerateTypeCode(CClassContext &ctx) const override
bool x_IsNullWithAttlist(TMembers::const_iterator i, string &name) const
list< SMemberInfo > TMembers
bool HaveUserClass(void) const
virtual string GetRef(const CNamespace &ns) const override
bool x_IsAnyContentType(TMembers::const_iterator i) const
bool HaveTypeInfo(void) const
virtual EKind GetKind(void) const override
virtual string GetPrefixedCType(const CNamespace &ns, const string &methodPrefix) const override
CNamespace m_ParentClassNamespace
virtual void GenerateUserHPPCode(CNcbiOstream &out) const override
void AddMember(const string &external_name, const string &name, const AutoPtr< CTypeStrings > &type, const string &pointerType, bool optional, const string &defaultValue, bool delayed, int tag, bool noPrefix, bool attlist, bool noTag, bool simple, const CDataType *dataType, bool nonEmpty, const CComments &comments)
const string & GetClassNameDT(void) const
bool Nillable(void) const
static string GetSourceDataSpecString(void)
const list< CMemberFacet > & GetRestrictions(void) const
const CDataMember * GetDataMember(void) const
CAsnBinaryDefs::ETagClass GetTagClass(void) const
CClassTypeStrings * GetTypeStr(void) const
string ClassName(void) const
static string GetTagClassString(CAsnBinaryDefs::ETagClass tclass)
const CDataType * GetParentType(void) const
CAsnBinaryDefs::ETagType GetTagType(void) const
static string GetTagTypeString(CAsnBinaryDefs::ETagType ttype)
ENsQualifiedMode IsNsQualified(void) const
bool IsNillable(void) const
CAsnBinaryDefs::TLongTag GetTag(void) const
static bool IsASNDataSpec(void)
bool IsUniSeq(void) const
const string & GetMemberName(void) const
string GetNamespaceRef(const CNamespace &ns) const
static const CNamespace KNCBINamespace
virtual bool IsCompressed(void) const
const CTypeStrings * GetDataTypeStr(void) const
bool IsRefToParent(void) const
virtual const CDataType * Resolve(void) const override
EType GetStringType(void) const
const CTypeStrings * GetArg1Type(void) const
const CDataType * DataType(void) const
virtual string GetCType(const CNamespace &ns) const =0
void BeginClassDeclaration(CClassContext &ctx) const
string GetDoxygenModuleName(void) const
static const char * GetFacetString(ESerialFacet c)
const string & GetNamespaceName(void) const
virtual const CNamespace & GetNamespace(void) const
virtual EKind GetKind(void) const =0
const string & GetModuleName(void) const
CDataType * GetElementType(void)
static CNcbiOstream & DeclareDestructor(CNcbiOstream &out, const string className, bool virt)
static CNcbiOstream & DeclareConstructor(CNcbiOstream &out, const string className)
std::ofstream out("events_result.xml")
main entry point for tests
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 NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
ENsQualifiedMode
Defines namespace qualification of XML tags.
uint32_t Uint4
4-byte (32-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
static void hex(unsigned char c)
constexpr bool empty(list< Ts... >) noexcept
const GenericPointer< typename T::ValueType > T2 defaultValue
string Identifier(const string &typeName, bool capitalize)
const CDataType * dataType
SMemberInfo(const string &external_name, const string &name, const AutoPtr< CTypeStrings > &type, const string &pointerType, bool optional, const string &defaultValue, bool delayed, int tag, bool noPrefx, bool attlst, bool noTg, bool simpl, const CDataType *dataTp, bool nEmpty, const CComments &comments)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4