fssIO.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2008 Kamil Dudka <xdudka00@stud.fit.vutbr.cz>
00003  *
00004  * This file is part of fss (Fast SAT Solver).
00005  *
00006  * fss is free software: you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation, either version 3 of the License, or
00009  * any later version.
00010  *
00011  * fss is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with fss.  If not, see <http://www.gnu.org/licenses/>.
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   } // namespace StreamDecorator
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 } // namespace FastSatSolver
00154 
00155 #endif // FSS_H

Generated on Wed Nov 5 22:30:21 2008 for Fast SAT Solver by  doxygen 1.5.4