1 /***************************************************************************
3 * Copyright (C) 2006 David Brodsky *
5 * This library is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU Library General Public *
7 * License as published by the Free Software Foundation and appearing *
8 * in the file LICENSE.LGPL included in the packaging of this file. *
10 * This library 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 GNU *
13 * Library General Public License for more details. *
15 ***************************************************************************/
17 #ifndef _tairon_core_string_h
18 #define _tairon_core_string_h
29 /** \brief Just wrapper class around std::string.
31 * It is here because of preparation to later optimization with implicitly
34 class String
: public std::string
37 String() : std::string() {} ;
39 String(const std::string
&str
) : std::string(str
) {};
41 String(const String
&str
, size_t pos
, size_t count
= npos
) : std::string(str
, pos
, count
) {};
43 String(const char *str
, size_t size
) : std::string(str
, size
) {};
45 String(const char *str
) : std::string(str
) {};
48 return contains('\n');
51 /** Returns true if the string contains given one.
53 bool contains(const String
&what
) const {
54 return find(what
) != npos
;
57 /** Returns true if the string contains given character.
59 bool contains(char what
) const {
60 return find(what
) != npos
;
63 /** Removes all leading whitespaces. Returns reference to *this.
67 /** Converts given number into a string.
69 static String
number(int32_t num
);
71 /** Converts given number into a string.
73 static String
number(uint32_t num
);
75 /** Converts given number into a string.
77 static String
number(int64_t num
);
79 /** Converts given number into a string.
81 static String
number(uint64_t num
);
85 operator const char *() const {
89 /** Returns string containing characters up to first newline character.
90 * The beginning of this string with newline character is removed. If
91 * there is no newline character then this method returns empty string.
95 /** Removes all trailing whitespaces from the end of the string.
96 * Returns reference to *this.
100 /** Removes all whitespaces from the beginning and end of the string.
101 * Returns reference to *this.
111 }; // namespace Tairon
115 // vim: ai sw=4 ts=4 noet fdm=marker