root/trunk/dep/include/sockets/Parse.h @ 2

Revision 2, 2.5 kB (checked in by yumileroy, 17 years ago)

[svn] * Proper SVN structure

Original author: Neo2003
Date: 2008-10-02 16:23:55-05:00

Line 
1/** \file Parse.h - parse a string
2 **
3 **     Written: 1999-Feb-10 grymse@alhem.net
4 **/
5
6/*
7Copyright (C) 1999-2007  Anders Hedstrom
8
9This library is made available under the terms of the GNU GPL.
10
11If you would like to use this library in a closed-source application,
12a separate license agreement is available. For information about
13the closed-source license agreement for the C++ sockets library,
14please visit http://www.alhem.net/Sockets/license.html and/or
15email license@alhem.net.
16
17This program is free software; you can redistribute it and/or
18modify it under the terms of the GNU General Public License
19as published by the Free Software Foundation; either version 2
20of the License, or (at your option) any later version.
21
22This program is distributed in the hope that it will be useful,
23but WITHOUT ANY WARRANTY; without even the implied warranty of
24MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25GNU General Public License for more details.
26
27You should have received a copy of the GNU General Public License
28along with this program; if not, write to the Free Software
29Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
30*/
31
32#ifndef _SOCKETS_Parse_H
33#define _SOCKETS_Parse_H
34
35#include "sockets-config.h"
36#ifdef _MSC_VER
37#pragma warning(disable:4514)
38#endif
39
40#include <string>
41
42#ifdef SOCKETS_NAMESPACE
43namespace SOCKETS_NAMESPACE {
44#endif
45
46
47/***************************************************/
48/* interface of class Parse */
49
50/** Splits a string whatever way you want.
51        \ingroup util */
52class Parse
53{
54public:
55        Parse();
56        Parse(const std::string&);
57        Parse(const std::string&,const std::string&);
58        Parse(const std::string&,const std::string&,short);
59        ~Parse();
60        short issplit(const char);
61        void getsplit();
62        void getsplit(std::string&);
63        std::string getword();
64        void getword(std::string&);
65        void getword(std::string&,std::string&,int);
66        std::string getrest();
67        void getrest(std::string&);
68        long getvalue();
69        void setbreak(const char);
70        int getwordlen();
71        int getrestlen();
72        void enablebreak(const char c) {
73                pa_enable = c;
74        }
75        void disablebreak(const char c) {
76                pa_disable = c;
77        }
78        void getline();
79        void getline(std::string&);
80        size_t getptr() { return pa_the_ptr; }
81        void EnableQuote(bool b) { pa_quote = b; }
82
83private:
84        std::string pa_the_str;
85        std::string pa_splits;
86        std::string pa_ord;
87        size_t   pa_the_ptr;
88        char  pa_breakchar;
89        char  pa_enable;
90        char  pa_disable;
91        short pa_nospace;
92        bool  pa_quote;
93};
94
95
96#ifdef SOCKETS_NAMESPACE
97}
98#endif
99
100#endif // _SOCKETS_Parse_H
101
Note: See TracBrowser for help on using the browser.