& baseName)
58: m_CodeGenerator(codeGenerator),m_BaseName(baseName)
123s += (
isalnum((
unsigned char)*
i) ? (*i) :
'_');
129 if( c >=
'a'&& c <=
'z')
130c = (char)(c + (
'A'-
'a'));
131 else if( (c < 'A' || c >
'Z') &&
132(c < '0' || c >
'9') )
161 returns[0] +
GetStdPath(s.substr(1, s.length()-2)) + s[s.length()-1];
254 " * ===========================================================================\n" 256 " * PUBLIC DOMAIN NOTICE\n" 257 " * National Center for Biotechnology Information\n" 259 " * This software/database is a \"United States Government Work\" under the\n" 260 " * terms of the United States Copyright Act. It was written as part of\n" 261 " * the author's official duties as a United States Government employee and\n" 262 " * thus cannot be copyrighted. This software/database is freely available\n" 263 " * to the public for use. The National Library of Medicine and the U.S.\n" 264 " * Government have not placed any restriction on its use or reproduction.\n" 266 " * Although all reasonable efforts have been taken to ensure the accuracy\n" 267 " * and reliability of the software and data, the NLM and the U.S.\n" 268 " * Government do not and cannot warrant the performance or results that\n" 269 " * may be obtained by using this software or data. The NLM and the U.S.\n" 270 " * Government disclaim all warranties, express or implied, including\n" 271 " * warranties of performance, merchantability or fitness for any particular\n" 274 " * Please cite the author in any work or product based on this material.\n" 276 " * ===========================================================================\n" 299 if(docroot.empty()) {
303 out<<
"/// <a href=\"";
307 if(!rootdir.empty()) {
315 if(!deffile.empty()) {
318<<
"/// and additional tune-up parameters:\n";
320 if(!rootdir.empty()) {
338<<
"/// Data storage class.\n" 340<<
"/// This file was generated by application DATATOOL\n" 341<<
"/// using the following specifications:\n";
345 "/// Don't edit or commit this file into CVS as this file will\n" 346 "/// be overridden (by DATATOOL) without warning!\n";
349 " * File Description:\n" 350 " * This code was generated by application DATATOOL\n" 351 " * using the following specifications:\n" 356 " * Don't edit or commit this file into CVS as this file will\n" 357 " * be overridden (by DATATOOL) without warning!\n" 358 " * ===========================================================================\n" 371<<
"/// User-defined methods of the data storage class.\n" 373<<
"/// This file was originally generated by application DATATOOL\n" 374<<
"/// using the following specifications:\n";
377 "/// New methods or data members can be added to it if needed.\n";
380 out<<
"/// See also: "<< name <<
"\n\n";
385base +=
"_8hpp.html";
387 out<<
"/// See also: <a href=\""<< base <<
"\">"<< name <<
"</a>\n\n";
391 " * Author: .......\n" 393 " * File Description:\n" 397 " * This code was originally generated by application DATATOOL\n" 398 " * using the following specifications:\n" 412 "* ===========================================================================\n" 416 "* ===========================================================================\n" 435 "#ifndef "<< hppDefine <<
"\n" 436 "#define "<< hppDefine <<
"\n" 439 if(!extra.empty()) {
440list<string> extra_values;
442header <<
"// extra headers\n";
443list<string>::const_iterator
i;
444 for(
i= extra_values.begin();
i!= extra_values.end(); ++
i) {
445 if(
i->at(0) ==
'\"') {
446header <<
"#include "<< *
i<<
"\n";
448header <<
"#include <"<< *
i<<
">\n";
454 "// standard includes\n" 455 "#include <serial/serialbase.hpp>\n";
460 "// generated includes\n";
463 "#include "<<
Include(*
i,
true) <<
"\n";
478 "// forward declarations\n";
482 "class "<< *s <<
";\n";
492 if( !
i->hppCode.empty() ) {
493ns.
Set(
i->ns, header);
497 "// generated classes\n" 502<<
"/** @addtogroup ";
506header <<
"dataspec_"<<
i->code->GetDoxygenModuleName();
515header <<
i->hppCode;
520header <<
"\n/* @} */";
529 if( !
i->inlCode.empty() ) {
530ns.
Set(
i->ns, header,
false);
539 "///////////////////////////////////////////////////////////\n" 540 "///////////////////// inline methods //////////////////////\n" 541 "///////////////////////////////////////////////////////////\n";
544header <<
i->inlCode;
549 "///////////////////////////////////////////////////////////\n" 550 "////////////////// end of inline methods //////////////////\n" 551 "///////////////////////////////////////////////////////////\n" 562 "#endif // "<< hppDefine <<
"\n";
581 "// standard includes\n";
588 "#include <serial/serialimpl.hpp>\n" 590 "// generated includes\n" 591 "#include "<< userinc <<
"\n";
596 if(cppinc != userinc) {
597 code<<
"#include "<< cppinc <<
"\n";
606 if( !
i->cppCode.empty() ) {
611 "// generated classes\n" 643 constlist<string>& newLines)
const 653 boolhaveChecksum =
false;
656list<string>::const_iterator newLinesI = newLines.begin();
666 if( haveChecksum ||
in.eof() ) {
671 "Will not overwrite modified user file: "<<fileName);
680 in.clear(
in.rdstate() & ~
in.failbit);
690 if( lineOffset == 0 && eol ) {
700 if( newLinesI == newLines.end() )
702 else if( newLinesI->size() < lineOffset +
count)
705 const char* ptr = newLinesI->data() + lineOffset;
709lineOffset +=
count;
714equal = newLinesI->size() == lineOffset;
721 if( haveChecksum ) {
728 return!equal || newLinesI != newLines.end();
737(this->*method)(
code);
747 const char* codePtr = codeStr.data();
750 while(
count> 0 ) {
752 const char* eolPtr = (
const char*)memchr(codePtr,
'\n',
count);
755 "unended line in generated code");
760lines.back().assign(codePtr, eolPtr);
766 count-= (eolPtr - codePtr);
774 string& fileName, TGenerateMethod method)
const 777list<string> newLines;
780fileName =
Path(path, name);
795 ITERATE( list<string>,
i, newLines ) {
803 ERR_POST_X(7,
"Error writing file "<< fileName);
815 "#ifndef "<< hppDefine <<
"\n" 816 "#define "<< hppDefine <<
"\n" 821 "// generated includes\n" 828 "// generated classes\n" 831ns.
Set(
i->ns, header,
false);
832 i->code->GenerateUserHPPCode(header);
840 "#endif // "<< hppDefine <<
"\n";
848 "// standard includes\n";
855 "// generated includes\n" 862 "// generated classes\n" 866 i->code->GenerateUserCPPCode(
code);
884 types.push_back(
i->code.get());
886 return!
types.empty();
892 if(
type==
i->code.get()) {
901 stringidName =
type->IdName() +
type->GetNamespaceName();
905 _TRACE(
"AddType: "<< idName <<
": "<<
typeid(*type).name());
908 code->SetModuleName(
type->GetModule()->GetName());
919 stringdoxmodule_name, module_name;
922doxmodule_name =
i->code->GetDoxygenModuleName();
923module_name =
i->code->GetModuleName();
924 if(
names.find(module_name) ==
names.end()) {
925 names[module_name] = make_pair(src_file,doxmodule_name);
Checksum and hash calculation classes.
CChecksum â Checksum calculator.
static const string & GetDocRootURL(void)
static const string & GetDoxygenGroup(void)
static bool GetDoxygenComments(void)
const string & GetRootDir(void) const
virtual const CMemoryRegistry & GetConfig(void) const override
const string & GetDefFile(void) const
const string & ResolveFileName(const string &name) const
bool GetClasses(list< CTypeStrings * > &types)
CNcbiOstream & WriteSourceFile(CNcbiOstream &out) const
string GetBaseFileBaseName(void) const
string GetBaseHPPDefine(void) const
virtual void AddForwardDeclaration(const string &className, const CNamespace &ns) override
CNcbiOstream & WriteSpecRefs(CNcbiOstream &out) const
void GenerateCPP(const string &path, string &fileName) const
void GenerateHPP(const string &path, string &fileName) const
CTypeStrings * GetPrimaryClass(void)
CNcbiOstream & WriteUserCopyright(CNcbiOstream &out, bool header) const
static CNcbiOstream & WriteLogKeyword(CNcbiOstream &out)
void UseQuotedForm(bool use)
virtual void AddHPPCode(const CNcbiOstrstream &code) override
virtual TIncludes & HPPIncludes(void) override
virtual void AddCPPCode(const CNcbiOstrstream &code) override
virtual void AddINLCode(const CNcbiOstrstream &code) override
string GetUserHPPName(void) const
bool WriteUserFile(const string &path, const string &name, string &fileName, TGenerateMethod method) const
string GetUserFileBaseName(void) const
TAddedClasses m_AddedClasses
string GetUserCPPName(void) const
void GenerateUserHPPCode(CNcbiOstream &code) const
virtual const CNamespace & GetNamespace(void) const override
const string & ChangeFileBaseName(void)
bool ModifiedByUser(const string &fileName, const list< string > &newLines) const
const string & GetFileBaseName(void) const
string GetDefineBase(void) const
virtual string GetMethodPrefix(void) const override
void LoadLines(TGenerateMethod method, list< string > &lines) const
static string m_PchHeader
CNamespace GetClassNamespace(CTypeStrings *type)
void GetModuleNames(map< string, pair< string, string > > &names) const
string GetBaseHPPName(void) const
bool GenerateUserCPP(const string &path, string &fileName) const
string GetBaseCPPName(void) const
CFileCode(const CCodeGenerator *codeGenerator, const string &baseName)
SClassInfo * m_CurrentClass
bool AddType(const CDataType *type)
static CNcbiOstream & WriteCopyrightHeader(CNcbiOstream &out)
string GetUserHPPDefine(void) const
void CreateFileFolder(const string &fileName) const
string Include(const string &s, bool addExt=false) const
virtual TIncludes & CPPIncludes(void) override
void GenerateUserCPPCode(CNcbiOstream &code) const
list< SClassInfo > TClasses
set< string > m_SourceFiles
TForwards m_ForwardDeclarations
const CCodeGenerator * m_CodeGenerator
bool GenerateUserHPP(const string &path, string &fileName) const
CNcbiOstream & WriteCopyright(CNcbiOstream &out, bool header) const
void Set(const CNamespace &ns, CNcbiOstream &out, bool mainHeader=true)
string ToString(void) const
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
virtual void GenerateCode(CClassContext &ctx) const
iterator_bool insert(const value_type &val)
iterator_bool insert(const value_type &val)
const_iterator begin() const
const_iterator find(const key_type &key) const
const_iterator end() const
std::ofstream out("events_result.xml")
main entry point for tests
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 const struct type types[]
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
element_type * get(void) const
Get pointer.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
void AddLine(const char *line, size_t len)
bool ValidChecksumLine(const char *line, size_t len) const
Check for checksum line.
void AddChars(const char *str, size_t len)
Update current control sum with data provided.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Fatal(CExceptionArgs_Base &args)
void Info(CExceptionArgs_Base &args)
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.
bool CreatePath(TCreateFlags flags=fCreate_Default) const
Create the directory path recursively possibly more than one at a time.
string GetName(void) const
Get the base entry name with extension (if any).
const string & GetPath(void) const
Get entry path.
virtual const string & Get(const string §ion, const string &name, TFlags flags=0) const
Get the parameter value.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Int8 GetOssSize(CNcbiOstrstream &oss)
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
NCBI_NS_STD::string::size_type SIZE_TYPE
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.
@ fSplit_MergeDelimiters
Merge adjacent delimiters.
Definition of all error codes used in serial libraries (xser.lib, xcser.lib).
constexpr bool empty(list< Ts... >) noexcept
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
std::istream & in(std::istream &in_, double &x_)
AutoPtr< CTypeStrings > code
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