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