A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/generate_8cpp_source.html below:

NCBI C++ ToolKit: src/serial/datatool/generate.cpp Source File

55 #define NCBI_USE_ERRCODE_X Serial_MainGen 109  const string

& name)

const 135  bool

ignoreAbsense,

bool

warningAbsense)

139  if

( fileName ==

"stdin"

|| fileName ==

"-"

) {

145  if

( ignoreAbsense ) {

147

}

else if

(warningAbsense) {

168  m_Config

.

Set

(line.substr(bra + 1, ket - bra - 1),

169

line.substr(ket + 1,

eq

- ket - 1),

170

line.substr(

eq

+ 1));

177  string

loc(

"CCodeGenerator::ExternalResolve: failed"

);

195  string

loc(

"CCodeGenerator::ResolveInAnyModule: failed"

);

216

fullName.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();

338

fname =

code

->ChangeFileBaseName();

340  names

.insert(fname);

353  string

outdir_cpp, outdir_hpp;

354

list<string> listGenerated, listUntouched;

355

list<string> allGeneratedHpp, allGeneratedCpp, allSkippedHpp, allSkippedCpp;

359  code

->GetModuleNames( module_names);

361  code

->GenerateCode();

364

allGeneratedHpp.push_back(fileName);

365  if

(outdir_hpp.empty()) {

367

outdir_hpp = entry.

GetDir

();

370

allGeneratedCpp.push_back(fileName);

371  if

(outdir_cpp.empty()) {

373

outdir_cpp = entry.

GetDir

();

376

listGenerated.push_back( fileName);

377

allGeneratedHpp.push_back(fileName);

379

listUntouched.push_back( fileName);

380

allSkippedHpp.push_back(fileName);

383

listGenerated.push_back( fileName);

384

allGeneratedCpp.push_back(fileName);

386

listUntouched.push_back( fileName);

387

allSkippedCpp.push_back(fileName);

390

list<string> module_inc, module_src;

397

listGenerated.insert(listGenerated.end(), module_inc.begin(), module_inc.end());

398

allGeneratedHpp.insert(allGeneratedHpp.end(), module_inc.begin(), module_inc.end());

399

listGenerated.insert(listGenerated.end(), module_src.begin(), module_src.end());

400

allGeneratedCpp.insert(allGeneratedCpp.end(), module_src.begin(), module_src.end());

402

allGeneratedHpp, allGeneratedCpp, allSkippedHpp, allSkippedCpp);

408  map

<

string

, pair<string,string> >& module_names)

413  string

ingroup_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

) {

431

doxyfile <<

"\n\n/** @defgroup dataspec_"

<<

i

->second.second <<

" "

;

433

doxyfile <<

"Code generated by DATATOOL from " 434

<<

i

->second.first <<

" (module \'"

<<

i

->first <<

"\')"

;

438

doxyfile <<

"\n * @ingroup "

<< ingroup_name <<

"\n */\n\n"

;

441

doxyfile <<

"\n\n/** @defgroup "

;

444

doxyfile <<

"Code generated by DATATOOL"

;

448

doxyfile <<

"\n * @ingroup "

<< ingroup_name <<

"\n */\n\n"

;

455  const

list<string>& generated,

const

list<string>& untouched,

456

list<string>& allGeneratedHpp, list<string>& allGeneratedCpp,

457

list<string>& allSkippedHpp, list<string>& allSkippedCpp)

470

fileList <<

"GENFILES ="

;

473  string tmp

(filei->second->GetFileBaseName());

474 #if defined(NCBI_OS_MSWIN) 477

fileList <<

' '

<<

tmp

;

481

fileList <<

"GENFILES_LOCAL ="

;

485

filei->second->GetFileBaseName());

491  for

