00001 00007 /* 00008 Copyright (C) 1999 Anders Hedstrom 00009 00010 This program is free software; you can redistribute it and/or 00011 modify it under the terms of the GNU General Public License 00012 as published by the Free Software Foundation; either version 2 00013 of the License, or (at your option) any later version. 00014 00015 This program is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU General Public License for more details. 00019 00020 You should have received a copy of the GNU General Public License 00021 along with this program; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00023 */ 00024 00025 #ifndef _PARSE_H 00026 #define _PARSE_H 00027 00028 #include <string> 00029 00030 /***************************************************/ 00031 /* interface of class Parse */ 00032 00034 00035 class Parse 00036 { 00037 public: 00038 Parse(); 00039 Parse(const std::string&); 00040 Parse(const std::string&,const std::string&); 00041 Parse(const std::string&,const std::string&,short); 00042 ~Parse(); 00043 short issplit(char); 00044 void getsplit(void); 00045 void getsplit(std::string&); 00046 std::string getword(void); 00047 void getword(std::string&); 00048 void getword(std::string&,std::string&,int); 00049 std::string getrest(); 00050 void getrest(std::string&); 00051 long getvalue(void); 00052 void setbreak(char); 00053 int getwordlen(void); 00054 int getrestlen(void); 00055 void enablebreak(char c) { 00056 pa_enable = c; 00057 } 00058 void disablebreak(char c) { 00059 pa_disable = c; 00060 } 00061 void getline(void); 00062 void getline(std::string&); 00063 size_t getptr(void) { return pa_the_ptr; } 00064 void EnableQuote(bool b) { pa_quote = b; } 00065 00066 private: 00067 std::string pa_the_str; 00068 std::string pa_splits; 00069 std::string pa_ord; 00070 size_t pa_the_ptr; 00071 char pa_breakchar; 00072 char pa_enable; 00073 char pa_disable; 00074 short pa_nospace; 00075 bool pa_quote; 00076 }; 00077 00078 #endif // _PARSE_H