sources/basics.h

changeset 89
777b2a10b835
parent 88
08ccaf26cffd
child 92
39947c46ed17
equal deleted inserted replaced
88:08ccaf26cffd 89:777b2a10b835
34 #endif 34 #endif
35 35
36 #define MACRO_TO_STRING_2(A) #A 36 #define MACRO_TO_STRING_2(A) #A
37 #define MACRO_TO_STRING(A) MACRO_TO_STRING_2(A) 37 #define MACRO_TO_STRING(A) MACRO_TO_STRING_2(A)
38 38
39 // The Windows SDK appears to use identifiers that conflicts with the identifiers defined in ZFC,
40 // so they have to be put in a namespace.
39 #define BEGIN_ZFC_NAMESPACE namespace zfc { 41 #define BEGIN_ZFC_NAMESPACE namespace zfc {
40 #define END_ZFC_NAMESPACE } 42 #define END_ZFC_NAMESPACE }
41
42 BEGIN_ZFC_NAMESPACE
43
44 class String;
45
46 // -------------------------------------------------------------------------------------------------
47 //
48 enum Color
49 {
50 BLACK,
51 RED,
52 GREEN,
53 YELLOW,
54 BLUE,
55 MAGENTA,
56 CYAN,
57 WHITE,
58 DEFAULT,
59
60 NUM_COLORS
61 };
62 43
63 // Goddamnit, MSVC 44 // Goddamnit, MSVC
64 #ifdef _MSC_VER 45 #ifdef _MSC_VER
65 # define and && 46 # define and &&
66 # define or || 47 # define or ||
83 #define TEXTCOLOR_BrightBlue TEXTCOLOR_Escape "N" 64 #define TEXTCOLOR_BrightBlue TEXTCOLOR_Escape "N"
84 #define TEXTCOLOR_Magenta TEXTCOLOR_Escape "T" 65 #define TEXTCOLOR_Magenta TEXTCOLOR_Escape "T"
85 #define TEXTCOLOR_BrightCyan TEXTCOLOR_Escape "V" 66 #define TEXTCOLOR_BrightCyan TEXTCOLOR_Escape "V"
86 #define TEXTCOLOR_Reset TEXTCOLOR_Escape "-" 67 #define TEXTCOLOR_Reset TEXTCOLOR_Escape "-"
87 68
69 BEGIN_ZFC_NAMESPACE
70
88 template<typename T> 71 template<typename T>
89 T min (T a, T b) 72 T min (T a, T b)
90 { 73 {
91 return (a < b) ? b : a; 74 return (a < b) ? b : a;
92 } 75 }
102 { 85 {
103 return (a < b) ? b : (a > c) ? c : a; 86 return (a < b) ? b : (a > c) ? c : a;
104 } 87 }
105 88
106 struct Exitception {}; 89 struct Exitception {};
90
107 END_ZFC_NAMESPACE 91 END_ZFC_NAMESPACE

mercurial