(

int

user=0; user<2; ++user) {

493  for

(

int

cpp=0; cpp<2; ++cpp) {

494

fileList << (user ?

"SKIPPED"

:

"GENERATED"

) <<

"_" 495

<< (cpp ?

"CPP"

:

"HPP"

) << (

local

?

"_LOCAL"

:

""

) <<

" ="

;

496  const

list<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  string

flist, flist_local;

535  ITERATE

( list<string>, p, allGeneratedHpp) {

542 #if defined(NCBI_OS_MSWIN) 547

fileList <<

"ALLGENERATED_HPP ="

<< flist <<

'\n'

;

548

fileList <<

"ALLGENERATED_HPP_LOCAL ="

<< flist_local <<

'\n'

;

550

flist.erase(); flist_local.erase();

551  ITERATE

( list<string>, p, allSkippedHpp) {

558 #if defined(NCBI_OS_MSWIN) 563

fileList <<

"ALLSKIPPED_HPP ="

<< flist <<

'\n'

;

564

fileList <<

"ALLSKIPPED_HPP_LOCAL ="

<< flist_local <<

'\n'

;

566

flist.erase(); flist_local.erase();

567  ITERATE

( list<string>, p, allGeneratedCpp) {

574 #if defined(NCBI_OS_MSWIN) 579

fileList <<

"ALLGENERATED_CPP ="

<< flist <<

'\n'

;

580

fileList <<

"ALLGENERATED_CPP_LOCAL ="

<< flist_local <<

'\n'

;

582

flist.erase(); flist_local.erase();

583  ITERATE

( list<string>, p, allSkippedCpp) {

590 #if defined(NCBI_OS_MSWIN) 595

fileList <<

"ALLSKIPPED_CPP ="

<< flist <<

'\n'

;

596

fileList <<

"ALLSKIPPED_CPP_LOCAL ="

<< flist_local <<

'\n'

;

601  const

list<string>& module_inc,

const

list<string>& module_src,

602

list<string>& allHpp, list<string>& allCpp)

608  for

(

int i

= 0;

i

< 2; ++

i

) {

609  const char

* suffix =

i

?

"_.cpp"

:

".cpp"

;

612

allCpp.push_back(fileName);

625

filei->second->GetFileBaseName())<<

629  ITERATE

( list<string>, m, module_src) {

639  const char

* suffix =

".hpp"

;

643

allHpp.push_back(fileName);

653

filei->second->GetFileBaseName())) + suffix) <<

656  ITERATE

( list<string>, m, module_inc) {

673  string

igit =

Path

(

f

,

".git"

);

674  string

isvn =

Path

(

f

,

".svn"

);

682

}

while

(parent !=

f

&& !

f

.empty() &&

f

!= rootdir);

687  const string

& outdir_cpp,

const string

& outdir_hpp,

688  const

list<string>& generated,

map

<

string

, pair<string,string> >& module_names)

693  string

ignoreName(

".cvsignore"

);

694  string

extraName(

".cvsignore.extra"

);

696

ignoreName =

".gitignore"

;

699  for

(

int i

=0;

i

<2; ++

i

) {

700  bool

is_cpp = (

i

==0);

701  string

out_dir(is_cpp ? outdir_cpp : outdir_hpp);

707  if

(

CFile

(ignorePath).Exists()) {

715

files.

insert

(ignoreName);

719  if

(

CFile

(extraPath).Exists()) {

730

strline =

BaseName

(filei->second->GetFileBaseName()) +

"_."

+ (is_cpp ?

"cpp"

:

"hpp"

);

735  for

(list<string>::const_iterator it = generated.begin();

736

it != generated.end(); ++it) {

758

&& !module_names.empty() ) {

773

files.

insert

(

f

.AsString());

777  if

(ignoreFile.is_open()) {

778  for

(

const string

&

f

: files) {

780

ignoreFile <<

f

<< endl;

790  string

module_name, current_module, filename, hppDefine;

791

unique_ptr<CDelayedOfstream>

out

;

794  bool

isfound =

false

;

797  bool

types_found =

false

;

800

list<CTypeStrings*> filetypes;

801  code

->GetClasses( filetypes );

803  ITERATE

(list<CTypeStrings*>,

t

, filetypes) {

804  string

module = (*t)->GetDoxygenModuleName();

805  if

(module_name.empty() || module.size() < module_name.size()) {

806

module_name = module;

809  if

(current_module.empty()) {

810  if

(modules.

find

(module_name) != modules.

end

()) {

813

modules.

insert

(module_name);

814

current_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])) {

821

current_module.insert(current_module.begin(),

'x'

);

823

filename =

Path

(path, current_module +

"_module.hpp"

);

825  if

(!

out

->is_open()) {

829

generated.push_back(filename);

830

hppDefine = 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"

;

836

ns.

Set

(

code

->GetNamespace(), *

out

,

true

);

842  "void "

<< current_module <<

"_RegisterModuleClasses(void);\n\n"

;

844  ITERATE

(list<CTypeStrings*>,

t

, filetypes) {

853  if

(isfound && !types_found) {

854

generated.pop_back();

857  if

(

out

->is_open()) {

861  "#endif // "

<< hppDefine <<

"\n"

;

866

current_module.erase();

873  string

module_name, current_module, filename, hppDefine;

874

unique_ptr<CDelayedOfstream>

out

;

879  bool

isfound =

false

;

882  bool

types_found =

false

;

885

list<CTypeStrings*> filetypes;

886  code

->GetClasses( filetypes );

888  ITERATE

(list<CTypeStrings*>,

t

, filetypes) {

889  string

module = (*t)->GetDoxygenModuleName();

890  if

(module_name.empty() || module.size() < module_name.size()) {

891

module_name = module;

894  if

(current_module.empty()) {

895  if

(modules.

find

(module_name) != modules.

end

()) {

898

modules.

insert

(module_name);

899

current_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])) {

906

current_module.insert(current_module.begin(),

'x'

);

908

filename =

Path

(path, current_module +

"_module.cpp"

);

911

current_module +

"_module.hpp"

);

913  "#include "

<<

code

->Include(module_inc) <<

"\n"

;

915  if

(!

out

->is_open()) {

919

generated.push_back(filename);

920  code

->WriteCopyright(*

out

,

false

);

926

ns.

Set

(

code

->GetNamespace(), out_code,

false

);

928  "void "

<< current_module <<

"_RegisterModuleClasses(void)\n{\n"

;

931  ITERATE

(list<CTypeStrings*>,

t

, filetypes) {

936  string

userhpp(

code

->Include(

code

->GetUserHPPName()));

937  if

(user_includes.

find

(userhpp) == user_includes.

end

()) {

938

user_includes.

insert

(userhpp);

940  "#include "

<<

code

->Include(

code

->GetUserHPPName()) <<

"\n"

;

943

<<

code

->GetClassNamespace(*t).ToString()

949  if

(isfound && !types_found) {

950

generated.pop_back();

953  if

(

out

->is_open()) {

954

out_code <<

"}\n\n"

;

955

ns.

Reset

(out_code);

961 #ifdef NCBI_SHUN_OSTRSTREAM 969

current_module.erase();

975  string

clients =

m_Config

.

Get

(

"-"

,

"clients"

);

976  if

(clients.empty()) {

985  if

( !it->empty() ) {

994  string

class_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();

1008

generated.push_back(filename);

1010

generated.push_back(filename);

1012

generated.push_back(filename);

1015

generated.push_back(filename);

1021  string

fileName =

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  string

xopt =

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 &section, const string &name, TFlags flags=0) const

Get the parameter value.

virtual bool HasEntry(const string &section, 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 &section, 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