00001
00002
00003
00004 #ifndef _AppUtil_h
00005 #define _AppUtil_h
00006
00007
00008 #include <fstream>
00009 #include <time.h>
00010 #include <string>
00011
00012 using std::string;
00013
00014 #define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
00015
00016 #ifndef MAX
00017 #define MAX(a,b) ((a) > (b) ? (a) : (b))
00018 #endif
00019
00020 #ifndef MIN
00021 #define MIN(a,b) ((a) < (b) ? (a) : (b))
00022 #endif
00023
00024 #define STRING_MAXLEN 32000
00025
00026
00027 class AsciiFile;
00028
00029 bool SearchFile(AsciiFile& File_Cr, string Pat_Cv, string& Line_Cr);
00030 bool SearchFile(AsciiFile& File_Cr, string Pat_Cv, string& Line_Cr,
00031 int& StartLine_ir);
00032 void TimeMark(const char*const Text_pcv, bool PrintDiff_bi = true);
00033 void CreatePath(string Path_Cv);
00034
00035 string ExtractNthWord(int Num_iv, string Line_Cv, bool GetRest_bi = false);
00036 void RemoveLastIf(string& Text_Cr, char Char_cv);
00037 bool RunningFromSystem();
00038
00039 void Delay(int Microsec_iv);
00040
00041 string dec_string(long number);
00042 string hex_string(long number);
00043
00044 #endif