robIO.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 rob08
00005  *
00006  * rob08 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  * rob08 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 rob08.  If not, see <http://www.gnu.org/licenses/>.
00018  */
00019 
00020 #ifndef VYPIO_H
00021 #define VYPIO_H
00022 
00023 #include "config.h"
00024 #include "scanner.h"
00025 
00026 #ifndef BUILDING_DOX
00027 #   include <iostream>
00028 #   include <string>
00029 #endif
00030 
00035 namespace StreamDecorator {
00037     enum EColor {
00038         C_NO_COLOR = 0,
00039         C_BLUE,
00040         C_GREEN,
00041         C_CYAN,
00042         C_RED,
00043         C_PURPLE,
00044         C_BROWN,
00045         C_LIGHT_GRAY,
00046         C_DARK_GRAY,
00047         C_LIGHT_BLUE,
00048         C_LIGHT_GREEN,
00049         C_LIGHT_CYAN,
00050         C_LIGHT_RED,
00051         C_LIGHT_PURPLE,
00052         C_YELLOW,
00053         C_WHITE
00054     };
00055 
00056     class PrintHex {
00057         public:
00058             PrintHex(unsigned number, unsigned width);
00059             PrintHex(const PrintHex &);
00060             ~PrintHex();
00061         private:
00062             PrintHex& operator= (const PrintHex &);
00063             struct Private;
00064             Private *d;
00065             friend std::ostream& operator<< (std::ostream &, const PrintHex &);
00066     };
00068     std::ostream& operator<< (std::ostream &, const PrintHex &);
00069 
00074     class Color {
00075         public:
00080             Color(EColor color = C_NO_COLOR);
00081             Color(const Color &);
00082             ~Color();
00087             static void enable(bool);
00091             static bool isEnabled();
00092         private:
00093             Color& operator= (const Color &);
00094             static bool useColors;
00095             struct Private;
00096             Private *d;
00097             friend std::ostream& operator<< (std::ostream &, const Color &);
00098     };
00100     std::ostream& operator<< (std::ostream &, const Color &);
00101 
00103     enum EError {
00104         E_NO_ERROR = 0,                                 
00105         E_ERROR,                                        
00106         E_WARNING,                                      
00107         E_NOTE,                                         
00108     };
00109 
00111     class Error {
00112         public:
00114             Error(
00115                 EError          type,                   
00116                 std::string     file,                   
00117                 std::string     msg,                    
00118                 int             lineno = 0,             
00119                 std::string     category = std::string(),   
00120                 Token           token = Token());       
00121 
00123             Error(
00124                 EError          type,                   
00125                 std::string     file,                   
00126                 std::string     msg,                    
00127                 Token           token,                  
00128                 bool            internal = false);      
00129             ~Error();
00130         private:
00131             Color& operator= (const Color &);
00132             struct Private;
00133             Private *d;
00134             friend std::ostream& operator<< (std::ostream &, const Error &);
00135     };
00137     std::ostream& operator<< (std::ostream &, const Error &);
00138 
00139 } // namespace StreamDecorator
00140 
00141 #endif /* VYPIO_H */

Generated on Fri Jul 10 22:42:01 2009 for rob08 by  doxygen 1.5.4