acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
parse.h
Go to the documentation of this file.
1
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
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#pragma once
33
34
35//#include "string.h"
36
37// Splits a string whatever way you want.
38
39class CLASS_DECL_ACME parse
40{
41public:
42
43 // publicy made(camilo already xpced a good public, so i said first :-)
44 const_char_pointer m_psz;
45 string pa_splits;
46 string m_strWord;
47 character_count m_iPos;
48 ::i8 pa_breakchar;
49 ::i8 pa_enable;
50 ::i8 pa_disable;
51 ::i16 pa_nospace;
52 bool m_bQuote;
53 character_count m_iLen;
54
55 parse();
56 parse(::character_range < const_char_pointer >range) : parse(range.begin(), range.size(), range.m_erange, range.m_pbasedata) {}
57 parse(::character_range < const_char_pointer >range, ::character_range < const_char_pointer > splits):parse(range.begin(), range.size(), splits, range.m_erange, range.m_pbasedata) {}
58 parse(::character_range < const_char_pointer >range, ::character_range < const_char_pointer > splits, ::i16 nospace):parse(range.begin(), range.size(), splits, nospace, range.m_erange, range.m_pbasedata) {}
59 parse(const_char_pointer psz, character_count iLen, enum_range erange = e_range_none, base_data<ansi_character > * pbasedata = nullptr);
60 parse(const_char_pointer psz, character_count iLen, ::character_range < const_char_pointer > splits, enum_range erange = e_range_none, base_data<ansi_character > * pbasedata = nullptr);
61 parse(const_char_pointer psz, character_count iLen, ::character_range < const_char_pointer > splits, ::i16 nospace, enum_range erange = e_range_none, base_data<ansi_character > * pbasedata = nullptr);
62 ~parse();
63 ::i16 issplit(const ::i8);
64 void getsplit();
65 void getsplit(string &);
66 string getword();
67 void getword(string &);
68 void getword(string &, string &, ::i32);
69 void getsplitword();
70 void getsplitword(string &);
71 string getrest();
72 void getrest(string &);
73 long getvalue();
74 void setbreak(const ::i8);
75 ::i32 getwordlen();
76 ::i32 getrestlen();
77
78 inline bool has_character() const { return m_iPos < m_iLen; }
79 inline bool is_eostr() const { return !has_character(); }
80
81
82 void enablebreak(const ::i8 ca)
83 {
84 pa_enable = ca;
85 }
86
87 void disablebreak(const ::i8 ca)
88 {
89 pa_disable = ca;
90 }
91 void getline();
92 void getline(string &);
93
94 // operational functions that does not store resulting word (pa_the_ord) starts with underscore.
95 void _get_expandable_line(character_count & start, character_count & end, bool & bFinal);
96 void _get_expandable_line(string &);
97 void get_expandable_line();
98
99 character_count get_pos() { return m_iPos; }
100 void EnableQuote(bool b) { m_bQuote = b; }
101
102};
103
104
105
Definition natural_pointer.h:26
Definition range.h:223