vypIO.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 vyp08 (compiler and interpreter of VYP08 language).
00005  *
00006  * vyp08 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  * vyp08 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 vyp08.  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 
00060     class Color {
00061         public:
00066             Color(EColor color = C_NO_COLOR);
00067             Color(const Color &);
00068             ~Color();
00073             static void enable(bool);
00077             static bool isEnabled();
00078         private:
00079             Color& operator= (const Color &);
00080             static bool useColors;
00081             struct Private;
00082             Private *d;
00083             friend std::ostream& operator<< (std::ostream &, const Color &);
00084     };
00086     std::ostream& operator<< (std::ostream &, const Color &);
00087 
00089     enum EError {
00090         E_NO_ERROR = 0,                                 
00091         E_ERROR,                                        
00092         E_WARNING,                                      
00093         E_NOTE,                                         
00094     };
00095 
00097     class Error {
00098         public:
00100             Error(
00101                 EError          type,                   
00102                 std::string     file,                   
00103                 std::string     msg,                    
00104                 int             lineno = 0,             
00105                 std::string     category = std::string(),   
00106                 Token           token = Token());       
00107 
00109             Error(
00110                 EError          type,                   
00111                 std::string     file,                   
00112                 std::string     msg,                    
00113                 Token           token,                  
00114                 bool            internal = false);      
00115             ~Error();
00116         private:
00117             Color& operator= (const Color &);
00118             struct Private;
00119             Private *d;
00120             friend std::ostream& operator<< (std::ostream &, const Error &);
00121     };
00123     std::ostream& operator<< (std::ostream &, const Error &);
00124 
00125 } // namespace StreamDecorator
00126 
00127 #endif /* VYPIO_H */

Generated on Sat Jul 4 18:32:59 2009 for vyp08 (compiler and interpreter of VYP08 language) by  doxygen 1.5.4