Logo
~Sockets~
~Examples~
~Contact~


Parse.h

Go to the documentation of this file.
00001 
00006 /*
00007 Copyright (C) 1999-2007  Anders Hedstrom
00008 
00009 This library is made available under the terms of the GNU GPL.
00010 
00011 If you would like to use this library in a closed-source application,
00012 a separate license agreement is available. For information about 
00013 the closed-source license agreement for the C++ sockets library,
00014 please visit http://www.alhem.net/Sockets/license.html and/or
00015 email license@alhem.net.
00016 
00017 This program is free software; you can redistribute it and/or
00018 modify it under the terms of the GNU General Public License
00019 as published by the Free Software Foundation; either version 2
00020 of the License, or (at your option) any later version.
00021 
00022 This program is distributed in the hope that it will be useful,
00023 but WITHOUT ANY WARRANTY; without even the implied warranty of
00024 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00025 GNU General Public License for more details.
00026 
00027 You should have received a copy of the GNU General Public License
00028 along with this program; if not, write to the Free Software
00029 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00030 */
00031 
00032 #ifndef _SOCKETS_Parse_H
00033 #define _SOCKETS_Parse_H
00034 
00035 #include "sockets-config.h"
00036 #ifdef _WIN32
00037 #pragma warning(disable:4514)
00038 #endif
00039 
00040 #include <string>
00041 
00042 #ifdef SOCKETS_NAMESPACE
00043 namespace SOCKETS_NAMESPACE {
00044 #endif
00045 
00046 
00047 /***************************************************/
00048 /* interface of class Parse */
00049 
00052 class Parse
00053 {
00054 public:
00055         Parse();
00056         Parse(const std::string&);
00057         Parse(const std::string&,const std::string&);
00058         Parse(const std::string&,const std::string&,short);
00059         ~Parse();
00060         short issplit(const char);
00061         void getsplit();
00062         void getsplit(std::string&);
00063         std::string getword();
00064         void getword(std::string&);
00065         void getword(std::string&,std::string&,int);
00066         std::string getrest();
00067         void getrest(std::string&);
00068         long getvalue();
00069         void setbreak(const char);
00070         int getwordlen();
00071         int getrestlen();
00072         void enablebreak(const char c) {
00073                 pa_enable = c;
00074         }
00075         void disablebreak(const char c) {
00076                 pa_disable = c;
00077         }
00078         void getline();
00079         void getline(std::string&);
00080         size_t getptr() { return pa_the_ptr; }
00081         void EnableQuote(bool b) { pa_quote = b; }
00082 
00083 private:
00084         std::string pa_the_str;
00085         std::string pa_splits;
00086         std::string pa_ord;
00087         size_t   pa_the_ptr;
00088         char  pa_breakchar;
00089         char  pa_enable;
00090         char  pa_disable;
00091         short pa_nospace;
00092         bool  pa_quote;
00093 };
00094 
00095 
00096 #ifdef SOCKETS_NAMESPACE
00097 }
00098 #endif
00099 
00100 #endif // _SOCKETS_Parse_H
Page, code, and content Copyright (C) 2007 by Anders Hedström
Generated for C++ Sockets by  doxygen 1.4.4