/usr/include/GTLCore/String.h is in opengtl-dev 0.9.16-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | /*
* Copyright (c) 2008-2009 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* either version 2, or (at your option) any later version of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _GTLCORE_STRING_H_
#define _GTLCORE_STRING_H_
#include <string>
#include <list>
#include <vector>
#include <GTLCore/Export.h>
namespace GTLCore {
/**
* String class which provides convenient function on top of \ref std::string .
* @ingroup GTLCore
*/
class GTLCORE_EXPORT String {
public:
/**
* Construct an empty string.
*/
String();
/**
* Construct a \ref String from a single character.
*/
String(char );
/**
* Construct a \ref String from a C string.
*/
String(const char* );
/**
* Construct a \ref String from a C++ string.
*/
String(const std::string& );
/**
* Construct a \ref String from an other \ref String .
*/
String(const String& );
String& operator=(const String& );
~String();
public:
/**
* Append a C string to the current \ref String, and return it the
* result.
*/
String& append(const char* );
/**
* Append a C++ string to the current \ref String, and return the
* result.
*/
String& append(const std::string& );
/**
* Append a \ref String to the current \ref String, and return the
* result.
*/
String& append(const String& );
public:
/**
* Replace all occurences of \ref pat with \ref rep .
*/
String& replace(const String& pat, const String& rep);
public:
const char* c_str() const;
/**
* Attempt to convert the string to an integer.
*/
int toInt() const;
/**
* Attempt to convert the string to a float.
*/
float toFloat() const;
/**
* @return the n first characters
*/
String head(int n) const;
/**
* @return the n last characters
*/
String tail(int n) const;
/**
* @return a lower case version of the string.
*/
String toLower() const;
/**
* @return a upper case version of the string.
*/
String toUpper() const;
/**
* Split the \ref String along the given separators
* @param _separators list of separators given in a string (one character for one separator)
* @return a list of \ref String
*/
std::vector<String> split( const String& _separators, bool _allowEmpty = false) const;
/**
* Split the \ref String along the given separators
* @param _separators the list of separators
* @return a list of \ref String
*/
std::vector<String> split( const std::list<String>& _separators, bool _allowEmpty = false) const;
/**
* @return true if this \ref String starts with \a _sw .
*/
bool startWith(const GTLCore::String& _sw) const;
bool endWith(const GTLCore::String& _sw) const;
/**
* @return a string without space at beginning or end
*/
String trimmed() const;
public:
String& operator=(char c);
String& operator+=(const String& s);
String operator+(const char* _rhs) const;
String operator+(const String& _rhs) const;
bool operator==(const char* _rhs) const;
bool operator==(const String& _rhs) const;
bool operator!=(const char* _rhs) const;
bool operator!=(const String& _rhs) const;
bool operator<(const String& _rhs) const;
operator const std::string& () const;
char operator[](std::size_t idx) const;
public:
/**
* @return the length of the string
*/
std::size_t length() const;
String substr(std::size_t _pos, std::size_t __n ) const;
bool isEmpty() const;
public:
/**
* @return a \ref String containing the number
*/
static String number(int );
/**
* @return a \ref String containing the number
*/
static String number(unsigned int );
/**
* @return a \ref String containing the number
*/
static String number(float );
/**
* @return a \ref String containing the number
*/
static String number(double );
private:
inline void deref();
struct Private;
Private* d;
};
GTLCORE_EXPORT String operator+(const char* arg1, const String& arg2);
GTLCORE_EXPORT bool operator==(const char* arg1, const String& arg2);
GTLCORE_EXPORT std::ostream& operator<< (std::ostream& ostr, const String& string);
}
#endif
|