& name)
const 135 boolignoreAbsense,
boolwarningAbsense)
139 if( fileName ==
"stdin"|| fileName ==
"-") {
145 if( ignoreAbsense ) {
147}
else if(warningAbsense) {
168 m_Config.
Set(line.substr(bra + 1, ket - bra - 1),
169line.substr(ket + 1,
eq- ket - 1),
170line.substr(
eq+ 1));
177 stringloc(
"CCodeGenerator::ExternalResolve: failed");
195 stringloc(
"CCodeGenerator::ResolveInAnyModule: failed");
216fullName.substr(dot + 1),
229 return i->second->GetFileBaseName();
241 const string& name = ti->first;
243 if( !name.empty() && !
type->Skipped() ) {
286 bool operator()(
const string& s1,
const string& s2)
const 300 if( fileList.is_open() ) {
336 for( fname =
code->GetFileBaseName();
338fname =
code->ChangeFileBaseName();
340 names.insert(fname);
353 stringoutdir_cpp, outdir_hpp;
354list<string> listGenerated, listUntouched;
355list<string> allGeneratedHpp, allGeneratedCpp, allSkippedHpp, allSkippedCpp;
359 code->GetModuleNames( module_names);
361 code->GenerateCode();
364allGeneratedHpp.push_back(fileName);
365 if(outdir_hpp.empty()) {
367outdir_hpp = entry.
GetDir();
370allGeneratedCpp.push_back(fileName);
371 if(outdir_cpp.empty()) {
373outdir_cpp = entry.
GetDir();
376listGenerated.push_back( fileName);
377allGeneratedHpp.push_back(fileName);
379listUntouched.push_back( fileName);
380allSkippedHpp.push_back(fileName);
383listGenerated.push_back( fileName);
384allGeneratedCpp.push_back(fileName);
386listUntouched.push_back( fileName);
387allSkippedCpp.push_back(fileName);
390list<string> module_inc, module_src;
397listGenerated.insert(listGenerated.end(), module_inc.begin(), module_inc.end());
398allGeneratedHpp.insert(allGeneratedHpp.end(), module_inc.begin(), module_inc.end());
399listGenerated.insert(listGenerated.end(), module_src.begin(), module_src.end());
400allGeneratedCpp.insert(allGeneratedCpp.end(), module_src.begin(), module_src.end());
402allGeneratedHpp, allGeneratedCpp, allSkippedHpp, allSkippedCpp);
408 map<
string, pair<string,string> >& module_names)
413 stringingroup_name =
419 if( doxyfile.is_open() ) {
422 " * File Description:\n" 423 " * This file was generated by application DATATOOL\n" 424 " * It contains comment blocks for DOXYGEN metamodules\n" 426 " * ===========================================================================\n" 430 for(
i= module_names.begin();
i!= module_names.end(); ++
i) {
431doxyfile <<
"\n\n/** @defgroup dataspec_"<<
i->second.second <<
" ";
433doxyfile <<
"Code generated by DATATOOL from " 434<<
i->second.first <<
" (module \'"<<
i->first <<
"\')";
438doxyfile <<
"\n * @ingroup "<< ingroup_name <<
"\n */\n\n";
441doxyfile <<
"\n\n/** @defgroup ";
444doxyfile <<
"Code generated by DATATOOL";
448doxyfile <<
"\n * @ingroup "<< ingroup_name <<
"\n */\n\n";
455 constlist<string>& generated,
constlist<string>& untouched,
456list<string>& allGeneratedHpp, list<string>& allGeneratedCpp,
457list<string>& allSkippedHpp, list<string>& allSkippedCpp)
470fileList <<
"GENFILES =";
473 string tmp(filei->second->GetFileBaseName());
474 #if defined(NCBI_OS_MSWIN) 477fileList <<
' '<<
tmp;
481fileList <<
"GENFILES_LOCAL =";
485filei->second->GetFileBaseName());
491 for(
intuser=0; user<2; ++user) {
493 for(
intcpp=0; cpp<2; ++cpp) {
494fileList << (user ?
"SKIPPED":
"GENERATED") <<
"_" 495<< (cpp ?
"CPP":
"HPP") << (
local?
"_LOCAL":
"") <<
" =";
496 constlist<string> *lst = (user ? &untouched : &generated);
497 for(list<string>::const_iterator
i=lst->begin();
498 i!= lst->end(); ++
i) {
501 if((is_cpp && cpp) || (!is_cpp && !cpp)) {
510(found = pp.find(
m_CPPDir)) == 0) {
515(found = pp.find(
m_HPPDir)) == 0) {
521 #if defined(NCBI_OS_MSWIN) 534 stringflist, flist_local;
535 ITERATE( list<string>, p, allGeneratedHpp) {
542 #if defined(NCBI_OS_MSWIN) 547fileList <<
"ALLGENERATED_HPP ="<< flist <<
'\n';
548fileList <<
"ALLGENERATED_HPP_LOCAL ="<< flist_local <<
'\n';
550flist.erase(); flist_local.erase();
551 ITERATE( list<string>, p, allSkippedHpp) {
558 #if defined(NCBI_OS_MSWIN) 563fileList <<
"ALLSKIPPED_HPP ="<< flist <<
'\n';
564fileList <<
"ALLSKIPPED_HPP_LOCAL ="<< flist_local <<
'\n';
566flist.erase(); flist_local.erase();
567 ITERATE( list<string>, p, allGeneratedCpp) {
574 #if defined(NCBI_OS_MSWIN) 579fileList <<
"ALLGENERATED_CPP ="<< flist <<
'\n';
580fileList <<
"ALLGENERATED_CPP_LOCAL ="<< flist_local <<
'\n';
582flist.erase(); flist_local.erase();
583 ITERATE( list<string>, p, allSkippedCpp) {
590 #if defined(NCBI_OS_MSWIN) 595fileList <<
"ALLSKIPPED_CPP ="<< flist <<
'\n';
596fileList <<
"ALLSKIPPED_CPP_LOCAL ="<< flist_local <<
'\n';
601 constlist<string>& module_inc,
constlist<string>& module_src,
602list<string>& allHpp, list<string>& allCpp)
608 for(
int i= 0;
i< 2; ++
i) {
609 const char* suffix =
i?
"_.cpp":
".cpp";
612allCpp.push_back(fileName);
625filei->second->GetFileBaseName())<<
629 ITERATE( list<string>, m, module_src) {
639 const char* suffix =
".hpp";
643allHpp.push_back(fileName);
653filei->second->GetFileBaseName())) + suffix) <<
656 ITERATE( list<string>, m, module_inc) {
673 stringigit =
Path(
f,
".git");
674 stringisvn =
Path(
f,
".svn");
682}
while(parent !=
f&& !
f.empty() &&
f!= rootdir);
687 const string& outdir_cpp,
const string& outdir_hpp,
688 constlist<string>& generated,
map<
string, pair<string,string> >& module_names)
693 stringignoreName(
".cvsignore");
694 stringextraName(
".cvsignore.extra");
696ignoreName =
".gitignore";
699 for(
int i=0;
i<2; ++
i) {
700 boolis_cpp = (
i==0);
701 stringout_dir(is_cpp ? outdir_cpp : outdir_hpp);
707 if(
CFile(ignorePath).Exists()) {
715files.
insert(ignoreName);
719 if(
CFile(extraPath).Exists()) {
730strline =
BaseName(filei->second->GetFileBaseName()) +
"_."+ (is_cpp ?
"cpp":
"hpp");
735 for(list<string>::const_iterator it = generated.begin();
736it != generated.end(); ++it) {
758&& !module_names.empty() ) {
773files.
insert(
f.AsString());
777 if(ignoreFile.is_open()) {
778 for(
const string&
f: files) {
780ignoreFile <<
f<< endl;
790 stringmodule_name, current_module, filename, hppDefine;
791unique_ptr<CDelayedOfstream>
out;
794 boolisfound =
false;
797 booltypes_found =
false;
800list<CTypeStrings*> filetypes;
801 code->GetClasses( filetypes );
803 ITERATE(list<CTypeStrings*>,
t, filetypes) {
804 stringmodule = (*t)->GetDoxygenModuleName();
805 if(module_name.empty() || module.size() < module_name.size()) {
806module_name = module;
809 if(current_module.empty()) {
810 if(modules.
find(module_name) != modules.
end()) {
813modules.
insert(module_name);
814current_module = module_name;
815}
else if(current_module != module_name) {
819 if( !
out.get() || !
out->is_open() ) {
820 if(
isdigit((
unsigned char)current_module[0])) {
821current_module.insert(current_module.begin(),
'x');
823filename =
Path(path, current_module +
"_module.hpp");
825 if(!
out->is_open()) {
829generated.push_back(filename);
830hppDefine = current_module +
"_REGISTERMODULECLASSES_HPP";
831 code->WriteCopyright(*
out,
false) <<
833 "#ifndef "<< hppDefine <<
"\n" 834 "#define "<< hppDefine <<
"\n" 835 "\n#include <serial/serialbase.hpp>\n\n";
836ns.
Set(
code->GetNamespace(), *
out,
true);
842 "void "<< current_module <<
"_RegisterModuleClasses(void);\n\n";
844 ITERATE(list<CTypeStrings*>,
t, filetypes) {
853 if(isfound && !types_found) {
854generated.pop_back();
857 if(
out->is_open()) {
861 "#endif // "<< hppDefine <<
"\n";
866current_module.erase();
873 stringmodule_name, current_module, filename, hppDefine;
874unique_ptr<CDelayedOfstream>
out;
879 boolisfound =
false;
882 booltypes_found =
false;
885list<CTypeStrings*> filetypes;
886 code->GetClasses( filetypes );
888 ITERATE(list<CTypeStrings*>,
t, filetypes) {
889 stringmodule = (*t)->GetDoxygenModuleName();
890 if(module_name.empty() || module.size() < module_name.size()) {
891module_name = module;
894 if(current_module.empty()) {
895 if(modules.
find(module_name) != modules.
end()) {
898modules.
insert(module_name);
899current_module = module_name;
900}
else if(current_module != module_name) {
904 if( !
out.get() || !
out->is_open()) {
905 if(
isdigit((
unsigned char)current_module[0])) {
906current_module.insert(current_module.begin(),
'x');
908filename =
Path(path, current_module +
"_module.cpp");
911current_module +
"_module.hpp");
913 "#include "<<
code->Include(module_inc) <<
"\n";
915 if(!
out->is_open()) {
919generated.push_back(filename);
920 code->WriteCopyright(*
out,
false);
926ns.
Set(
code->GetNamespace(), out_code,
false);
928 "void "<< current_module <<
"_RegisterModuleClasses(void)\n{\n";
931 ITERATE(list<CTypeStrings*>,
t, filetypes) {
936 stringuserhpp(
code->Include(
code->GetUserHPPName()));
937 if(user_includes.
find(userhpp) == user_includes.
end()) {
938user_includes.
insert(userhpp);
940 "#include "<<
code->Include(
code->GetUserHPPName()) <<
"\n";
943<<
code->GetClassNamespace(*t).ToString()
949 if(isfound && !types_found) {
950generated.pop_back();
953 if(
out->is_open()) {
954out_code <<
"}\n\n";
955ns.
Reset(out_code);
961 #ifdef NCBI_SHUN_OSTRSTREAM 969current_module.erase();
975 stringclients =
m_Config.
Get(
"-",
"clients");
976 if(clients.empty()) {
985 if( !it->empty() ) {
994 stringclass_name =
m_Config.
Get(name,
"class");
995 if(class_name.empty()) {
997 ERR_POST_X(13,
Fatal<<
"No configuration for mandatory client "+ name);
1005 code.GenerateCode();
1008generated.push_back(filename);
1010generated.push_back(filename);
1012generated.push_back(filename);
1015generated.push_back(filename);
1021 stringfileName =
type->FileName();
1043 if(
type->GetParentType() == 0 ) {
1074 ": "<< exc.
what());
1077 if( resolved->
Skipped() ) {
1093 const CDataType* memberType = mi->get()->GetType();
1129 ": "<< exc.
what());
1132 if( resolved->
Skipped() ) {
1144 else if(
type->GetParentType() == 0 ) {
1172 if(
type->Skipped() ) {
1180 if( choice != 0 ) {
1190 const CDataType* memberType = mi->get()->GetType();
1207 const CDataType* memberType = mi->get()->GetType();
1222 head->AddImportRef(
head->GetName());
1232 const string& s = (*i)->moduleName;
1233 if(
head.AddImportRef(s)) {
1244 if((*fm)->GetName() == name) {
1251 if((*fm)->GetName() == name) {
1264 stringxopt =
key+ opt;
static const string & GetExportSpecifier(void)
static const string & GetDoxygenGroup(void)
static bool GetDoxygenComments(void)
bool HaveTypeInfo(void) const
const string & GetClassNameDT(void) const
void UseQuotedForm(bool use)
string m_FileListFileName
void CheckFileNames(void)
string m_DoxygenGroupDescription
void ResolveImportRefs(void)
void SetFileNamePrefix(const string &prefix)
void GenerateModuleHPP(const string &path, list< string > &generated) const
void LoadConfig(CNcbiIstream &in)
CFileSet & GetMainModules(void)
string m_CombiningFileName
CNamespace m_DefaultNamespace
void GenerateFileList(const list< string > &generated, const list< string > &untouched, list< string > &allGeneratedHpp, list< string > &allGeneratedCpp, list< string > &allSkippedHpp, list< string > &allSkippedCpp)
CDataType * ExternalResolve(const string &module, const string &type, bool allowInternal=false) const
const string & GetRootDir(void) const
static void GetTypes(TTypeNames &typeNames, const string &name)
virtual string GetFileNamePrefix(void) const override
void GenerateDoxygenGroupDescription(map< string, pair< string, string > > &module_names)
EFileNamePrefixSource m_FileNamePrefixSource
void GenerateClientCode(list< string > &generated)
virtual const CMemoryRegistry & GetConfig(void) const override
void GenerateCvsignore(const string &outdir_cpp, const string &outdir_hpp, const list< string > &generated, map< string, pair< string, string > > &module_names)
void AddConfigLine(const string &s)
CDataType * ResolveInAnyModule(const string &type, bool allowInternal=false) const
TTypeNames m_GenerateTypes
void SetFileNamePrefixSource(EFileNamePrefixSource source)
void ExcludeTypes(const string &types)
void CollectTypes(const CDataType *type, EContext context)
bool GetOpt(const string &opt, string *value=0)
void SetDefaultNamespace(const string &ns)
virtual const CNamespace & GetNamespace(void) const override
virtual CDataType * InternalResolve(const string &moduleName, const string &typeName) const override
bool Imported(const CDataType *type) const
void UndoGenerateCode(void)
bool IsGitRepository(const string &dir) const
void ResetDefaultNamespace(void)
void GenerateModuleCPP(const string &path, list< string > &generated) const
void CreateCvsignore(bool create)
CDataType * ResolveMain(const string &fullName) const
CFileSet & GetImportModules(void)
bool AddType(const CDataType *type)
void IncludeAllMainTypes(void)
const CDataTypeModule * FindModuleByName(const string &name) const
void IncludeTypes(const string &types)
virtual EFileNamePrefixSource GetFileNamePrefixSource(void) const override
const string & ResolveFileName(const string &name) const
void GenerateCombiningFile(const list< string > &module_inc, const list< string > &module_src, list< string > &allHpp, list< string > &allCpp)
const TMembers & GetMembers(void) const
list< AutoPtr< CDataMember > > TMembers
list< AutoPtr< Import > > TImports
const TImports & GetImports(void) const
const TDefinitions & GetDefinitions(void) const
const string & GetName(void) const
list< pair< string, AutoPtr< CDataType > > > TDefinitions
const CDataType * InheritFromType(void) const
const CDataType * GetParentType(void) const
static const string & GetPchHeader(void)
static CNcbiOstream & WriteCopyrightHeader(CNcbiOstream &out)
list< AutoPtr< CDataTypeModule > > TModules
const TModuleSets & GetModuleSets(void) const
list< AutoPtr< CFileModules > > TModuleSets
CDataType * ResolveInAnyModule(const string &fullName, bool allowInternal=false) const
bool CheckNames(void) const
CDataType * ExternalResolve(const string &moduleName, const string &typeName, bool allowInternal=false) const
virtual const string & GetSourceFileName(void) const
void SetModuleContainer(const CModuleContainer *parent)
void Set(const CNamespace &ns, CNcbiOstream &out, bool mainHeader=true)
static CNcbiApplication * Instance(void)
Singleton method.
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
virtual const CDataType * Resolve(void) const override
const string & GetUserTypeName(void) const
EType GetWsdlType(void) const
container_type::const_iterator const_iterator
const_iterator end() const
const_iterator find(const key_type &key) const
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
const_iterator end() const
std::ofstream out("events_result.xml")
main entry point for tests
string BaseName(const string &path)
string Path(const string &dir, const string &file)
string GetStdPath(const string &path)
string MakeAbsolutePath(const string &path)
static const struct name_t names[]
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
static const struct type types[]
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
virtual const string & AsString(void) const =0
Get the argument's string value.
virtual bool HasValue(void) const =0
Check if argument holds a value.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
void Error(CExceptionArgs_Base &args)
#define NCBI_RETHROW_SAME(prev_exception, message)
Generic macro to re-throw the same exception.
void Warning(CExceptionArgs_Base &args)
void Fatal(CExceptionArgs_Base &args)
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
string GetDir(EIfEmptyPath mode=eIfEmptyPath_Current) const
Get the directory component for this directory entry.
string GetBase(void) const
Get the base entry name without extension.
virtual bool Remove(TRemoveFlags flags=eRecursive) const
Remove a directory entry.
static string ConvertToOSPath(const string &path)
Convert "path" on any OS to the current OS-dependent path.
static string ConcatPath(const string &first, const string &second)
Concatenate two parts of the path for the current OS.
void Reset(const string &path)
Reset path string.
string GetName(void) const
Get the base entry name with extension (if any).
const string & GetPath(void) const
Get entry path.
string GetExt(void) const
Get extension name.
virtual bool Exists(void) const
Check existence of file.
@ eIfEmptyPath_Empty
Return empty string.
virtual const string & Get(const string §ion, const string &name, TFlags flags=0) const
Get the parameter value.
virtual bool HasEntry(const string §ion, const string &name=kEmptyStr, TFlags flags=0) const
IRWRegistry * Read(CNcbiIstream &is, TFlags flags=0, const string &path=kEmptyStr)
Read and parse the stream "is", and merge its content with current Registry entries.
bool Set(const string §ion, const string &name, const string &value, TFlags flags=0, const string &comment=kEmptyStr)
Set the configuration parameter value.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
CNcbiIstream & NcbiGetlineEOL(CNcbiIstream &is, string &str, string::size_type *count=NULL)
Read from "is" to "str" the next line (taking into account platform specifics of End-of-Line)
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
NCBI_NS_STD::string::size_type SIZE_TYPE
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static string & Replace(const string &src, const string &search, const string &replace, string &dst, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within 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 string & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
static string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string.
@ fSplit_MergeDelimiters
Merge adjacent delimiters.
Definition of all error codes used in serial libraries (xser.lib, xcser.lib).
constexpr auto front(list< Head, As... >, T=T()) noexcept -> Head
constexpr bool empty(list< Ts... >) noexcept
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
const CharType(& source)[N]
#define GetArgs
Avoid preprocessor name clash with the NCBI C Toolkit.
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
bool eq(T x_, T y_, T round_)
std::istream & in(std::istream &in_, double &x_)
static SLJIT_INLINE sljit_ins l(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
bool operator()(const string &s1, const string &s2) const
static CS_CONTEXT * context
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