00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 namespace {
00026 inline bool
00027 isws (char c, char const * const wstr)
00028 {
00029 return (strchr(wstr,c) != NULL);
00030 }
00031 }
00032
00033
00034
00035 template <typename Container>
00036 void stringtok(Container &l,string const &s,char const * const ws = " \t\n")
00037 {
00038 const string::size_type S = s.size();
00039 string::size_type i = 0;
00040
00041 while (i < S) {
00042
00043 while ((i < S) && (isws(s[i],ws))) ++i;
00044 if (i == S) return;
00045
00046
00047 string::size_type j = i+1;
00048 while ((j < S) && (!isws(s[j],ws))) ++j;
00049
00050
00051 l.push_back(s.substr(i,j-i));
00052
00053
00054 i = j+1;
00055 }
00056 }
00057
00058 #define OT_INTERFACE_PATH_ABSOLUTE(str) (str.size()>0 && str[0]=='/')
00059 #define OT_INTERFACE_PATH_IS_ROOT(str) (str=='/')
00060
00061 class binaryWriter
00062 {
00063 public:
00064
00065 static void write(ostream &s,const stringstream &str);
00066 static void write(ostream &s,const string &str);
00067 static void write(ostream &s,const char *data,int dataLen);
00068 static void write(ostream &s,int data);
00069 };
00070
00071 class exitHandler
00072 {
00073 private:
00074
00075 public:
00076
00077 exitHandler(void);
00078 ~exitHandler(void);
00079 };
00080
00081
00082 string getUserName(void);
00083
00084
00085 class mutexLockFunction
00086 {
00087 private:
00088
00089 ost::Mutex *m_mutex;
00090
00091
00092 public:
00093
00094 mutexLockFunction(ost::Mutex *mutex);
00095 ~mutexLockFunction(void);
00096 };
00097
00098 #define FUNCTION_CRITICAL mutexLockFunction mutexLockFunctionLock(this);