cfl_utils.cpp
Go to the documentation of this file.
1/** @file cfl_utils.cpp C-level utility functions */
2
3/* FAU Discrete Event Systems Library (libfaudes)
4
5 Copyright (C) 2006 Bernd Opitz
6 Copyright (C) 2008-2010 Thomas Moor
7 Exclusive copyright is granted to Klaus Schmidt
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
23*/
24
25
26#include "cfl_utils.h"
27
28
29// Debug includes
30#include "cfl_attributes.h"
31#include "cfl_registry.h"
32#include "cfl_types.h"
33#include "cfl_elementary.h"
34
35
36// c++ file io
37#include <fstream>
38#include <cstdlib>
39
40
41namespace faudes {
42
43// ToStringInteger(number)
44std::string ToStringInteger(Int number) {
45 if(number>= std::numeric_limits<Int>::max()) return "inf";
46 if(number<= std::numeric_limits<Int>::min()+1) return "-inf";
47 std::string res;
48 std::stringstream sstr;
49 sstr << number;
50 sstr >> res;
51 return res;
52}
53
54// ToStringInteger16(number)
55std::string ToStringInteger16(Int number) {
56 std::string res;
57 std::stringstream sstr;
58 sstr << "0x" << std::setbase(16) << number;
59 sstr >> res;
60 return res;
61}
62
63// ToStringFloat(number)
64// todo: check range, prevent sci notation
65std::string ToStringFloat(Float number) {
66 if(number>= std::numeric_limits<Float>::max()) return "inf";
67 if(number<= -1*std::numeric_limits<Float>::max()) return "-inf";
68 std::stringstream sstr;
69 if(number == static_cast<Float>( static_cast<Int>(number) )) {
70 sstr << static_cast<Int>(number);
71 } else {
72 sstr << std::fixed;
73 sstr << number;
74 }
75 std::string res;
76 sstr >> res;
77 return res;
78}
79
80// ExpandString(rString, len)
81std::string ExpandString(const std::string& rString, unsigned int len) {
82 std::string res;
83 res = rString;
84 std::string::size_type xtra = (std::string::size_type) len - rString.length();
85 if ((xtra > 0) && (xtra < 10000)) {
86 res.append(xtra, ' ');
87 }
88 return res;
89}
90
91// CollapseString(rString, len)
92std::string CollapsString(const std::string& rString, unsigned int len) {
93 if(len <=1) return rString;
94 if(rString.length() <= len) return rString;
95 int chead = len/2;
96 int ctail = len-chead;
97 return rString.substr(0,chead) + "..." + rString.substr(rString.length()-ctail,ctail);
98}
99
100// ToIdx(rString)
101Idx ToIdx(const std::string& rString) {
102 char * end;
103 unsigned long ul = strtoul (rString.c_str(), &end, 0);
104 unsigned long idxmax = std::numeric_limits<Idx>::max();
105 if(ul > idxmax) {
106 throw Exception("atoidx", "Idx overflow", 600);
107 }
108 return (Idx) ul;
109}
110
111// ToLOwerCase(rString(
112std::string ToLowerCase(const std::string& rString) {
113 std::string res=rString;
114 std::transform(res.begin(), res.end(), res.begin(),
115 [](unsigned char c){ return std::tolower(c); });
116 return res;
117}
118
119
120
121// String Substitution
122std::string StringSubstitute(const std::string& rString,const std::string& rFrom,const std::string& rTo) {
123 // prep result
124 std::string res;
125 std::size_t pos=0;
126 // loop over occurences of "from"
127 while(pos<rString.length()) {
128 std::size_t next=rString.find(rFrom,pos);
129 if(next==std::string::npos) break;
130 res.append(rString.substr(pos, next-pos));
131 res.append(rTo);
132 pos=next+rFrom.length();
133 }
134 // get end
135 if(pos<rString.length())
136 res.append(rString.substr(pos));
137 // done
138 return res;
139}
140
141// VersionString()
142std::string VersionString() {
143 return std::string(FAUDES_VERSION);
144}
145
146// FluginsString()
147std::string PluginsString() {
148 return std::string(FAUDES_PLUGINS);
149}
150
151// ContributorsString()
152std::string ContributorsString() {
153 return
154 "Ramon Barakat, Ruediger Berndt, Christian Breindl, Christine Baier, Tobias Barthel, Christoph Doerr, Marc Duevel, Norman Franchi, Stefan Goetz, Rainer Hartmann, Jochen Hellenschmidt, Stefan Jacobi, Matthias Leinfelder, Tomas Masopust, Michael Meyer, Andreas Mohr, Thomas Moor, Mihai Musunoi, Bernd Opitz, Katja Pelaic, Irmgard Petzoldt, Sebastian Perk, Thomas Rempel, Daniel Ritter, Berno Schlein, Ece Schmidt, Klaus Schmidt, Anne-Kathrin Schmuck, Sven Schneider, Matthias Singer, Yiheng Tang, Ulas Turan, Christian Wamser, Zhengying Wang, Thomas Wittmann, Shi Xiaoxun, Changming Yang, Yang Yi, Jorgos Zaddach, Hao Zhou, Christian Zwick, et al";
155}
156
157#define XLITSTR(x) LITSTR(x)
158#define LITSTR(x) #x
159
160std::string BuildString() {
161 std::string res;
162#ifdef FAUDES_BUILDENV
163 res = res + std::string(FAUDES_BUILDENV);
164#else
165 res = res + std::string("generic");
166#endif
167#ifdef FAUDES_BUILDTIME
168 res = res + std::string(" ") + std::string(FAUDES_BUILDTIME);
169#else
170 res = res + std::string(" ") + std::string(FAUDES_CONFIG_TIMESTAMP);
171#endif
172 return res;
173}
174
175
176// ProcessDot(infile,outfile,format)
177void ProcessDot(const std::string& rDotFile,
178 const std::string& rOutFile, const std::string& rOutFormat, const std::string& rDotExec)
179{
180 std::string format=rOutFormat;
181 // guess format from filename
182 if(format=="") {
183 if(rOutFile.rfind('.')+1 < rOutFile.size()) {
184 format=rOutFile.substr(rOutFile.rfind('.')+1);
185 }
186 }
187 // test format
188 if (format == "canon");
189 else if (format == "dot");
190 else if (format == "xdot");
191 else if (format == "cmap");
192 else if (format == "dia");
193 else if (format == "fig");
194 else if (format == "gd");
195 else if (format == "gd2");
196 else if (format == "gif");
197 else if (format == "hpgl");
198 else if (format == "imap");
199 else if (format == "cmapx");
200 else if (format == "ismap");
201 else if (format == "jpg");
202 else if (format == "jpeg");
203 else if (format == "mif");
204 else if (format == "mp");
205 else if (format == "pcl");
206 else if (format == "pic");
207 else if (format == "plain");
208 else if (format == "plain-ext");
209 else if (format == "png");
210 else if (format == "ps");
211 else if (format == "ps2");
212 else if (format == "svg");
213 else if (format == "svgz");
214 else if (format == "vrml");
215 else if (format == "vtx");
216 else if (format == "wbmp");
217 else if (format == "eps");
218 else if (format == "pdf");
219 else {
220 std::stringstream errstr;
221 errstr << "Dot output format \"" << format << "\" unknown";
222 throw Exception("faudes::ProcessDot", errstr.str(), 3);
223 }
224 std::string args = "-T"+format+" \""+rDotFile+"\" -o \""+rOutFile+"\"";
225 if(faudes_system(rDotExec,args) != 0) {
226 throw Exception("faudes::ProcessDot", "Error in running " + rDotExec + " " + args, 3);
227 }
228}
229
230
231// test executable
232bool DotReady(const std::string& rDotExec) {
233 // cache value
234 static std::string knowngood="";
235 static std::string knownbad="";
236 if(rDotExec=="") return false;
237 if(rDotExec==knowngood) return true;
238 if(rDotExec==knownbad) return false;
239 // test for dot binary
240 std::string args = "-V";
241 bool ready = (faudes_system(rDotExec,args) == 0);
242 if(ready) {
243 knowngood=rDotExec;
244 knownbad="";
245 } else {
246 knowngood="";
247 knownbad=rDotExec;
248 }
249 return ready;
250}
251
252
253// CreateTempFile(void)
254// todo: sys dependant, report, investigate threads
255std::string CreateTempFile(void) {
256 char filename[]= "faudes_temp_XXXXXX";
257 std::string res;
258#ifdef FAUDES_POSIX
259 // use mkstemp on recent Posix systems
260 int filedes = -1;
261 filedes= mkstemp(filename);
262 if(filedes==-1) {
263 FD_DF("faudes::CreateTempFile(): error");
264 return res;
265 }
266 close(filedes);
267 res=std::string(filename);
268#endif
269#ifdef FAUDES_WINDOWS
270 // mimique mkstemp on Windows/MinGW
271 /*
272 int filedes = -1;
273 #define _S_IREAD 256
274 #define _S_IWRITE 128
275 mktemp(filename);
276 filedes=open(filename,O_RDWR|O_BINARY|O_CREAT|O_EXCL|_O_SHORT_LIVED, _S_IREAD|_S_IWRITE);
277 if(filedes==-1) {
278 FD_DF("faudes::CreateTempFile(): error");
279 return "";
280 }
281 close(filedes);
282 res=std::string(filename);
283 */
284 // win32 API
285 char* tmpname = _mktemp(filename);
286 FILE* file;
287 if(tmpname==NULL) {
288 FD_DF("faudes::CreateTempFile(): error");
289 return res;
290 }
291 fopen_s(&file,tmpname,"w");
292 if(file==NULL) {
293 FD_DF("faudes::CreateTempFile(): error");
294 return "";
295 }
296 fclose(file);
297 res=std::string(tmpname);
298#endif
299 FD_DF("faudes::CreateTempFile(): " << res);
300 return(res);
301}
302
303// ExtractPath
304std::string ExtractDirectory(const std::string& rFullPath) {
305 std::string res="";
306 std::size_t seppos = rFullPath.find_last_of(faudes_pathseps());
307 if(seppos==std::string::npos) return res;
308 res=rFullPath.substr(0,seppos+1);
309 return res;
310}
311
312// ExtractFilename
313std::string ExtractFilename(const std::string& rFullPath) {
314 std::string res=rFullPath;
315 std::size_t seppos = rFullPath.find_last_of(faudes_pathseps());
316 if(seppos==std::string::npos) return res;
317 res=rFullPath.substr(seppos+1);
318 return res;
319}
320
321// ExtractBasename
322std::string ExtractBasename(const std::string& rFullPath) {
323 std::string res=rFullPath;
324 std::size_t seppos = res.find_last_of(faudes_pathseps());
325 if(seppos!=std::string::npos) {
326 res=res.substr(seppos+1);
327 }
328 std::size_t dotpos = res.find_last_of(".");
329 if(dotpos!=std::string::npos) {
330 res=res.substr(0,dotpos);
331 }
332 return res;
333}
334
335// ExtractSuffix
336std::string ExtractSuffix(const std::string& rFullPath) {
337 std::string res=rFullPath;
338 std::size_t seppos = res.find_last_of(faudes_pathseps());
339 if(seppos!=std::string::npos) {
340 res=res.substr(seppos+1);
341 }
342 std::size_t dotpos = res.find_last_of(".");
343 if(dotpos!=std::string::npos)
344 if(dotpos +1 < res.size()) {
345 return res.substr(dotpos+1,res.size()-dotpos-1);
346 }
347 return std::string();
348}
349
350// PrependPath
351std::string PrependPath(const std::string& rLeft, const std::string& rRight) {
352 // bail out in trivial args
353 if(rLeft=="")
354 return std::string(rRight);
355 if(rRight=="")
356 return std::string(rLeft);
357 // system default
358 char sepchar=faudes_pathsep().at(0);
359 // user overwrite by left argument
360 std::size_t seppos;
361 seppos=rLeft.find_last_of(faudes_pathseps());
362 if(seppos!=std::string::npos)
363 sepchar=rLeft.at(seppos);
364 // go doit
365 std::string res=rLeft;
366 if(res.at(res.length()-1)!=sepchar)
367 res.append(1,sepchar);
368 if(rRight.at(0)!=sepchar){
369 res.append(rRight);
370 return res;
371 }
372 if(rRight.length()<=1) {
373 return res;
374 }
375 res.append(rRight,1,std::string::npos);
376 return res;
377}
378
379// Test directory
380bool DirectoryExists(const std::string& rDirectory) {
381#ifdef FAUDES_POSIX
382 DIR *thedir;
383 thedir=opendir(rDirectory.c_str());
384 if(thedir) closedir(thedir);
385 return thedir!= 0;
386#endif
387#ifdef FAUDES_WINDOWS
388 DWORD fattr = GetFileAttributesA(faudes_extpath(rDirectory).c_str());
389 return
390 (fattr!=INVALID_FILE_ATTRIBUTES) && (fattr & FILE_ATTRIBUTE_DIRECTORY);
391#endif
392 return false;
393}
394
395// scan directory
396std::set< std::string > ReadDirectory(const std::string& rDirectory) {
397 std::set< std::string > res;
398#ifdef FAUDES_POSIX
399 DIR *thedir;
400 struct dirent *theent;
401 thedir=opendir(rDirectory.c_str());
402 if(!thedir) return res;
403 while((theent=readdir(thedir))) {
404 std::string fname(theent->d_name);
405 if(fname==".") continue;
406 if(fname=="..") continue;
407 res.insert(fname);
408 }
409 closedir(thedir);
410#endif
411#ifdef FAUDES_WINDOWS
412 HANDLE hf;
413 WIN32_FIND_DATA data;
414 hf = FindFirstFile((rDirectory+"\\*.*").c_str(), &data);
415 if (hf != INVALID_HANDLE_VALUE) {
416 do {
417 std::string fname(data.cFileName);
418 if(fname==".") continue;
419 if(fname=="..") continue;
420 res.insert(fname);
421 } while (FindNextFile(hf, &data));
422 FindClose(hf);
423 }
424#endif
425 return res;
426}
427
428
429// Test file
430bool FileExists(const std::string& rFilename) {
431 std::fstream fp;
432 fp.open(rFilename.c_str(), std::ios::in | std::ios::binary);
433 return fp.good();
434}
435
436// Delete file
437bool FileDelete(const std::string& rFilename) {
438 return remove(rFilename.c_str()) == 0;
439}
440
441// Copy file
442bool FileCopy(const std::string& rFromFile, const std::string& rToFile) {
443 std::ifstream froms(rFromFile.c_str(), std::ios::binary);
444 std::ofstream tos(rToFile.c_str(), std::ios::binary);
445 tos << froms.rdbuf();
446 tos.flush();
447 return !(froms.fail() || tos.fail());
448}
449
450// ConsoleOut class
451// Note: console-out is not re-entrant; for multithreaded applications
452// you must derive a class that has built-in mutexes;
453ConsoleOut::ConsoleOut(void) : pStream(NULL), mVerb(1) {
454 pInstance=this;
455}
457 if(pStream) { pStream->flush(); delete pStream; }
458 if(this==smpInstance) smpInstance=NULL;
459}
471void ConsoleOut::ToFile(const std::string& filename) {
472 if(pStream) { pStream->flush(); delete pStream; }
473 pStream=NULL;
474 mFilename=filename;
475 if(mFilename=="") return;
476 pStream = new std::ofstream();
477 pStream->open(mFilename.c_str(),std::ios::app);
478}
480 return pStream!=NULL;
481}
482void ConsoleOut::Write(const std::string& message,long int cntnow, long int cntdone, int verb) {
483 DoWrite(message,cntnow,cntdone,verb);
484}
485void ConsoleOut::DoWrite(const std::string& message,long int cntnow, long int cntdone, int verb) {
486 (void) cntnow; (void) cntdone;
487 if(mVerb<verb) return;
488 std::ostream* sout=pStream;
489 if(!sout) sout=&std::cout; // tmoor: used to be std::cerr, using std::cout to facilitate emscripten/js
490 *sout << message;
491 sout->flush();
492}
493
494// global instance
496
497/** API wrapper Print at verbosity */
498void Print(int v, const std::string& message) {
499 // print
500 std::ostringstream line;
501 line << "FAUDES_PRINT: " << message << std::endl;
502 faudes::ConsoleOut::G()->Write(line.str(),0,0,v);
503 // still do loop callback
504 LoopCallback();
505}
506void Print(const std::string& message) {
507 Print(1,message);
508}
509
510/** API wrapper get/set verbosity */
511void Verbosity(int v) {
513}
514int Verbosity(void) {
515 return faudes::ConsoleOut::G()->Verb();
516}
517
518
519// debugging: objectcount
520std::map<std::string,long int>* ObjectCount::mspMax=NULL;
521std::map<std::string,long int>* ObjectCount::mspCount=NULL;
522bool ObjectCount::msDone=false;
524 mspCount= new std::map<std::string,long int>();
525 mspMax= new std::map<std::string,long int>();
526 msDone=true;
527}
529 if(!msDone) ObjectCount();
530}
531void ObjectCount::Inc(const std::string& rTypeName) {
532 if(!msDone) ObjectCount();
533 long int cnt = ((*mspCount)[rTypeName]+=1);
534 if((*mspMax)[rTypeName]<cnt) (*mspMax)[rTypeName]=cnt;
535}
536void ObjectCount::Dec(const std::string& rTypeName) {
537 if(!msDone) ObjectCount();
538 (*mspCount)[rTypeName]-=1;
539}
540
541
542// debugging: report on exit function
543void ExitFunction(void){
544#ifdef FAUDES_DEBUG_CODE
545 FAUDES_WRITE_DIRECT("faudes::ExitFunction():");
546 // be sure its up and running
548 // get rid of all registry prototypes
549 FAUDES_WRITE_DIRECT("faudes::ExitFunction(): clear registry");
552 // prepare report
553 std::map<std::string,long int>::iterator cit;
554 cit=ObjectCount::mspCount->begin();
555 for(;cit!=ObjectCount::mspCount->end();cit++) {
556 FAUDES_WRITE_DIRECT( cit->first << ": #" << ToStringInteger(cit->second) <<
557 " (max #" << (*ObjectCount::mspMax)[cit->first] << ")");
558 }
559#endif
560}
561
562
563#ifdef FAUDES_DEBUG_CODE
564// report on exit install
565class ExitFunctionInstall {
566private:
567 static bool mDone;
568 static ExitFunctionInstall mInstance;
569 ExitFunctionInstall(void) {
570 if(mDone) return;
571 FAUDES_WRITE_CONSOLE("ExitFunctionInstall()");
572 std::atexit(ExitFunction);
573 mDone=true;
574 }
575};
576// exit function: global data
577bool ExitFunctionInstall::mDone=false;
578ExitFunctionInstall ExitFunctionInstall::mInstance;
579#endif
580
581// test protocol: token writer and file
583std::string gTestProtocolFr;
584
585// test protocol: setup
586std::string TestProtocol(const std::string& rSource) {
588 // set up filename
589 std::string filename=rSource;
590 // fix empty source
591 if(filename=="") filename="faudes_dump";
592 // remove directory
593 filename=ExtractFilename(filename);
594 // remove extension
595 std::string::size_type pos=0;
596 for(;pos<filename.length();pos++)
597 if(filename.at(pos)=='.') filename.at(pos)='_';
598 // append extension
599 filename.append(".prot");
600 // record nominal case
601 gTestProtocolFr=filename;
602 // prepend prefix
603 filename.insert(0,"tmp_");
604 // initialise token writer
605 gTestProtocolTw= new TokenWriter(filename);
606 // report filename
607 return gTestProtocolFr;
608}
609
610// test protocol: dump
611void TestProtocol(const std::string& rMessage, const Type& rData, bool full) {
612 if(!gTestProtocolTw) return;
613 gTestProtocolTw->WriteComment("%%% test mark: " + rMessage);
614 if(full) rData.Write(*gTestProtocolTw);
615 else rData.SWrite(*gTestProtocolTw);
619 *gTestProtocolTw << "\n";
620}
621void TestProtocol(const std::string& rMessage, bool data) {
622 Boolean fbool(data);
623 TestProtocol(rMessage,fbool,true);
624}
625void TestProtocol(const std::string& rMessage, long int data) {
626 Integer fint(data);
627 TestProtocol(rMessage,fint,true);
628}
629void TestProtocol(const std::string& rMessage, const std::string& rData) {
630 String fstr(rData);
631 TestProtocol(rMessage,fstr,true);
632}
633
634// test protocol: compare
635bool TestProtocol(void) {
636 // bail out on no protocol
637 if(!gTestProtocolTw) return true;
638 // close protocol file
639 std::string prot=gTestProtocolTw->FileName();
640 delete gTestProtocolTw;
641 gTestProtocolTw=NULL;
642 // open protocol
643 std::fstream fp;
644 fp.open(prot.c_str(), std::ios::in | std::ios::binary);
645 if(!fp.good()) {
646 FAUDES_WRITE_CONSOLE("TestProtocol(): could not open protocol \"" << prot << "\"");
647 return false;
648 }
649 // open reference
650 std::string ref=gTestProtocolFr;
651 std::fstream fr;
652 fr.open(ref.c_str(), std::ios::in | std::ios::binary);
653 if(!fr.good()) {
654 ref="data"+faudes_pathsep()+ref;
655 fr.clear(); // mingw's runtime will not clear on open
656 fr.open(ref.c_str(), std::ios::in | std::ios::binary);
657 }
658 if(!fr.good()) {
659 FAUDES_WRITE_CONSOLE("TestProtocol(): could not open/find reference \"" << gTestProtocolFr << "\"");
660 return true;
661 }
662 // perform comparision
663 int dline=-1;
664 int cline=1;
665 try{
666 while(true) {
667 // read next char
668 char cp = fp.get();
669 char cr= fr.get();
670 // eof
671 if(fp.eof() && fr.eof()) { break; }
672 if(!fp.good() || !fr.good()) { dline=cline; break;}
673 // cheap normalize cr/lf: ignore \r (assume no double \r
674 if( cp=='\r' && cr =='\r') continue;
675 if( cp=='\r' && fp.eof()){ dline=cline; break;}
676 if( cp=='\r') cp = fp.get();
677 if( cr=='\r' && fr.eof()){ dline=cline; break;}
678 if( cr=='\r') cr = fr.get();
679 // count lines
680 if( cr=='\n') cline++;
681 // sense mitmatch
682 if( cp!= cr ){dline=cline; break;}
683 }
684 } catch(std::ios::failure&) {
685 throw Exception("TestProtocol()", "io error at line " + ToStringInteger(cline), 1);
686 }
687 // done
688 if(dline>=0) {
689 FAUDES_WRITE_CONSOLE("TestProtocol(): using reference " << ref << "");
690 FAUDES_WRITE_CONSOLE("TestProtocol(): found difference at line " << dline << "");
691 }
692 return dline== -1;
693}
694
695
696
697// declare loop callback
698static bool (*gBreakFnct)(void)=0;
699
700// set loop callback
701void LoopCallback( bool pBreak(void)) {
702 gBreakFnct=pBreak;
703}
704
705// do loop callback
706// note: this function is meant to be "quiet" during normal
707// operation in order not to mess up console logging
708void LoopCallback(void){
709 if(!gBreakFnct) return;
710 if(! (*gBreakFnct)() ) return;
711 throw Exception("LoopCallback", "break on application request", 110);
712}
713
714} // namespace faudes
#define FAUDES_WRITE_DIRECT(message)
#define FAUDES_WRITE_CONSOLE(message)
#define FD_DF(message)
const std::string & faudes_pathseps(void)
std::string faudes_extpath(const std::string &rPath)
int faudes_system(const std::string &cmd, const std::string &args)
const std::string & faudes_pathsep(void)
static ConsoleOut * G(void)
ConsoleOut * pInstance
Definition cfl_utils.h:375
std::ofstream * pStream
Definition cfl_utils.h:369
static ConsoleOut * smpInstance
Definition cfl_utils.h:377
virtual void DoWrite(const std::string &message, long int cntnow=0, long int cntdone=0, int verb=1)
virtual ~ConsoleOut(void)
void Verb(int verb)
Definition cfl_utils.h:358
const std::string & Filename(void)
Definition cfl_utils.h:354
virtual void Write(const std::string &message, long int cntnow=0, long int cntdone=0, int verb=1)
std::string mFilename
Definition cfl_utils.h:371
void Redirect(ConsoleOut *out)
void ToFile(const std::string &filename)
static FunctionRegistry * G()
static bool msDone
Definition cfl_utils.h:405
static void Init(void)
static void Inc(const std::string &rTypeName)
static void Dec(const std::string &rTypeName)
static std::map< std::string, long int > * mspCount
Definition cfl_utils.h:403
static std::map< std::string, long int > * mspMax
Definition cfl_utils.h:402
std::string FileName(void) const
void WriteComment(const std::string &rComment)
static TypeRegistry * G()
void Write(const Type *pContext=0) const
void SWrite(TokenWriter &rTw) const
uint32_t Idx
std::string VersionString()
std::string ExtractDirectory(const std::string &rFullPath)
bool DotReady(const std::string &rDotExec)
int Verbosity(void)
std::string PrependPath(const std::string &rLeft, const std::string &rRight)
Idx ToIdx(const std::string &rString)
TokenWriter * gTestProtocolTw
void ProcessDot(const std::string &rDotFile, const std::string &rOutFile, const std::string &rOutFormat, const std::string &rDotExec)
std::string CreateTempFile(void)
bool FileCopy(const std::string &rFromFile, const std::string &rToFile)
void LoopCallback(void)
std::string PluginsString()
std::string ExpandString(const std::string &rString, unsigned int len)
Definition cfl_utils.cpp:81
static bool(* gBreakFnct)(void)=0
std::string BuildString()
bool TestProtocol(void)
bool FileDelete(const std::string &rFilename)
std::string ToStringFloat(Float number)
Definition cfl_utils.cpp:65
std::string ExtractFilename(const std::string &rFullPath)
std::string ToStringInteger16(Int number)
Definition cfl_utils.cpp:55
double Float
std::string ContributorsString()
std::string ToStringInteger(Int number)
Definition cfl_utils.cpp:44
std::set< std::string > ReadDirectory(const std::string &rDirectory)
std::string StringSubstitute(const std::string &rString, const std::string &rFrom, const std::string &rTo)
std::string ToLowerCase(const std::string &rString)
void Print(int v, const std::string &message)
std::string gTestProtocolFr
std::string ExtractBasename(const std::string &rFullPath)
bool DirectoryExists(const std::string &rDirectory)
void ExitFunction(void)
bool FileExists(const std::string &rFilename)
std::string ExtractSuffix(const std::string &rFullPath)
std::string CollapsString(const std::string &rString, unsigned int len)
Definition cfl_utils.cpp:92
long int Int

libFAUDES 2.34g --- 2026.04.08 --- c++ api documentaion by doxygen