File: string.yo

package info (click to toggle)
bobcat 1.18.1-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,920 kB
  • ctags: 575
  • sloc: makefile: 12,973; cpp: 6,284; perl: 401; ansic: 68; sh: 52
file content (204 lines) | stat: -rw-r--r-- 9,378 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
includefile(header.inc)

COMMENT(manpage, section, releasedate, archive, short name)
manpage(FBB::String)(3bobcat)(_CurYrs_)(libbobcat1-dev__CurVers_-x.tar.gz)
                    (Error handler)

manpagename(FBB::String)(Several extensions to bf(std::string))

manpagesynopsis()
    bf(#include <bobcat/string>)nl()
    Linking option: tt(-lbobcat) 

manpagedescription()
    This class offers the same functionality as bf(std::string), adding
facilities for often used transformations, currently missing in
bf(std::string).  

manpagesection(NAMESPACE)
    bf(FBB)nl()
    All constructors, members, operators and manipulators, mentioned in this
man-page, are defined in the namespace bf(FBB).

manpagesection(INHERITS FROM)
    bf(std::string) (deprecated, see below)

manpagesection(ENUMERATION)
    itemization(
    itb(Type)
       This enumeration has the following values, which are used in the second
        variant of the bf(split) member (see below): 

            bf(DQUOTE), a series of characters surrounded by double quotes
in the original string; 

            bf(DQUOTE_UNTERMINATED), a series of characters beginning with
a double quote in the original string, but lacking the matching terminating
double quote;

            bf(ESCAPED_END), a series of characters representing an
otherwise normal string, but terminating in a plain backslash;

            bf(NORMAL), a normal string; 

            bf(SEPARATOR), a separator;

            bf(SQUOTE), a series of characters surrounded by single quotes
in the original string; 

            bf(SQUOTE_UNTERMINATED), a series of characters beginning with
a single quote in the original string, but lacking the matching terminating
single quote.
    )

manpagesection(TYPEDEF)

    The bf(typedef SplitPair) represents bf(std::pair<std::string,
String::Type>) and is used in the second variant of the bf(split) member (see
below).

manpagesection(HISTORY)
    Initially this class was derived from bf(std::string). Deriving from
bf(std::string), however, is considerd bad design as tt(std::string) was
not designed as a base-class. 

    Currently bf(FBB::String) offers a series of em(static) member functions
providing the facilities originally implemented in non-static members.  The
non-static members are still avaialble for reasons of backward compatibility,
but should no longer be used. They will be removed in subsequent releases of
the bf(Bobcat) library.

manpagesection(STATIC MEMBER FUNCTIONS)
    itemization(
    itb(char const **argv(std::vector<std::string> const &words))
        Returns a pointer to an allocated series of pointers to the bf(C)
strings stored in the vector tt(words). The caller is responsible for
returning the array of pointers to the common pool, but should em(not) delete
the bf(C)-strings to which the pointers point. The last element of the
returned array is guaranteed to be a 0-pointer. 
    itb(int casecmp(std::string const &lhs, std::string const &rhs))
        Performs a case-insensitive comparison between the two tt(std::string)
objects. A negative value is returned if tt(lhs) should be ordered before
tt(rhs); 0 is returned if the two strings have identical contents; a
positive value is returned if the tt(lhs) object should be ordered beyond
tt(rhs).
    itb(std::string escape(std::string const &str, 
            char const *series = "'\"\\"))
        Returns a copy of the tt(str) object in which all characters in
tt(series) are prefixed by a backslash character.
    itb(std::string lc(std::string const &str) const)
        Returns a copy of the tt(str) object in which all letters were
transformed to lower case letters.
    itb(std::string trim(std::string const &str))
        Returns a copy of the tt(str) object from which the leading and
trailing blanks have been removed.
    itb(size_t split(std::vector<std::string> *words,
                    std::string const &str,
                    char const *separators = " \t", bool addEmpty = false))
        Fills tt(words) with all elements of the tt(str) object, separated by
any of the characters in tt(separators). If the parameter tt(addEmpty) is set
to tt(true), the individual separators are stored as empty strings in
tt(words). If a word starts with tt(") or tt(') all characters until a
matching terminating tt(") or tt(') at the end of a word are considered as one
word.  The surrounding quotes are not stored. The function returns the number
of elements in the vector pointed to by tt(words). This vector is initially
cleared.
    itb(size_t  split(std::vector<SplitPair> *words,
                    std::string const &str,
                    char const *separators = " \t", bool addEmpty = false))
        Same functionality as the former member, but the tt(words) vector is
filled with pairs, of which the first elements are the recognized strings, and
the second elements values of the tt(String::Type) enumeration. If
bf(addEmpty) is requested, then the bf(string) elements contain the actual
contents of the separator, while the bf(Type) elements are set to
bf(SEPARATOR).
    itb(std::string unescape(std::string const &str))
        Returns a copy of the tt(str) object in which the escaped (i.e.,
prefixed by a backslash) characters have been interpreted. All standard escape
characters (tt(\a), tt(\b), tt(\f), tt(\n), tt(\r), tt(\t), tt(\v)) are
recognized. If an escape character is followed by tt(x) or tt(X) the next two
characters are interpreted as a hexadecimal number. If an escape character is
followed by an octal digit, then the next three characters following the
backslash are interpreted as an octal number. In all other cases, the
backslash is removed and the character following the backslash is kept.
    itb(std::string uc(std::string const &str))
        Returns a copy of the tt(str) object in which all letters were
capitalized. 
    )

manpagesection(DEPRECATED CONSTRUCTORS)
    All constructors are deprecated and should no longer be used.
    itemization(
    itb(String())
        The default constructor, creating an empty bf(FBB::String) object.
    itb(String(std::string const &str))
        Initializes a bf(FBB::String) with the contents of an existing
bf(std::string).
    itb(String(char const *cp)):nl()
        Initializes a bf(FBB::String) with the contents of an existing
bf(C)-string: bf(cp) should not be a 0-pointer
    itb(String(String const &other)) 
    The standard copy constructor is available.
    )

manpagesection(DEPRECATED MEMBER FUNCTIONS)
    All public non-static members are deprecated and should no longer be
used:
    itemization(
    itb(int casecmp(std::string const &other) const)
        Performs a case-insensitive comparison between the current object's
contents and the contenst of tt(other). A negative value is returned if the
current object should be ordered before tt(other); 0 is returned if the two
strings have identical contents; a positive value is returned if the
current object should be ordered beyond tt(other).
    itb(String lc() const)
        Returns a copy of the current string in which all letters were
transformed to lower case letters.
    itb(String trim() const)
        Returns a copy of the current string from which the leading and
trailing blanks have been removed.
    itb(size_t  split(std::vector<std::string> *words,
                    char const *separators = " \t", bool addEmpty = false))
        Fills tt(words) with all elements of the current string, separated by
any of the characters in tt(separators). If the parameter tt(addEmpty) is set
to tt(true), the individual separators are stored as empty strings in
tt(words). If a word starts with tt(") or tt(') all characters until a
matching terminating tt(") or tt(') at the end of a word are considered as one
word.  The surrounding quotes are not stored. The function returns the number
of elements in the vector pointed to by tt(words). This vector is initially
cleared.
    itb(size_t  split(std::vector<SplitPair> *words,
                    char const *separators = " \t", bool addEmpty = false))
        Same functionality as the former member, but the tt(words) vector is
filled with pairs, of which the first elements are the recognized strings, and
the second elements values of the tt(String::Type) enumeration. If
bf(addEmpty) is requested, then the bf(string) elements contain the actual
contents of the separator, while the bf(Type) elements are set to
bf(SEPARATOR).
    itb(String unescape() const)
        Returns a tt(String) object in which the escaped (i.e., prefixed by a
backslash) characters have been interpreted. All standard escape characters
(tt(\a), tt(\b), tt(\f), tt(\n), tt(\r), tt(\t), tt(\v)) are recognized. If an
escape character is followed by tt(x) or tt(X) the next two characters are
interpreted as a hexadecimal number. If an escape character is followed by an
octal digit, then the next three characters following the backslash are
interpreted as an octal number. In all other cases, the backslash is removed
and the character following the backslash is kept.
    itb(String uc() const)
        Returns a copy of the current string in which all letters were
capitalized. 
    )

manpagesection(EXAMPLE)
    To do

manpagefiles()
    em(bobcat/string) - defines the class interface

manpageseealso()
    bf(bobcat)(7)

manpagebugs()
    None Reported.

includefile(trailer.inc)