Common.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //---------------------------------------------------------------------------
  2. #ifndef CommonH
  3. #define CommonH
  4. #ifndef C_ONLY
  5. //---------------------------------------------------------------------------
  6. //!!!#include <Controls.hpp>
  7. //---------------------------------------------------------------------------
  8. #define CATCH(command) \
  9. try {command;} catch (Exception &E) {ShowExtendedException(&E);}
  10. #define EXCEPTION throw ExtException(NULL, "")
  11. #define SCOPY(dest, source) \
  12. strncpy(dest, source, sizeof(dest)); \
  13. dest[sizeof(dest)-1] = '\0'
  14. #define SAFE_DESTROY(OBJ) { TObject * PObj = OBJ; OBJ = NULL; delete PObj; }
  15. #define ASCOPY(dest, source) SCOPY(dest, source.c_str())
  16. #define FORMAT(S, F) Format(S, ARRAYOFCONST(F))
  17. #define FMTLOAD(I, F) FmtLoadStr(I, ARRAYOFCONST(F))
  18. #define LENOF(x) ( (sizeof((x))) / (sizeof(*(x))))
  19. //---------------------------------------------------------------------------
  20. extern const char EngShortMonthNames[12][4];
  21. //---------------------------------------------------------------------------
  22. AnsiString ReplaceChar(AnsiString Str, Char A, Char B);
  23. AnsiString DeleteChar(AnsiString Str, Char C);
  24. void PackStr(AnsiString &Str);
  25. AnsiString GetTemporaryPath();
  26. AnsiString MakeValidFileName(AnsiString FileName);
  27. AnsiString RootKeyToStr(HKEY RootKey);
  28. AnsiString BooleanToStr(bool B);
  29. AnsiString BooleanToEngStr(bool B);
  30. AnsiString CutToChar(AnsiString &Str, Char Ch, bool Trim);
  31. AnsiString ExceptionLogString(Exception *E);
  32. bool IsDots(const AnsiString Str);
  33. AnsiString __fastcall SystemTemporaryDirectory();
  34. AnsiString __fastcall StripPathQuotes(const AnsiString Path);
  35. AnsiString __fastcall AddPathQuotes(AnsiString Path);
  36. void __fastcall SplitCommand(AnsiString Command, AnsiString &Program,
  37. AnsiString & Params, AnsiString & Dir);
  38. AnsiString __fastcall FormatCommand(AnsiString Program, AnsiString Params);
  39. //void SplitText(const AnsiString Value, TStrings *Strings, Char Separator);
  40. //---------------------------------------------------------------------------
  41. #endif
  42. //---------------------------------------------------------------------------
  43. #include <assert.h>
  44. #ifndef _DEBUG
  45. #undef assert
  46. #define assert(p) ((void)0)
  47. #endif
  48. //---------------------------------------------------------------------------
  49. #endif