UCommon
string.h
Go to the documentation of this file.
1 // Copyright (C) 1999-2005 Open Source Telecom Corporation.
2 // Copyright (C) 2006-2014 David Sugar, Tycho Softworks.
3 // Copyright (C) 2015 Cherokees of Idaho.
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 //
18 // As a special exception, you may use this file as part of a free software
19 // library without restriction. Specifically, if other files instantiate
20 // templates or use macros or inline functions from this file, or you compile
21 // this file and link it with other files to produce an executable, this
22 // file does not by itself cause the resulting executable to be covered by
23 // the GNU General Public License. This exception does not however
24 // invalidate any other reasons why the executable file might be covered by
25 // the GNU General Public License.
26 //
27 // This exception applies only to the code released under the name GNU
28 // Common C++. If you copy code from other releases into a copy of GNU
29 // Common C++, as the General Public License permits, the exception does
30 // not apply to the code that you add in this way. To avoid misleading
31 // anyone as to the status of such modified files, you must delete
32 // this exception notice from them.
33 //
34 // If you write modifications of your own for GNU Common C++, it is your choice
35 // whether to permit this exception to apply to your modifications.
36 // If you do not wish that, delete this exception notice.
37 //
38 
39 
45 #ifndef COMMONCPP_STRING_H_
46 #define COMMONCPP_STRING_H_
47 
48 #ifndef COMMONCPP_CONFIG_H_
49 #include <commoncpp/config.h>
50 #endif
51 
52 namespace ost {
53 
54 typedef ucommon::String String;
55 
56 __EXPORT char *lsetField(char *target, size_t size, const char *src, const char fill = 0);
57 __EXPORT char *rsetField(char *target, size_t size, const char *src, const char fill = 0);
58 __EXPORT char *newString(const char *src, size_t size = 0);
59 __EXPORT void delString(char *str);
60 __EXPORT char *setUpper(char *string, size_t size);
61 __EXPORT char *setLower(char *string, size_t size);
62 
63 inline char *setString(char *target, size_t size, const char *str) {
64  return String::set(target, size, str);
65 }
66 
67 inline char *addString(char *target, size_t size, const char *str) {
68  return String::add(target, size, str);
69 }
70 
71 inline char *dupString(const char *src, size_t size = 0) {
72  return newString(src, size);
73 }
74 
75 /*
76 __EXPORT char *find(const char *cs, char *str, size_t len = 0);
77 __EXPORT char *rfind(const char *cs, char *str, size_t len = 0);
78 __EXPORT char *ifind(const char *cs, char *str, size_t len = 0);
79 __EXPORT char *strip(const char *cs, char *str, size_t len = 0);
80 __EXPORT size_t strchop(const char *cs, char *str, size_t len = 0);
81 __EXPORT size_t strtrim(const char *cs, char *str, size_t len = 0);
82 
83 */
84 
85 } // namespace ost
86 
87 #endif
A copy-on-write string class that operates by reference count.
Definition: string.h:78
void add(const char *text)
Append null terminated text to our string buffer.
void set(const char *text)
Set string object to text of a null terminated string.