& className,
54m_ExternalName(externalName),
55m_ClassName(className),
94 const string&
)
const 107 return "CLASS, ("+
GetCType(ns)+
')';
123 const string& place)
const 175 stringmethodPrefix =
code.GetMethodPrefix();
180 boolis_class =
false;
181 boolis_ref_to_alias =
false;
183 boolmem_isnull =
false;
192 stringname(ref_name);
208 if(resolved && resolved != reftype) {
210 boolhas_attlist =
false;
211 if(typeStr && typeStr->
m_Members.size() == 2) {
212 for(
const auto& ir: typeStr->
m_Members) {
221mem_alias =
nullptr;
224mem_isnull =
dynamic_cast<const CNullDataType*
>(resolved) !=
nullptr;
231 code.SetParentClass(
"CStdAliasBase< "+ ref_name +
" >",
235 code.SetParentClass(
"CStringAliasBase< "+ ref_name +
" >",
239 code.SetParentClass(
"CStringAliasBase< "+ ref_name +
" >",
246 "Invalid aliased type: "+ ref_name);
256 code.SetEmptyClassCode();
261 stringparentNamespaceRef =
262 code.GetNamespace().GetNamespaceRef(
code.GetParentClassNamespace());
265 code.ClassPublic() <<
266 " "<< className <<
"(void);\n"<<
268 code.MethodStart(
true) <<
269methodPrefix << className <<
"(void)\n"<<
275 if(is_ref_to_alias) {
276 code.ClassPublic() <<
278 " DECLARE_STD_ALIAS_TYPE_INFO();\n" 281 code.ClassPublic() <<
283 " DECLARE_INTERNAL_TYPE_INFO();\n" 291 code.ClassPublic() <<
292 " // parent type getter/setter\n"<<
293 " const "<< ref_name <<
"& Get(void) const;\n"<<
294 " "<< ref_name <<
"& Set(void);\n";
295 code.MethodStart(
true) <<
296 "const "<< ref_name <<
"& "<< methodPrefix <<
"Get(void) const\n"<<
298 " return *this;\n"<<
300 code.MethodStart(
true) <<
301ref_name <<
"& "<< methodPrefix <<
"Set(void)\n"<<
303 " return *this;\n"<<
307 if(type_alias && mem_alias) {
314 stringmem_extname(mem_alias->
cName);
315 code.ClassPublic() <<
"\n";
317 code.ClassPublic() <<
" typedef " 318<<
"Tparent::"<< mem_alias->
tName<<
" T"<< extname <<
";\n";
320 code.ClassPublic() <<
321 " bool IsSet"<< extname <<
"(void) const {\n"<<
322 " return Tparent::IsSet"<< mem_extname <<
"();\n"<<
324 code.ClassPublic() <<
325 " bool CanGet"<< extname <<
"(void) const {\n"<<
326 " return Tparent::CanGet"<< mem_extname <<
"();\n"<<
328 code.ClassPublic() <<
329 " void Reset"<< extname <<
"(void) {\n"<<
330 " Tparent::Reset"<< mem_extname <<
"();\n"<<
333 code.ClassPublic() <<
" "<<
334 "void"<<
" Set"<< extname <<
"(void) {\n"<<
335 " Tparent::Set"<< mem_extname <<
"();\n"<<
338 code.ClassPublic() <<
" const "<<
339 "T"<< extname <<
"& Get"<< extname <<
"(void) const {\n"<<
340 " return Tparent::Get"<< mem_extname <<
"();\n"<<
342 code.ClassPublic() <<
" "<<
343 "T"<< extname <<
"& Set"<< extname <<
"(void) {\n"<<
344 " return Tparent::Set"<< mem_extname <<
"();\n"<<
348 code.ClassPublic() <<
" "<<
349 "void"<<
" Set"<< extname <<
"(const T"<< extname <<
"& value) {\n"<<
350 " Tparent::Set"<< mem_extname <<
"(value);\n"<<
353 code.ClassPublic() <<
" "<<
354className <<
"(const"<<
" T"<< extname <<
"& value) : Tparent(value) {\n }\n";
355 code.ClassPublic() <<
" "<<
356className <<
"& operator=(const"<<
" T"<< extname <<
"& value) {\n"<<
357 " Tparent::operator=(value);\n"<<
358 " return *this;\n"<<
366 code.ClassPublic() <<
368 " DECLARE_STD_ALIAS_TYPE_INFO();\n" 370 stringconstr_decl = className +
"(const "+ ref_name +
"& data)";
371 code.ClassPublic() <<
372 " // explicit constructor from the primitive type\n"<<
373 " explicit "<< constr_decl <<
";\n";
374 code.MethodStart(
true) <<
375methodPrefix << constr_decl <<
"\n"<<
376 " : "<< parentNamespaceRef <<
code.GetParentClassName() <<
"(data)\n"<<
384 code.MethodStart(
true) <<
385 "NCBI_NS_NCBI::CNcbiOstream& operator<<\n"<<
386 "(NCBI_NS_NCBI::CNcbiOstream& str, const "<< (
m_Nested? classFullName : className) <<
"& obj)\n"<<
389 code.Methods(
true) <<
390 " if (NCBI_NS_NCBI::MSerial_Flags::HasSerialFormatting(str)) {\n"<<
391 " return WriteObject(str,&obj,obj.GetTypeInfo());\n"<<
393 " str << obj.Get();\n"<<
396 code.Methods(
true) <<
397 " return WriteObject(str,&obj,obj.GetTypeInfo());\n";
399 code.Methods(
true) <<
"}\n\n";
400 code.MethodStart(
true) <<
401 "NCBI_NS_NCBI::CNcbiIstream& operator>>\n"<<
402 "(NCBI_NS_NCBI::CNcbiIstream& str, "<< (
m_Nested? classFullName : className) <<
"& obj)\n"<<
405 code.Methods(
true) <<
406 " if (NCBI_NS_NCBI::MSerial_Flags::HasSerialFormatting(str)) {\n"<<
407 " return ReadObject(str,&obj,obj.GetTypeInfo());\n"<<
411 code.Methods(
true) <<
412 " std::underlying_type<"<< ref_name <<
">::type v;\n"<<
414 " obj.Set(("<< ref_name <<
")v);\n";
418 code.Methods(
true) <<
419 " str >> obj.Set();\n";
421 code.Methods(
true) <<
424 code.Methods(
true) <<
425 " return ReadObject(str,&obj,obj.GetTypeInfo());\n";
427 code.Methods(
true) <<
"}\n\n";
436methods <<
"_NESTED";
441methods <<
"_ALIAS_INFO(\"" 443<< classFullName <<
", " 452 if(dataType->
HasTag()) {
454 " SET_ASN_TAGGED_TYPE_INFO("<<
"SetTag, ("<< dataType->
GetTag() <<
','<<
459 " SET_ASN_TAGGED_TYPE_INFO("<<
"SetTagType, ("<<
471 "_ALIAS_DATA_PTR;\n";
472 if(mem_alias || type_alias || this->
IsFullAlias()) {
474 " SET_FULL_ALIAS;\n";
494<<
"/** @addtogroup ";
506 "/////////////////////////////////////////////////////////////////////////////\n";
510 "/// "<< className <<
" --\n" 524 boolis_class =
false;
526 boolmem_isnull =
false;
535 if(resolved && resolved != reftype) {
537 boolhas_attlist =
false;
540 for(
const auto& ir: typeStr->
m_Members) {
549mem_alias =
nullptr;
553mem_alias =
nullptr;
556mem_isnull =
dynamic_cast<const CNullDataType*
>(resolved) !=
nullptr;
560 if(mem_class && mem_class->
m_Members.size() == 1) {
561mem_alias = &(mem_class->
m_Members.front());
575 " /// Explicit constructor from the primitive type.\n"<<
576 " explicit "<< className +
"(const "+ ref_name +
"& value)"<<
"\n" 577 " : Tparent(value) {}\n\n";
579 else if(mem_alias) {
583 stringtname =
"Tparent::"+ mem_alias->
tName;
584 out<<
" // typedef "<< mem_alias->
type->
GetCType(ns) <<
" "<< mem_alias->
tName<<
";\n\n";
586 stringmem_extname(mem_alias->
cName);
588 " /// Constructor from the primitive type.\n"<<
589 " "<< className <<
"(const "<< tname <<
"& value) {\n"<<
590 " Set"<< mem_extname <<
"(value);\n"<<
593 " /// Assignment operator\n"<<
594 " "<< className <<
"& operator=(const "<< tname <<
"& value) {\n"<<
595 " Set"<< mem_extname <<
"(value);\n"<<
596 " return *this;\n"<<
600 " /// Conversion operator\n"<<
601 " operator const "<< tname <<
"& (void) {\n"<<
602 " return Get"<< mem_extname <<
"();\n"<<
604 " operator "<< tname <<
"& (void) {\n"<<
605 " return Set"<< mem_extname <<
"();\n"<<
611 out<<
"/* @} */\n";
646 const string& fileName,
650m_ClassName(className),
652m_FileName(fileName),
653m_RefType(&ref_type),
654m_IsObject(m_RefType->GetKind() == eKindObject)
686 const string&
)
const 698 return "CLASS, ("+
GetCType(ns)+
')';
733var +
".Reset();\n":
virtual void GeneratePointerTypeCode(CClassContext &ctx) const override
virtual string GetPrefixedCType(const CNamespace &ns, const string &methodPrefix) const override
virtual bool CanBeCopied(void) const override
AutoPtr< CTypeStrings > m_RefType
virtual void GenerateTypeCode(CClassContext &ctx) const override
virtual string GetResetCode(const string &var) const override
virtual EKind GetKind(void) const override
virtual void GenerateUserHPPCode(CNcbiOstream &out) const override
virtual string GetIsSetCode(const string &var) const override
virtual bool HaveSpecialRef(void) const override
virtual string GetRef(const CNamespace &ns) const override
virtual void GenerateCode(CClassContext &ctx) const override
virtual const CNamespace & GetNamespace(void) const override
virtual string GetDestructionCode(const string &expr) const override
CAliasRefTypeStrings(const string &className, const CNamespace &ns, const string &fileName, CTypeStrings &ref_type, const CComments &comments)
virtual string GetCType(const CNamespace &ns) const override
virtual string GetInitializer(void) const override
virtual void GenerateUserCPPCode(CNcbiOstream &out) const override
virtual bool CanBeKey(void) const override
virtual string GetDefaultCode(const string &var) const override
virtual string GetInitializer(void) const override
virtual string GetCType(const CNamespace &ns) const override
virtual void GenerateUserCPPCode(CNcbiOstream &out) const override
virtual bool CanBeCopied(void) const override
virtual bool CanBeKey(void) const override
bool IsFullAlias(void) const
virtual string GetPrefixedCType(const CNamespace &ns, const string &methodPrefix) const override
virtual void GeneratePointerTypeCode(CClassContext &ctx) const override
CAliasTypeStrings(const string &externalName, const string &className, CTypeStrings &ref_type, const CComments &comments)
virtual EKind GetKind(void) const override
string GetClassName(void) const
virtual string GetDestructionCode(const string &expr) const override
virtual void GenerateUserHPPCode(CNcbiOstream &out) const override
string GetExternalName(void) const
virtual string NewInstance(const string &init, const string &place) const override
virtual string GetDefaultCode(const string &var) const override
virtual void GenerateCode(CClassContext &ctx) const override
virtual string GetIsSetCode(const string &var) const override
AutoPtr< CTypeStrings > m_RefType
virtual string GetResetCode(const string &var) const override
virtual bool HaveSpecialRef(void) const override
virtual string GetRef(const CNamespace &ns) const override
virtual void GenerateTypeCode(CClassContext &ctx) const override
static const string & GetExportSpecifier(void)
static const string & GetDoxygenGroup(void)
static bool GetDoxygenComments(void)
string GetClassName(void) const
static string GetSourceDataSpecString(void)
CAsnBinaryDefs::ETagClass GetTagClass(void) const
virtual AutoPtr< CTypeStrings > GenerateCode(void) const
CClassTypeStrings * GetTypeStr(void) const
static string GetTagClassString(CAsnBinaryDefs::ETagClass tclass)
CAsnBinaryDefs::ETagType GetTagType(void) const
bool IsReference(void) const
static string GetTagTypeString(CAsnBinaryDefs::ETagType ttype)
bool IsStdType(void) const
CAsnBinaryDefs::TLongTag GetTag(void) const
static bool IsASNDataSpec(void)
bool IsTypeAlias(void) const
string GetNamespaceRef(const CNamespace &ns) const
static const CNamespace KNCBINamespace
virtual const CDataType * Resolve(void) const override
const string & GetUserTypeName(void) const
virtual bool CanBeKey(void) const
const CDataType * DataType(void) const
virtual string GetCType(const CNamespace &ns) const =0
void BeginClassDeclaration(CClassContext &ctx) const
virtual string GetIsSetCode(const string &var) const
string GetDoxygenModuleName(void) const
virtual string GetInitializer(void) const
virtual void GeneratePointerTypeCode(CClassContext &ctx) const
virtual string NewInstance(const string &init, const string &place=kEmptyStr) const
virtual string GetDestructionCode(const string &expr) const
virtual bool HaveSpecialRef(void) const
virtual void GenerateTypeCode(CClassContext &ctx) const
virtual string GetRef(const CNamespace &ns) const
virtual bool CanBeCopied(void) const
virtual const CNamespace & GetNamespace(void) const
virtual string GetResetCode(const string &var) const
virtual void GenerateCode(CClassContext &ctx) const
virtual const string & GetEnumName(void) const
virtual void GenerateUserCPPCode(CNcbiOstream &out) const
virtual EKind GetKind(void) const =0
virtual void GenerateUserHPPCode(CNcbiOstream &out) const
const string & GetModuleName(void) const
std::ofstream out("events_result.xml")
main entry point for tests
static void DLIST_NAME() init(DLIST_LIST_TYPE *list)
element_type * get(void) const
Get pointer.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
#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 CTempString TrimSuffix_Unsafe(const CTempString str, const CTempString suffix, ECase use_case=eCase)
Trim suffix from a string.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static void TrimPrefixInPlace(string &str, const CTempString prefix, ECase use_case=eCase)
Trim prefix from a string (in-place)
constexpr bool empty(list< Ts... >) noexcept
Useful/utility classes and methods.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
const CDataType * dataType
AutoPtr< CTypeStrings > type
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