📄 generate.cpp
字号:
return; } if ( m_ExcludeRecursion ) return; const CUniSequenceDataType* array = dynamic_cast<const CUniSequenceDataType*>(type); if ( array != 0 ) { // we should add element type CollectTypes(array->GetElementType(), eElement); return; } const CReferenceDataType* user = dynamic_cast<const CReferenceDataType*>(type); if ( user != 0 ) { // reference to another type const CDataType* resolved; try { resolved = user->Resolve(); } catch ( CNotFoundException& exc) { ERR_POST(Warning << "Skipping type: " << user->GetUserTypeName() << ": " << exc.what()); return; } if ( resolved->Skipped() ) { ERR_POST(Warning << "Skipping type: " << user->GetUserTypeName()); return; } if ( !Imported(resolved) ) { CollectTypes(resolved, eReference); } return; } const CDataMemberContainerType* cont = dynamic_cast<const CDataMemberContainerType*>(type); if ( cont != 0 ) { // collect member's types ITERATE ( CDataMemberContainerType::TMembers, mi, cont->GetMembers() ) { const CDataType* memberType = mi->get()->GetType(); CollectTypes(memberType, eMember); } return; }}#if 0void CCodeGenerator::CollectTypes(const CDataType* type, EContext context){ const CUniSequenceDataType* array = dynamic_cast<const CUniSequenceDataType*>(type); if ( array != 0 ) { // SET OF or SEQUENCE OF if ( type->GetParentType() == 0 || context == eChoice ) { if ( !AddType(type) ) return; } if ( m_ExcludeRecursion ) return; // we should add element type CollectTypes(array->GetElementType(), eElement); return; } const CReferenceDataType* user = dynamic_cast<const CReferenceDataType*>(type); if ( user != 0 ) { // reference to another type const CDataType* resolved; try { resolved = user->Resolve(); } catch ( CNotFoundException& exc) { ERR_POST(Warning << "Skipping type: " << user->GetUserTypeName() << ": " << exc.what()); return; } if ( resolved->Skipped() ) { ERR_POST(Warning << "Skipping type: " << user->GetUserTypeName()); return; } if ( context == eChoice ) { // in choice if ( resolved->InheritFromType() != user->GetParentType() || dynamic_cast<const CEnumDataType*>(resolved) != 0 ) { // add intermediate class AddType(user); } } else if ( type->GetParentType() == 0 ) { // alias declaration // generate empty class AddType(user); } if ( !Imported(resolved) ) { CollectTypes(resolved, eReference); } return; } if ( dynamic_cast<const CStaticDataType*>(type) != 0 ) { // STD type if ( type->GetParentType() == 0 || context == eChoice ) { AddType(type); } return; } if ( dynamic_cast<const CEnumDataType*>(type) != 0 ) { // ENUMERATED type if ( type->GetParentType() == 0 || context == eChoice ) { AddType(type); } return; } if ( type->GetParentType() == 0 || context == eChoice ) { if ( type->Skipped() ) { ERR_POST(Warning << "Skipping type: " << type->IdName()); return; } } const CChoiceDataType* choice = dynamic_cast<const CChoiceDataType*>(type); if ( choice != 0 ) { if ( !AddType(type) ) return; if ( m_ExcludeRecursion ) return; // collect member's types ITERATE ( CDataMemberContainerType::TMembers, mi, choice->GetMembers() ) { const CDataType* memberType = mi->get()->GetType(); CollectTypes(memberType, eMember); // eChoice } } const CDataMemberContainerType* cont = dynamic_cast<const CDataMemberContainerType*>(type); if ( cont != 0 ) { if ( !AddType(type) ) return; if ( m_ExcludeRecursion ) return; // collect member's types ITERATE ( CDataMemberContainerType::TMembers, mi, cont->GetMembers() ) { const CDataType* memberType = mi->get()->GetType(); CollectTypes(memberType, eMember); } return; } if ( !AddType(type) ) return;}#endifEND_NCBI_SCOPE/** ===========================================================================** $Log: generate.cpp,v $* Revision 1000.1 2004/06/01 19:43:12 gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.59** Revision 1.59 2004/05/19 15:46:19 gouriano* Add precompiled header into combining files as well** Revision 1.58 2004/05/17 21:03:14 gorelenk* Added include of PCH ncbi_pch.hpp** Revision 1.57 2004/05/13 15:49:49 ucko* When generating doxygen headers, list them in .cvsignore.** Revision 1.56 2004/05/03 19:31:03 gouriano* Made generation of DOXYGEN-style comments optional** Revision 1.55 2004/04/30 02:05:05 ucko* Make ingroup_name a full-fledged string rather than a reference,* since it may be initialized by a temporary and should never be big* enough for copying to be an issue.** Revision 1.54 2004/04/29 20:11:39 gouriano* Generate DOXYGEN-style comments in C++ headers** Revision 1.53 2003/06/16 19:03:03 ucko* Explicitly turn on ios::out when opening ignoreFile; needed with GCC 2.9x.** Revision 1.52 2003/05/29 17:25:34 gouriano* added possibility of generation .cvsignore file** Revision 1.51 2003/04/18 20:40:17 ucko* Oops, s/iterate/ITERATE/ in my latest change.** Revision 1.50 2003/04/08 20:40:08 ucko* Get client name(s) from [-]clients rather than hardcoding "client"** Revision 1.49 2003/03/11 20:06:47 kuznets* iterate -> ITERATE** Revision 1.48 2003/03/10 18:55:18 gouriano* use new structured exceptions (based on CException)** Revision 1.47 2003/02/24 21:57:46 gouriano* added odw flag - to issue a warning about missing DEF file** Revision 1.46 2002/12/17 19:03:26 gouriano* corrected ResolveFileName for external definitions** Revision 1.45 2002/12/17 16:22:47 gouriano* separated class name from the name of the file in which it will be written** Revision 1.44 2002/11/13 00:46:07 ucko* Add RPC client generator; CVS logs to end in generate.?pp** Revision 1.43 2002/10/22 15:06:13 gouriano* added possibillity to use quoted syntax form for generated include files** Revision 1.42 2002/10/01 17:04:31 gouriano* corrections to eliminate redundant info in the generation report** Revision 1.41 2002/10/01 14:20:30 gouriano* added more generation report data** Revision 1.40 2002/09/30 19:16:10 gouriano* changed location of "*.files" and "combining" files to CPP dir** Revision 1.39 2001/12/07 18:56:51 grichenk* Paths in "#include"-s made system-independent** Revision 1.38 2001/12/03 14:50:27 juran* Eliminate "return value expected" warning.** Revision 1.37 2001/10/22 15:18:19 grichenk* Fixed combined HPP generation.** Revision 1.36 2001/10/18 20:10:34 grichenk* Save combining header on -oc** Revision 1.35 2001/08/31 20:05:46 ucko* Fix ICC build.** Revision 1.34 2000/11/27 18:19:48 vasilche* Datatool now conforms CNcbiApplication requirements.** Revision 1.33 2000/08/25 15:59:22 vasilche* Renamed directory tool -> datatool.** Revision 1.32 2000/06/16 16:31:39 vasilche* Changed implementation of choices and classes info to allow use of the same classes in generated and user written classes.** Revision 1.31 2000/05/24 20:57:14 vasilche* Use new macro _DEBUG_ARG to avoid warning about unused argument.** Revision 1.30 2000/05/24 20:09:28 vasilche* Implemented DTD generation.** Revision 1.29 2000/04/10 19:33:22 vakatov* Get rid of a minor compiler warning** Revision 1.28 2000/04/07 19:26:27 vasilche* Added namespace support to datatool.* By default with argument -oR datatool will generate objects in namespace* NCBI_NS_NCBI::objects (aka ncbi::objects).* Datatool's classes also moved to NCBI namespace.** Revision 1.27 2000/03/07 14:06:32 vasilche* Added generation of reference counted objects.** Revision 1.26 2000/02/01 21:48:00 vasilche* Added CGeneratedChoiceTypeInfo for generated choice classes.* Removed CMemberInfo subclasses.* Added support for DEFAULT/OPTIONAL members.* Changed class generation.* Moved datatool headers to include/internal/serial/tool.** Revision 1.25 2000/01/06 16:13:18 vasilche* Fail of file generation now fatal.** Revision 1.24 1999/12/28 18:55:57 vasilche* Reduced size of compiled object files:* 1. avoid inline or implicit virtual methods (especially destructors).* 2. avoid std::string's methods usage in inline methods.* 3. avoid string literals ("xxx") in inline methods.** Revision 1.23 1999/12/21 17:18:34 vasilche* Added CDelayedFostream class which rewrites file only if contents is changed.** Revision 1.22 1999/12/20 21:00:18 vasilche* Added generation of sources in different directories.** Revision 1.21 1999/12/17 19:05:19 vasilche* Simplified generation of GetTypeInfo methods.** Revision 1.20 1999/12/09 20:01:23 vasilche* Fixed bug with missed internal classes.** Revision 1.19 1999/12/03 21:42:12 vasilche* Fixed conflict of enums in choices.** Revision 1.18 1999/12/01 17:36:25 vasilche* Fixed CHOICE processing.** Revision 1.17 1999/11/15 19:36:15 vasilche* Fixed warnings on GCC** ===========================================================================*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -