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 
39 
40 namespace faudes {
41 
42 // ToStringInteger(number)
43 std::string ToStringInteger(Int number) {
44  if(number>= std::numeric_limits<Int>::max()) return "inf";
45  if(number<= std::numeric_limits<Int>::min()+1) return "-inf";
46  std::string res;
47  std::stringstream sstr;
48  sstr << number;
49  sstr >> res;
50  return res;
51 }
52 
53 // ToStringInteger16(number)
54 std::string ToStringInteger16(Int number) {
55  std::string res;
56  std::stringstream sstr;
57  sstr << "0x" << std::setbase(16) << number;
58  sstr >> res;
59  return res;
60 }
61 
62 // ToStringFloat(number)
63 // todo: check range, prevent sci notation
64 std::string ToStringFloat(Float number) {
65  if(number>= std::numeric_limits<Float>::max()) return "inf";
66  if(number<= -1*std::numeric_limits<Float>::max()) return "-inf";
67  std::stringstream sstr;
68  if(number == static_cast<Float>( static_cast<Int>(number) )) {
69  sstr << static_cast<Int>(number);
70  } else {
71  sstr << std::fixed;
72  sstr << number;
73  }
74  std::string res;
75  sstr >> res;
76  return res;
77 }
78 
79 // ExpandString(rString, len)
80 std::string ExpandString(const std::string& rString, unsigned int len) {
81  std::string res;
82  res = rString;
83  std::string::size_type xtra = (std::string::size_type) len - rString.length();
84  if ((xtra > 0) && (xtra < 10000)) {
85  res.append(xtra, ' ');
86  }
87  return res;
88 }
89 
90 // CollapseString(rString, len)
91 std::string CollapsString(const std::string& rString, unsigned int len) {
92  if(len <=1) return rString;
93  if(rString.length() <= len) return rString;
94  int chead = len/2;
95  int ctail = len-chead;
96  return rString.substr(0,chead) + "..." + rString.substr(rString.length()-ctail,ctail);
97 }
98 
99 // ToIdx(rString)
100 Idx ToIdx(const std::string& rString) {
101  char * end;
102  unsigned long ul = strtoul (rString.c_str(), &end, 0);
103  unsigned long idxmax = std::numeric_limits<Idx>::max();
104  if(ul > idxmax) {
105  throw Exception("atoidx", "Idx overflow", 600);
106  }
107  return (Idx) ul;
108 }
109 
110 // ToLOwerCase(rString(
111 std::string ToLowerCase(const std::string& rString) {
112  std::string res=rString;
113  std::transform(res.begin(), res.end(), res.begin(),
114  [](unsigned char c){ return std::tolower(c); });
115  return res;
116 }
117 
118 
119 
120 // String Substitution
121 std::string StringSubstitute(const std::string& rString,const std::string& rFrom,const std::string& rTo) {
122  // prep result
123  std::string res;
124  std::size_t pos=0;
125  // loop over occurences of "from"
126  while(pos<rString.length()) {
127  std::size_t next=rString.find(rFrom,pos);
128  if(next==std::string::npos) break;
129  res.append(rString.substr(pos, next-pos));
130  res.append(rTo);
131  pos=next+rFrom.length();
132  }
133  // get end
134  if(pos<rString.length())
135  res.append(rString.substr(pos));
136  // done
137  return res;
138 }
139 
140 // VersionString()
141 std::string VersionString() {
142  return std::string(FAUDES_VERSION);
143 }
144 
145 // FluginsString()
146 std::string PluginsString() {
147  return std::string(FAUDES_PLUGINS);
148 }
149 
150 // ContributorsString()
151 std::string ContributorsString() {
152  return
153  "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";
154 }
155 
156 #define XLITSTR(x) LITSTR(x)
157 #define LITSTR(x) #x
158 
159 // ContributorsString()
160 std::string BuildString() {
161  std::string res;
162 #ifdef FAUDES_BUILDENV
163  res = res + std::string(XLITSTR(FAUDES_BUILDENV));
164 #else
165  res = res + std::string("generic");
166 #endif
167 #ifdef FAUDES_BUILDTIME
168  res = res + std::string(" ") + std::string(XLITSTR(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)
177 void 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 dotcommand = rDotExec + " -T"+format+" \""+rDotFile+"\" -o \""+rOutFile+"\"";
225  if(system(dotcommand.c_str()) != 0) {
226  throw Exception("faudes::ProcessDot",
227  "Error in running " + dotcommand, 3);
228  }
229 }
230 
231 
232 // test executable
233 bool DotReady(const std::string& rDotExec) {
234  // cache value
235  static bool ready=false;
236  static bool known=false;
237  if(known) return ready;
238  // test for dot binary
239  std::string testdot = rDotExec + " -V";
240  ready = (system(testdot.c_str()) == 0);
241  known = true;
242  return ready;
243 }
244 
245 
246 // CreateTempFile(void)
247 // todo: sys dependant, report, investigate threads
248 std::string CreateTempFile(void) {
249  char filename[]= "faudes_temp_XXXXXX";
250  std::string res;
251 #ifdef FAUDES_POSIX
252  // use mkstemp on recent Posix systems
253  int filedes = -1;
254  filedes= mkstemp(filename);
255  if(filedes==-1) {
256  FD_DF("faudes::CreateTempFile(): error");
257  return res;
258  }
259  close(filedes);
260  res=std::string(filename);
261 #endif
262 #ifdef FAUDES_WINDOWS
263  // mimique mkstemp on Windows/MinGW
264  /*
265  int filedes = -1;
266  #define _S_IREAD 256
267  #define _S_IWRITE 128
268  mktemp(filename);
269  filedes=open(filename,O_RDWR|O_BINARY|O_CREAT|O_EXCL|_O_SHORT_LIVED, _S_IREAD|_S_IWRITE);
270  if(filedes==-1) {
271  FD_DF("faudes::CreateTempFile(): error");
272  return "";
273  }
274  close(filedes);
275  res=std::string(filename);
276  */
277  // win32 API
278  char* tmpname = _mktemp(filename);
279  FILE* file;
280  if(tmpname==NULL) {
281  FD_DF("faudes::CreateTempFile(): error");
282  return res;
283  }
284  fopen_s(&file,tmpname,"w");
285  if(file==NULL) {
286  FD_DF("faudes::CreateTempFile(): error");
287  return "";
288  }
289  fclose(file);
290  res=std::string(tmpname);
291 #endif
292  FD_DF("faudes::CreateTempFile(): " << res);
293  return(res);
294 }
295 
296 // ExtractPath
297 std::string ExtractDirectory(const std::string& rFullPath) {
298  std::string res="";
299  std::size_t seppos = rFullPath.find_last_of(faudes_pathseps());
300  if(seppos==std::string::npos) return res;
301  res=rFullPath.substr(0,seppos+1);
302  return res;
303 }
304 
305 // ExtractFilename
306 std::string ExtractFilename(const std::string& rFullPath) {
307  std::string res=rFullPath;
308  std::size_t seppos = rFullPath.find_last_of(faudes_pathseps());
309  if(seppos==std::string::npos) return res;
310  res=rFullPath.substr(seppos+1);
311  return res;
312 }
313 
314 // ExtractBasename
315 std::string ExtractBasename(const std::string& rFullPath) {
316  std::string res=rFullPath;
317  std::size_t seppos = res.find_last_of(faudes_pathseps());
318  if(seppos!=std::string::npos) {
319  res=res.substr(seppos+1);
320  }
321  std::size_t dotpos = res.find_last_of(".");
322  if(dotpos!=std::string::npos) {
323  res=res.substr(0,dotpos);
324  }
325  return res;
326 }
327 
328 // ExtractSuffix
329 std::string ExtractSuffix(const std::string& rFullPath) {
330  std::string res=rFullPath;
331  std::size_t seppos = res.find_last_of(faudes_pathseps());
332  if(seppos!=std::string::npos) {
333  res=res.substr(seppos+1);
334  }
335  std::size_t dotpos = res.find_last_of(".");
336  if(dotpos!=std::string::npos)
337  if(dotpos +1 < res.size()) {
338  return res.substr(dotpos+1,res.size()-dotpos-1);
339  }
340  return std::string();
341 }
342 
343 // PrependPath
344 std::string PrependPath(const std::string& rLeft, const std::string& rRight) {
345  // bail out in trivial args
346  if(rLeft=="")
347  return std::string(rRight);
348  if(rRight=="")
349  return std::string(rLeft);
350  // system default
351  char sepchar=faudes_pathsep().at(0);
352  // user overwrite by left argument
353  std::size_t seppos;
354  seppos=rLeft.find_last_of(faudes_pathseps());
355  if(seppos!=std::string::npos)
356  sepchar=rLeft.at(seppos);
357  // go doit
358  std::string res=rLeft;
359  if(res.at(res.length()-1)!=sepchar)
360  res.append(1,sepchar);
361  if(rRight.at(0)!=sepchar){
362  res.append(rRight);
363  return res;
364  }
365  if(rRight.length()<=1) {
366  return res;
367  }
368  res.append(rRight,1,std::string::npos);
369  return res;
370 }
371 
372 // Test directory
373 bool DirectoryExists(const std::string& rDirectory) {
374 #ifdef FAUDES_POSIX
375  DIR *thedir;
376  thedir=opendir(rDirectory.c_str());
377  if(thedir) closedir(thedir);
378  return thedir!= 0;
379 #endif
380 #ifdef FAUDES_WINDOWS
381  DWORD fattr = GetFileAttributesA(faudes_extpath(rDirectory).c_str());
382  return
383  (fattr!=INVALID_FILE_ATTRIBUTES) && (fattr & FILE_ATTRIBUTE_DIRECTORY);
384 #endif
385  return false;
386 }
387 
388 // scan directory
389 std::set< std::string > ReadDirectory(const std::string& rDirectory) {
390  std::set< std::string > res;
391 #ifdef FAUDES_POSIX
392  DIR *thedir;
393  struct dirent *theent;
394  thedir=opendir(rDirectory.c_str());
395  if(!thedir) return res;
396  while((theent=readdir(thedir))) {
397  std::string fname(theent->d_name);
398  if(fname==".") continue;
399  if(fname=="..") continue;
400  res.insert(fname);
401  }
402  closedir(thedir);
403 #endif
404 #ifdef FAUDES_WINDOWS
405  HANDLE hf;
406  WIN32_FIND_DATA data;
407  hf = FindFirstFile((rDirectory+"\\*.*").c_str(), &data);
408  if (hf != INVALID_HANDLE_VALUE) {
409  do {
410  std::string fname(data.cFileName);
411  if(fname==".") continue;
412  if(fname=="..") continue;
413  res.insert(fname);
414  } while (FindNextFile(hf, &data));
415  FindClose(hf);
416  }
417 #endif
418  return res;
419 }
420 
421 
422 
423 
424 
425 // Test file
426 bool FileExists(const std::string& rFilename) {
427  std::fstream fp;
428  fp.open(rFilename.c_str(), std::ios::in | std::ios::binary);
429  return fp.good();
430 }
431 
432 // Delete file
433 bool FileDelete(const std::string& rFilename) {
434  return remove(rFilename.c_str()) == 0;
435 }
436 
437 // Copy file
438 bool FileCopy(const std::string& rFromFile, const std::string& rToFile) {
439  std::ifstream froms(rFromFile.c_str(), std::ios::binary);
440  std::ofstream tos(rToFile.c_str(), std::ios::binary);
441  tos << froms.rdbuf();
442  tos.flush();
443  return !(froms.fail() || tos.fail());
444 }
445 
446 // ConsoleOut class
447 // Note: console-out is not re-entrant; for multithreaded applications
448 // you must derive a class that has built-in mutexes;
449 ConsoleOut::ConsoleOut(void) : pStream(NULL), mVerb(1) {
450  pInstance=this;
451 }
453  if(pStream) { pStream->flush(); delete pStream; }
454  if(this==smpInstance) smpInstance=NULL;
455 }
457  if(!smpInstance) smpInstance= new ConsoleOut();
458  return smpInstance->pInstance;
459 }
461  std::string fname = smpInstance->pInstance->Filename();
463  smpInstance->pInstance=out;
465  smpInstance->pInstance->ToFile(fname);
466 }
467 void ConsoleOut::ToFile(const std::string& filename) {
468  if(pStream) { pStream->flush(); delete pStream; }
469  pStream=NULL;
470  mFilename=filename;
471  if(mFilename=="") return;
472  pStream = new std::ofstream();
473  pStream->open(mFilename.c_str(),std::ios::app);
474 }
475 void ConsoleOut::Write(const std::string& message,long int cntnow, long int cntdone, int verb) {
476  DoWrite(message,cntnow,cntdone,verb);
477 }
478 void ConsoleOut::DoWrite(const std::string& message,long int cntnow, long int cntdone, int verb) {
479  (void) cntnow; (void) cntdone;
480  if(mVerb<verb) return;
481  std::ostream* sout=pStream;
482  if(!sout) sout=&std::cout; // tmoor: used to be std::cerr, using std::cout to facilitate emscripten/js
483  *sout << message;
484  sout->flush();
485 }
486 
487 // global instance
489 
490 /** API wrapper Print at verbosity */
491 void Print(int v, const std::string& message) {
492  // print
493  std::ostringstream line;
494  line << "FAUDES_PRINT: " << message << std::endl;
495  faudes::ConsoleOut::G()->Write(line.str(),0,0,v);
496  // still do loop callback
497  LoopCallback();
498 }
499 void Print(const std::string& message) {
500  Print(1,message);
501 }
502 
503 /** API wrapper get/set verbosity */
504 void Verbosity(int v) {
506 }
507 int Verbosity(void) {
508  return faudes::ConsoleOut::G()->Verb();
509 }
510 
511 
512 // debugging: objectcount
513 std::map<std::string,long int>* ObjectCount::mspMax=NULL;
514 std::map<std::string,long int>* ObjectCount::mspCount=NULL;
515 bool ObjectCount::msDone=false;
517  mspCount= new std::map<std::string,long int>();
518  mspMax= new std::map<std::string,long int>();
519  msDone=true;
520 }
521 void ObjectCount::Init(void) {
522  if(!msDone) ObjectCount();
523 }
524 void ObjectCount::Inc(const std::string& rTypeName) {
525  if(!msDone) ObjectCount();
526  long int cnt = ((*mspCount)[rTypeName]+=1);
527  if((*mspMax)[rTypeName]<cnt) (*mspMax)[rTypeName]=cnt;
528 }
529 void ObjectCount::Dec(const std::string& rTypeName) {
530  if(!msDone) ObjectCount();
531  (*mspCount)[rTypeName]-=1;
532 }
533 
534 
535 // debugging: report on exit function
536 void ExitFunction(void){
537 #ifdef FAUDES_DEBUG_CODE
538  FAUDES_WRITE_CONSOLE("faudes::ExitFunction():");
539  // be sure its up and running
541  // get rid of all registry prototypes
542  //TypeRegistry::G()->ClearAll();
543  //FunctionRegistry::G()->Clear();
544  // prepare report
545  std::map<std::string,long int>::iterator cit;
546  cit=ObjectCount::mspCount->begin();
547  for(;cit!=ObjectCount::mspCount->end();cit++) {
548  FAUDES_WRITE_CONSOLE( cit->first << ": #" << ToStringInteger(cit->second) <<
549  " (max #" << (*ObjectCount::mspMax)[cit->first] << ")");
550  }
551 #endif
552 }
553 
554 
555 #ifdef FAUDES_DEBUG_CODE
556 // report on exit install
557 class ExitFunctionInstall {
558 private:
559  static bool mDone;
560  static ExitFunctionInstall mInstance;
561  ExitFunctionInstall(void) {
562  if(mDone) return;
563  FAUDES_WRITE_CONSOLE("ExitFunctionInstall()");
564  std::atexit(ExitFunction);
565  mDone=true;
566  }
567 };
568 // exit function: global data
569 bool ExitFunctionInstall::mDone=false;
570 ExitFunctionInstall ExitFunctionInstall::mInstance;
571 #endif
572 
573 // test protocol: token writer and file
575 std::string gTestProtocolFr;
576 
577 // test protocol: setup
578 std::string TestProtocol(const std::string& rSource) {
579  if(gTestProtocolTw) return gTestProtocolFr;
580  // set up filename
581  std::string filename=rSource;
582  // fix empty source
583  if(filename=="") filename="faudes_dump";
584  // remove directory
585  filename=ExtractFilename(filename);
586  // remove extension
587  std::string::size_type pos=0;
588  for(;pos<filename.length();pos++)
589  if(filename.at(pos)=='.') filename.at(pos)='_';
590  // append extension
591  filename.append(".prot");
592  // record nominal case
593  gTestProtocolFr=filename;
594  // prepend prefix
595  filename.insert(0,"tmp_");
596  // initialise token writer
597  gTestProtocolTw= new TokenWriter(filename);
598  // report filename
599  return gTestProtocolFr;
600 }
601 
602 // test protocol: dump
603 void TestProtocol(const std::string& rMessage, const Type& rData, bool full) {
604  if(!gTestProtocolTw) return;
605  gTestProtocolTw->WriteComment("%%% test mark: " + rMessage);
606  if(full) rData.Write(*gTestProtocolTw);
607  else rData.SWrite(*gTestProtocolTw);
611  *gTestProtocolTw << "\n";
612 }
613 void TestProtocol(const std::string& rMessage, bool data) {
614  Boolean fbool(data);
615  TestProtocol(rMessage,fbool,true);
616 }
617 void TestProtocol(const std::string& rMessage, long int data) {
618  Integer fint(data);
619  TestProtocol(rMessage,fint,true);
620 }
621 void TestProtocol(const std::string& rMessage, const std::string& rData) {
622  String fstr(rData);
623  TestProtocol(rMessage,fstr,true);
624 }
625 
626 // test protocol: compare
627 bool TestProtocol(void) {
628  // bail out on no protocol
629  if(!gTestProtocolTw) return true;
630  // close protocol file
631  std::string prot=gTestProtocolTw->FileName();
632  delete gTestProtocolTw;
633  gTestProtocolTw=NULL;
634  // open protocol
635  std::fstream fp;
636  fp.open(prot.c_str(), std::ios::in | std::ios::binary);
637  if(!fp.good()) {
638  FAUDES_WRITE_CONSOLE("TestProtocol(): could not open protocol \"" << prot << "\"");
639  return false;
640  }
641  // open reference
642  std::string ref=gTestProtocolFr;
643  std::fstream fr;
644  fr.open(ref.c_str(), std::ios::in | std::ios::binary);
645  if(!fr.good()) {
646  ref="data"+faudes_pathsep()+ref;
647  fr.clear(); // mingw's runtime will not clear on open
648  fr.open(ref.c_str(), std::ios::in | std::ios::binary);
649  }
650  if(!fr.good()) {
651  FAUDES_WRITE_CONSOLE("TestProtocol(): could not open/find reference \"" << gTestProtocolFr << "\"");
652  return true;
653  }
654  // perform comparision
655  int dline=-1;
656  int cline=1;
657  try{
658  while(true) {
659  // read next char
660  char cp = fp.get();
661  char cr= fr.get();
662  // eof
663  if(fp.eof() && fr.eof()) { break; }
664  if(!fp.good() || !fr.good()) { dline=cline; break;}
665  // cheap normalize cr/lf: ignore \r (assume no double \r
666  if( cp=='\r' && cr =='\r') continue;
667  if( cp=='\r' && fp.eof()){ dline=cline; break;}
668  if( cp=='\r') cp = fp.get();
669  if( cr=='\r' && fr.eof()){ dline=cline; break;}
670  if( cr=='\r') cr = fr.get();
671  // count lines
672  if( cr=='\n') cline++;
673  // sense mitmatch
674  if( cp!= cr ){dline=cline; break;}
675  }
676  } catch(std::ios::failure&) {
677  throw Exception("TestProtocol()", "io error at line " + ToStringInteger(cline), 1);
678  }
679  // done
680  if(dline>=0) {
681  FAUDES_WRITE_CONSOLE("TestProtocol(): using reference " << ref << "");
682  FAUDES_WRITE_CONSOLE("TestProtocol(): found difference at line " << dline << "");
683  }
684  return dline== -1;
685 }
686 
687 
688 
689 // declare loop callback
690 static bool (*gBreakFnct)(void)=0;
691 
692 // set loop callback
693 void LoopCallback( bool pBreak(void)) {
694  gBreakFnct=pBreak;
695 }
696 
697 // do loop callback
698 // note: this function is meant to be "quiet" during normal
699 // operation in order not to mess up console logging
700 void LoopCallback(void){
701  if(!gBreakFnct) return;
702  if(! (*gBreakFnct)() ) return;
703  throw Exception("LoopCallback", "break on application request", 110);
704 }
705 
706 } // namespace faudes
#define FAUDES_WRITE_CONSOLE(message)
#define FD_DF(message)
const std::string & faudes_pathseps(void)
const std::string & faudes_pathsep(void)
std::string faudes_extpath(const std::string &rPath)
#define XLITSTR(x)
Definition: cfl_utils.cpp:156
static ConsoleOut * G(void)
Definition: cfl_utils.cpp:456
ConsoleOut * pInstance
Definition: cfl_utils.h:374
std::ofstream * pStream
Definition: cfl_utils.h:368
static ConsoleOut * smpInstance
Definition: cfl_utils.h:376
virtual void DoWrite(const std::string &message, long int cntnow=0, long int cntdone=0, int verb=1)
Definition: cfl_utils.cpp:478
virtual ~ConsoleOut(void)
Definition: cfl_utils.cpp:452
const std::string & Filename(void)
Definition: cfl_utils.h:353
void Verb(int verb)
Definition: cfl_utils.h:357
virtual void Write(const std::string &message, long int cntnow=0, long int cntdone=0, int verb=1)
Definition: cfl_utils.cpp:475
std::string mFilename
Definition: cfl_utils.h:370
void Redirect(ConsoleOut *out)
Definition: cfl_utils.cpp:460
void ToFile(const std::string &filename)
Definition: cfl_utils.cpp:467
static bool msDone
Definition: cfl_utils.h:404
static void Init(void)
Definition: cfl_utils.cpp:521
static void Inc(const std::string &rTypeName)
Definition: cfl_utils.cpp:524
static void Dec(const std::string &rTypeName)
Definition: cfl_utils.cpp:529
static std::map< std::string, long int > * mspCount
Definition: cfl_utils.h:402
static std::map< std::string, long int > * mspMax
Definition: cfl_utils.h:401
std::string FileName(void) const
void WriteComment(const std::string &rComment)
void Write(const Type *pContext=0) const
Definition: cfl_types.cpp:145
void SWrite(TokenWriter &rTw) const
Definition: cfl_types.cpp:262
uint32_t Idx
std::string VersionString()
Definition: cfl_utils.cpp:141
std::string ExtractDirectory(const std::string &rFullPath)
Definition: cfl_utils.cpp:297
bool DotReady(const std::string &rDotExec)
Definition: cfl_utils.cpp:233
void LoopCallback(bool pBreak(void))
Definition: cfl_utils.cpp:693
std::string PrependPath(const std::string &rLeft, const std::string &rRight)
Definition: cfl_utils.cpp:344
Idx ToIdx(const std::string &rString)
Definition: cfl_utils.cpp:100
TokenWriter * gTestProtocolTw
Definition: cfl_utils.cpp:574
void ProcessDot(const std::string &rDotFile, const std::string &rOutFile, const std::string &rOutFormat, const std::string &rDotExec)
Definition: cfl_utils.cpp:177
std::string CreateTempFile(void)
Definition: cfl_utils.cpp:248
bool FileCopy(const std::string &rFromFile, const std::string &rToFile)
Definition: cfl_utils.cpp:438
std::string PluginsString()
Definition: cfl_utils.cpp:146
std::string ExpandString(const std::string &rString, unsigned int len)
Definition: cfl_utils.cpp:80
static bool(* gBreakFnct)(void)=0
Definition: cfl_utils.cpp:690
std::string BuildString()
Definition: cfl_utils.cpp:160
bool FileDelete(const std::string &rFilename)
Definition: cfl_utils.cpp:433
std::string ToStringFloat(Float number)
Definition: cfl_utils.cpp:64
std::string ExtractFilename(const std::string &rFullPath)
Definition: cfl_utils.cpp:306
std::string ToStringInteger16(Int number)
Definition: cfl_utils.cpp:54
double Float
std::string ContributorsString()
Definition: cfl_utils.cpp:151
std::string ToStringInteger(Int number)
Definition: cfl_utils.cpp:43
std::set< std::string > ReadDirectory(const std::string &rDirectory)
Definition: cfl_utils.cpp:389
void Verbosity(int v)
Definition: cfl_utils.cpp:504
std::string StringSubstitute(const std::string &rString, const std::string &rFrom, const std::string &rTo)
Definition: cfl_utils.cpp:121
std::string ToLowerCase(const std::string &rString)
Definition: cfl_utils.cpp:111
void Print(int v, const std::string &message)
Definition: cfl_utils.cpp:491
std::string gTestProtocolFr
Definition: cfl_utils.cpp:575
std::string ExtractBasename(const std::string &rFullPath)
Definition: cfl_utils.cpp:315
bool DirectoryExists(const std::string &rDirectory)
Definition: cfl_utils.cpp:373
std::string TestProtocol(const std::string &rSource)
Definition: cfl_utils.cpp:578
void ExitFunction(void)
Definition: cfl_utils.cpp:536
bool FileExists(const std::string &rFilename)
Definition: cfl_utils.cpp:426
std::string ExtractSuffix(const std::string &rFullPath)
Definition: cfl_utils.cpp:329
std::string CollapsString(const std::string &rString, unsigned int len)
Definition: cfl_utils.cpp:91
long int Int

libFAUDES 2.33l --- 2025.09.16 --- c++ api documentaion by doxygen