copasi API
0.1
|
00001 /* Begin CVS Header 00002 $Source: /fs/turing/cvs/copasi_dev/copasi/utilities/utility.h,v $ 00003 $Revision: 1.24 $ 00004 $Name: Build-33 $ 00005 $Author: shoops $ 00006 $Date: 2010/07/16 19:06:33 $ 00007 End CVS Header */ 00008 00009 // Copyright (C) 2010 by Pedro Mendes, Virginia Tech Intellectual 00010 // Properties, Inc., University of Heidelberg, and The University 00011 // of Manchester. 00012 // All rights reserved. 00013 00014 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual 00015 // Properties, Inc., EML Research, gGmbH, University of Heidelberg, 00016 // and The University of Manchester. 00017 // All rights reserved. 00018 00019 // Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual 00020 // Properties, Inc. and EML Research, gGmbH. 00021 // All rights reserved. 00022 00023 #ifndef COPASI_utilities 00024 #define COPASI_utilities 00025 00026 #include <string> 00027 #include <string.h> 00028 // #include <stdio.h> 00029 #include <stdarg.h> 00030 00031 #define INITIALTEXTSIZE 1024 00032 00033 struct tm; 00034 00038 std::string ISODateTime(tm * pTime); 00039 00043 std::string LocalTimeStamp(); 00044 00048 std::string UTCTimeStamp(); 00049 00055 bool isNumber(const std::string & str); 00056 00063 std::string StringPrint(const char * format, ...); 00064 00072 std::string unQuote(const std::string & name); 00073 00084 std::string quote(const std::string & name, 00085 const std::string & additionalEscapes = ""); 00086 00087 /* 00088 * Fixes a string to be a SName element from SBML 00089 * (this is a destructive function, some changes are irreversible) 00090 * 00091 */ 00092 void FixSName(const std::string &original, std::string &fixed) 00093 ; 00094 00095 /* 00096 * Fixes a string to a XHTML valid equivalent 00097 */ 00098 void FixXHTML(const std::string &original, std::string &fixed) 00099 ; 00100 00110 template <class CType> CType toEnum(const char * attribute, 00111 const char ** enumNames, 00112 const CType & enumDefault) 00113 { 00114 if (!attribute) return enumDefault; 00115 00116 for (int i = 0; *enumNames; i++, enumNames++) 00117 if (!strcmp(attribute, *enumNames)) return static_cast< CType >(i); 00118 00119 return enumDefault; 00120 } 00121 00129 std::string utf8ToLocale(const std::string & utf8); 00130 00138 std::string localeToUtf8(const std::string & locale); 00139 00146 double strToDouble(const char * str, 00147 char const ** pTail = NULL); 00148 00149 #endif // COPASI_utilities