00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef FSSIO_H
00021 #define FSSIO_H
00022
00031 #include <string>
00032 #include <iostream>
00033
00034 namespace FastSatSolver {
00035
00040 class GenericException {
00041 public:
00045 GenericException(std::string text);
00046
00050 std::string getText();
00051
00052 private:
00053 std::string text_;
00054 };
00055
00061 namespace StreamDecorator {
00066 class FixedFloat {
00067 public:
00072 FixedFloat(int integral, int decimal);
00073 ~FixedFloat();
00074 private:
00075 struct Private;
00076 Private *d;
00077 friend std::ostream& operator<< (std::ostream &stream, const FixedFloat &);
00078 };
00082 std::ostream& operator<< (std::ostream &stream, const FixedFloat &);
00083
00088 enum EColor {
00089 C_NO_COLOR = 0,
00090 C_BLUE,
00091 C_GREEN,
00092 C_CYAN,
00093 C_RED,
00094 C_PURPLE,
00095 C_BROWN,
00096 C_LIGHT_GRAY,
00097 C_DARK_GRAY,
00098 C_LIGHT_BLUE,
00099 C_LIGHT_GREEN,
00100 C_LIGHT_CYAN,
00101 C_LIGHT_RED,
00102 C_LIGHT_PURPLE,
00103 C_YELLOW,
00104 C_WHITE
00105 };
00106
00112 class Color {
00113 public:
00118 Color(EColor color = C_NO_COLOR);
00119 Color(const Color &);
00120 ~Color();
00125 static void enable(bool);
00129 static bool isEnabled();
00130 private:
00131 Color& operator= (const Color &);
00132 static bool useColors;
00133 struct Private;
00134 Private *d;
00135 friend std::ostream& operator<< (std::ostream &, const Color &);
00136 };
00140 std::ostream& operator<< (std::ostream &, const Color &);
00141 }
00142
00148 inline void printError(std::string szMsg) {
00149 using namespace StreamDecorator;
00150 std::cerr << Color(C_RED) << "!!! " << Color() << szMsg << std::endl;
00151 }
00152
00153 }
00154
00155 #endif // FSS_H