Xbase Class Library
2.0.0
Main Page
Classes
Files
File List
File Members
xbase
xbstring.h
Go to the documentation of this file.
1
/*
2
3
Xbase project source code
4
5
This file contains the Class definition for a xbString object.
6
7
Copyright (C) 1997 StarTech, Gary A. Kunkel
8
9
This library is free software; you can redistribute it and/or
10
modify it under the terms of the GNU Lesser General Public
11
License as published by the Free Software Foundation; either
12
version 2.1 of the License, or (at your option) any later version.
13
14
This library is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
Lesser General Public License for more details.
18
19
You should have received a copy of the GNU Lesser General Public
20
License along with this library; if not, write to the Free Software
21
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
23
Contact:
24
25
Mail:
26
27
Technology Associates, Inc.
28
XBase Project
29
1455 Deming Way #11
30
Sparks, NV 89434
31
USA
32
33
Email:
34
35
xbase@techass.com
36
37
See our website at:
38
39
xdb.sourceforge.net
40
41
42
V 1.9.2 9/14/99 - Misc user supplied updates
43
*/
44
45
#ifndef __XBSTRING_H__
46
#define __XBSTRING_H__
47
48
#ifdef __GNUG__
49
#pragma interface
50
#endif
51
52
#ifdef __WIN32__
53
#include <
xbase/xbconfigw32.h
>
54
#else
55
#include <
xbase/xbconfig.h
>
56
#endif
57
58
#include <stdlib.h>
59
#include <iostream>
60
using namespace
std;
61
65
66
69
class
XBDLLEXPORT
xbString
{
70
public
:
71
enum
{npos = -1};
72
73
xbString
();
74
xbString
(
size_t
size);
75
xbString
(
char
c);
76
xbString
(
const
char
*s);
77
xbString
(
const
char
*s,
size_t
maxlen);
78
xbString
(
const
xbString
&s);
79
80
~
xbString
();
81
82
xbString
&operator=(
const
xbString
&s);
83
xbString
&operator=(
const
char
*s);
84
xbString
&operator=(
char
c);
85
86
bool
isNull()
const
;
87
bool
isEmpty()
const
;
88
size_t
len()
const
;
89
size_t
length()
const
;
90
91
void
resize(
size_t
size);
92
xbString
copy()
const
;
93
94
xbString
&sprintf(
const
char
*format, ...);
95
void
setNum(
long
num);
96
97
xbString
& assign(
const
xbString
& str,
size_t
pos = 0,
int
n = npos);
98
xbString
& assign(
char
* str,
int
n);
99
char
operator[]
(
int
n) {
return
data[n]; }
100
char
getCharacter
(
int
n )
const
{
return
data[n]; }
101
operator
const
char
*()
const
;
102
xbString
&operator+=(
const
char
*s);
103
xbString
&operator+=(
char
c);
104
xbString
&operator-=(
const
char
*s);
105
void
putAt(
size_t
pos,
char
c);
106
107
const
char
*getData()
const
;
108
const
char
*c_str()
const
;
109
void
toLowerCase();
110
int
pos(
char
c);
111
int
pos(
const
char
* s);
112
void
trim();
113
bool
compare(
char
s);
114
bool
compare(
const
char
*s);
115
116
bool
operator ==
(
const
xbString
& )
const
;
117
bool
operator !=
(
const
xbString
& )
const
;
118
bool
operator < (
const
xbString
& )
const
;
119
bool
operator > (
const
xbString
& )
const
;
120
bool
operator <= (
const
xbString
& )
const
;
121
bool
operator >= (
const
xbString
& )
const
;
122
123
friend
ostream&
operator <<
( ostream&,
const
xbString
& );
124
125
xbString
&
remove
(
size_t
pos = 0,
int
n = npos);
126
xbString
mid(
size_t
pos = 0,
int
n = npos)
const
;
127
128
protected
:
129
void
ctor(
const
char
*s);
130
void
ctor(
const
char
*s,
size_t
maxlen);
131
132
char
*
data
;
133
size_t
size
;
134
static
const
char
*
NullString
;
135
};
136
137
bool
operator==
(
const
xbString
&s1,
const
char
*s2);
138
bool
operator!=
(
const
xbString
&s1,
const
char
*s2);
139
bool
operator==
(
const
xbString
&s1,
char
s2);
140
bool
operator!=
(
const
xbString
&s1,
char
s2);
141
142
xbString
operator+
(
const
xbString
&s1,
const
xbString
&s2);
143
xbString
operator+
(
const
xbString
&s1,
const
char
*s2);
144
xbString
operator+
(
const
char
*s1,
const
xbString
&s2);
145
xbString
operator+
(
const
xbString
&s1,
char
c2);
146
xbString
operator+
(
char
c1,
const
xbString
&s2);
147
xbString
operator-
(
const
xbString
&s1,
const
xbString
&s2);
148
149
#endif
150
Generated by
1.8.2