csutil/ansiparse.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 2005 by Jorrit Tyberghein 00003 (C) 2005 by Frank Richter 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __CS_CSUTIL_ANSIPARSE_H__ 00021 #define __CS_CSUTIL_ANSIPARSE_H__ 00022 00030 00031 class CS_CRYSTALSPACE_EXPORT csAnsiParser 00032 { 00033 public: 00035 enum Command 00036 { 00038 cmdUnknown, 00040 cmdFormatAttrReset, 00042 cmdFormatAttrEnable, 00044 cmdFormatAttrDisable, 00046 cmdFormatAttrForeground, 00048 cmdFormatAttrBackground 00049 }; 00051 enum CommandClass 00052 { 00054 classNone, 00056 classUnknown, 00058 classFormat 00059 }; 00064 enum FormatAttr 00065 { 00067 attrBold, 00069 attrItalics, 00071 attrUnderline, 00073 attrBlink, 00075 attrReverse, 00077 attrStrikethrough, 00079 attrDim, 00081 attrInvisible 00082 }; 00084 enum FormatColor 00085 { 00087 colNone = -1, 00089 colBlack, 00091 colRed, 00093 colGreen, 00095 colYellow, 00097 colBlue, 00099 colMagenta, 00101 colCyan, 00103 colWhite 00104 }; 00106 struct CommandParams 00107 { 00108 union 00109 { 00111 FormatColor colorVal; 00113 FormatAttr attrVal; 00114 }; 00115 }; 00123 static bool ParseAnsi (const char* str, size_t& ansiCommandLen, 00124 CommandClass& cmdClass, size_t& textLen); 00133 static bool DecodeCommand (const char*& cmd, size_t& cmdLen, 00134 Command& command, CommandParams& commandParams); 00135 }; 00136 00139 #endif // __CS_CSUTIL_ANSIPARSE_H__
Generated for Crystal Space by doxygen 1.4.6