]> git.stg.codes - stg.git/blobdiff - stglibs/common.lib/common.h
Make fee charging rules inclusive (2 includes 0 and 3 includes fee)
[stg.git] / stglibs / common.lib / common.h
index 971a2e725fffb0b13ce22511ac3d52b8b32cd6e5..ac0911472778ea25e543acd883341a4f2437b7e7 100644 (file)
  */
 
  /*
- $Revision: 1.31 $
- $Date: 2010/11/03 10:26:30 $
+ $Revision: 1.32 $
+ $Date: 2010/11/08 10:11:19 $
  $Author: faust $
  */
 
 #ifndef common_h
 #define common_h
 
+#ifdef __BORLANDC__
+#include <time.h>
+#else
 #include <ctime>
+#endif
 #include <string>
 
-#include "os_int.h"
-#include "stg_const.h"
+#include "stg/os_int.h"
+#include "stg/const.h"
 
 #define STAT_TIME_3         (1)
 #define STAT_TIME_2         (2)
@@ -94,6 +98,15 @@ std::string &   Trim(std::string & val);
 
 std::string     IconvString(const std::string & source, const std::string & from, const std::string & to);
 
+int ParseInt(const std::string & str, int * val);
+int ParseUnsigned(const std::string & str, unsigned * val);
+int ParseIntInRange(const std::string & str, int min, int max, int * val);
+int ParseUnsignedInRange(const std::string & str, unsigned min,
+                         unsigned max, unsigned * val);
+int ParseYesNo(const std::string & str, bool * val);
+
+bool WaitPackets(int sd);
+
 //-----------------------------------------------------------------------------
 template <typename varT>
 int str2x(const std::string & str, varT & x)
@@ -215,10 +228,15 @@ const std::string & unsigned2str(varT x, std::string & s)
 //-----------------------------------------------------------------------------
 int str2x(const std::string & str, int & x);
 int str2x(const std::string & str, unsigned & x);
+int str2x(const std::string & str, long & x);
+int str2x(const std::string & str, unsigned long & x);
+#ifndef WIN32
 int str2x(const std::string & str, long long & x);
 int str2x(const std::string & str, unsigned long long & x);
+#endif
 //-----------------------------------------------------------------------------
 const std::string & x2str(unsigned x, std::string & s);
+const std::string & x2str(unsigned long x, std::string & s);
 const std::string & x2str(unsigned long long x, std::string & s);
 //-----------------------------------------------------------------------------
 char * stg_strptime(const char *, const char *, struct tm *);