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