This file is indexed.

/usr/include/ZenLib/Ztring.h is in libzen-dev 0.4.23-1ubuntu1.

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
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
// ZenLib::Ztring - More methods for std::(w)string
// Copyright (C) 2002-2011 MediaArea.net SARL, Info@MediaArea.net
//
// This software is provided 'as-is', without any express or implied
// warranty.  In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
//    claim that you wrote the original software. If you use this software
//    in a product, an acknowledgment in the product documentation would be
//    appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
//    misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// More methods for std::(w)string
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//---------------------------------------------------------------------------
#ifndef ZenLib_ZtringH
#define ZenLib_ZtringH
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
#include "ZenLib/Conf.h"
#include "ZenLib/Utils.h"
#include "ZenLib/int128u.h"
#include <string>
#include <sstream>
//---------------------------------------------------------------------------

namespace ZenLib
{

//---------------------------------------------------------------------------
typedef std::basic_string<Char, std::char_traits<Char>, std::allocator<Char> > tstring;
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
/// @brief Options for Ztring methods
enum ztring_t
{
    Ztring_Nothing,
    Ztring_Rounded              = 1,            ///< if >.5, upper, else lower
    Ztring_CaseSensitive        = 2,            ///< Case sensitive ("A" and "a" are different)
    Ztring_AddLastItem          = 4,            ///< if Begin is found and End is not found, return between Begin and end of string
    Ztring_Recursive            = 8,            ///< Do all strings
    Ztring_NoZero               =16             ///> Doesn't keep Zero in the float number
};

//---------------------------------------------------------------------------

//***************************************************************************
/// @brief String manipulation (based on std::(w)string)
//***************************************************************************

class Ztring : public tstring  //for details about undocumented methods see http://www.sgi.com/tech/stl/basic_string.html
{
public :
    //Constructor/destructor
    Ztring ()                                                                   : tstring(){};
    Ztring (const tstring& str)                                                 : tstring(str){};
    Ztring (const tstring& str, size_type pos, size_type n=npos)                : tstring(str, pos, n){};
    Ztring (const Char* s, size_type n)                                         : tstring(s, n){};
    Ztring (const Char* s)                                                      : tstring(s){};
    Ztring (size_type n, Char c)                                                : tstring(n, c){};
    #ifdef UNICODE
    Ztring (const char* S)                                                      : tstring(){From_UTF8(S);};
    Ztring (const char* S, size_type n)                                         : tstring(){From_UTF8(S, 0, n);};
    #endif //UNICODE

    //Operators
        ///Same as [], but resize the string if Pos doesn't exist yet
    Char &operator () (size_type Pos);

    //Assign
    bool Assign_FromFile (const Ztring &FileName);

    //Conversions - From
    #ifndef WSTRING_MISSING
        /// @brief convert an Unicode encoded string into Ztring
    Ztring& From_Unicode (const std::wstring &S)                                {return From_Unicode(S.c_str());};
    #endif //WSTRING_MISSING
        /// @brief convert an Unicode encoded string into Ztring
    Ztring& From_Unicode (const wchar_t *S);
        /// @brief convert an Unicode encoded string into Ztring
    Ztring& From_Unicode (const wchar_t *S, size_type Start, size_type Length);
        /// @brief convert an Unicode encoded string into Ztring
    Ztring& From_Unicode (const wchar_t *S, size_type Length)                   {return From_Unicode(S, 0, Length);};
        /// @brief convert an UTF-8 encoded string into Ztring
    Ztring& From_UTF8    (const std::string &S)                                 {return From_UTF8(S.c_str());};
        /// @brief convert an UTF-8 encoded string into Ztring
    Ztring& From_UTF8    (const char *S);
        /// @brief convert an UTF-8 encoded string into Ztring
    Ztring& From_UTF8    (const char *S, size_type Start, size_type Length);
        /// @brief convert an UTF-8 encoded string into Ztring
    Ztring& From_UTF8    (const char *S, size_type Length)                      {return From_UTF8(S, 0, Length);};
        /// @brief convert an UTF-16 encoded string into Ztring
    Ztring& From_UTF16   (const char *S);
        /// @brief convert an UTF-16 encoded string into Ztring
    Ztring& From_UTF16   (const char *S, size_type Start, size_type Length);
        /// @brief convert an UTF-16 encoded string into Ztring
    Ztring& From_UTF16   (const char *S, size_type Length)                      {return From_UTF16(S, 0, Length);};
        /// @brief convert an UTF-16BE encoded string into Ztring
    Ztring& From_UTF16BE (const char *S);
        /// @brief convert an UTF-16BE encoded string into Ztring
    Ztring& From_UTF16BE (const char *S, size_type Start, size_type Length);
        /// @brief convert an UTF-16BE encoded string into Ztring
    Ztring& From_UTF16BE (const char *S, size_type Length)                      {return From_UTF16BE(S, 0, Length);};
        /// @brief convert an UTF-16LE encoded string into Ztring
    Ztring& From_UTF16LE (const char *S);
        /// @brief convert an UTF-16LE encoded string into Ztring
    Ztring& From_UTF16LE (const char *S, size_type Start, size_type Length);
        /// @brief convert an UTF-16LE encoded string into Ztring
    Ztring& From_UTF16LE (const char *S, size_type Length)                      {return From_UTF16LE(S, 0, Length);};
        /// @brief convert an Locael encoded string into Ztring
    Ztring& From_Local   (const std::string &S)                                 {return From_Local(S.c_str());};
        /// @brief convert an Local encoded string into Ztring
    Ztring& From_Local   (const char  *S);
        /// @brief convert an Local encoded string into Ztring
    Ztring& From_Local   (const char  *S, size_type Start,  size_type Length);
        /// @brief convert an Local encoded string into Ztring
    Ztring& From_Local   (const char  *S, size_type Length)                     {return From_Local(S, 0, Length);};

        /// @brief convert an ISO-8859-1 encoded string into Ztring
    Ztring& From_ISO_8859_1   (const char  *S);
        /// @brief convert an ISO-8859-1 encoded string into Ztring
    Ztring& From_ISO_8859_1   (const char  *S, size_type Start,  size_type Length);
        /// @brief convert an ISO-8859-1 encoded string into Ztring
    Ztring& From_ISO_8859_1   (const char  *S, size_type Length)                {return From_ISO_8859_1(S, 0, Length);};

        /// @brief convert an ISO-8859-2 encoded string into Ztring
    Ztring& From_ISO_8859_2   (const char  *S);
        /// @brief convert an ISO-8859-1 encoded string into Ztring
    Ztring& From_ISO_8859_2   (const char  *S, size_type Start,  size_type Length);
        /// @brief convert an ISO-8859-1 encoded string into Ztring
    Ztring& From_ISO_8859_2   (const char  *S, size_type Length)                {return From_ISO_8859_2(S, 0, Length);};

        /// @brief convert an 16 byte GUID into Ztring
    Ztring& From_GUID    (const int128u S);
        /// @brief convert an 16 byte UUID into Ztring
    Ztring& From_UUID    (const int128u S);
        /// @brief convert an 4 Character Code into Ztring
    Ztring& From_CC4     (const char  *S)                                       {return From_Local(S, 0, 4);};
        /// @brief convert an 4 Character Code into Ztring
    Ztring& From_CC4     (const int8u *S)                                       {return From_Local((const char*)S, 0, 4);};
        /// @brief convert an 4 Character Code into Ztring
    Ztring& From_CC4     (const int32u S);
        /// @brief convert an 2 Character Code into Ztring
    Ztring& From_CC3     (const char  *S)                                       {return From_Local(S, 0, 3);};
        /// @brief convert an 4 Character Code into Ztring
    Ztring& From_CC3     (const int8u *S)                                       {return From_Local((const char*)S, 0, 3);};
        /// @brief convert an 4 Character Code into Ztring
    Ztring& From_CC3     (const int32u S);
        /// @brief convert an 2 Character Code into Ztring
    Ztring& From_CC2     (const char  *S)                                       {return From_CC2(ZenLib::CC2(S));};
        /// @brief convert an 2 Character Code into Ztring
    Ztring& From_CC2     (const int8u *S)                                       {return From_CC2(ZenLib::CC2(S));};
        /// @brief convert an 2 Character Code into Ztring
    Ztring& From_CC2     (const int16u S);
        /// @brief convert an 1 Character Code into Ztring
    Ztring& From_CC1     (const char  *S)                                       {return From_CC1(ZenLib::CC1(S));};
        /// @brief convert an 1 Character Code into Ztring
    Ztring& From_CC1     (const int8u *S)                                       {return From_CC1(ZenLib::CC1(S));};
        /// @brief convert an 1 Character Code into Ztring
    Ztring& From_CC1     (const int8u  S);
        /// @brief convert number into Ztring
    Ztring& From_Number  (const int8s,    int8u Radix=10);
        /// @brief convert number into Ztring
    Ztring& From_Number  (const int8u,    int8u Radix=10);
        /// @brief convert number into Ztring
    Ztring& From_Number  (const int16s,   int8u Radix=10);
        /// @brief convert number into Ztring
    Ztring& From_Number  (const int16u,   int8u Radix=10);
        /// @brief convert number into Ztring
    Ztring& From_Number  (const int32s,   int8u Radix=10);
        /// @brief convert number into Ztring
    Ztring& From_Number  (const int32u,   int8u Radix=10);
        /// @brief convert number into Ztring
    Ztring& From_Number  (const int64s,   int8u Radix=10);
        /// @brief convert number into Ztring
    Ztring& From_Number  (const int64u,   int8u Radix=10);
        /// @brief convert number into Ztring
    Ztring& From_Number  (const int128u,  int8u Radix=10);
    /// @brief convert number into Ztring
    Ztring& From_Number  (const float32,  int8u AfterComma=3, ztring_t Options=Ztring_Nothing);
        /// @brief convert number into Ztring
    Ztring& From_Number  (const float64,  int8u AfterComma=3, ztring_t Options=Ztring_Nothing);
        /// @brief convert number into Ztring
    Ztring& From_Number  (const float80,  int8u AfterComma=3, ztring_t Options=Ztring_Nothing);
    #ifdef NEED_SIZET
        /// @brief convert number into Ztring
    Ztring& From_Number  (const size_t,   int8u Radix=10);
    #endif //NEED_SIZET
        /// @brief convert number (BCD coded) into Ztring
    Ztring& From_BCD     (const int8u);
        /// @brief convert count of milliseconds into a readable and sortable string
    Ztring& Duration_From_Milliseconds (const int64s Milliseconds);
        /// @deprecated replaced by the int64s version
    Ztring& Duration_From_Milliseconds (const int64u Milliseconds);
        /// @brief convert count of seconds since 1601 into a readable and sortable string
    Ztring& Date_From_Milliseconds_1601 (const int64u Milliseconds);
        /// @brief convert count of seconds since 1601 into a readable and sortable string
    Ztring& Date_From_Seconds_1601 (const int64u Seconds);
        /// @brief convert count of seconds since 1970 into a readable and sortable string
    Ztring& Date_From_Seconds_1904 (const int64u Seconds);
        /// @brief convert count of seconds since 1970 into a readable and sortable string
    Ztring& Date_From_Seconds_1970 (const int32u Seconds);
        /// @brief convert count of seconds since 1970 into a readable and sortable string (in local time)
    Ztring& Date_From_Seconds_1970_Local (const int32u Seconds);
        /// @brief convert a free formated string into a readable and sortable string
    Ztring& Date_From_String (const char* Date, size_type Value_Size=Error);
        /// @brief convert numbers into a readable and sortable string
    Ztring& Date_From_Numbers (const int8u Year, const int8u Month, const int8u Day, const int8u Hour, const int8u Minute, const int8u Second);

    //Conversions - To
    #ifndef WSTRING_MISSING
        /// @brief Convert into Unicode chars
        /// @return the string corresponding \n
    std::wstring To_Unicode () const;
    #endif //WSTRING_MISSING
        /// @brief Convert into char* (UTF-8 encoded)
        /// @return the string corresponding \n
    std::string To_UTF8     () const;
        /// @brief Convert into char* (Local encoded)
        /// @return the string corresponding \n
    std::string To_Local    () const;
        /// @brief Convert into 16 byte UUID number
        /// @return the value corresponding \n
        ///         0 if there is a problem
    int128u     To_UUID    () const;
        /// @brief Convert into a 4 Character Code
        /// @return the value corresponding \n
        ///         0 if there is a problem
    int32u      To_CC4    () const;
        /// @brief Convert into Int (8 bits)
        /// @return the value corresponding \n
        ///         0 if there is a problem
    int8s       To_int8s    (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
        /// @brief Convert into unsigned Int (8 bits)
        /// @return the value corresponding
        ///         0 if there is a problem
    int8u       To_int8u    (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
        /// @brief Convert into Int (16 bits)
        /// @return the value corresponding \n
        ///         0 if there is a problem
    int16s      To_int16s   (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
        /// @brief Convert into unsigned Int (16 bits)
        /// @return the value corresponding
        ///         0 if there is a problem
    int16u      To_int16u   (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
        /// @brief Convert into Int (32 bits)
        /// @return the value corresponding \n
        ///         0 if there is a problem
    int32s      To_int32s   (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
        /// @brief Convert into unsigned Int (32 bits)
        /// @return the value corresponding
        ///         0 if there is a problem
    int32u      To_int32u   (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
        /// @brief Convert into Int (64 bits)
        /// @return the value corresponding \n
        ///         0 if there is a problem
    int64s      To_int64s   (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
        /// @brief Convert into unsigned Int (64 bits)
        /// @return the value corresponding \n
        ///         0 if there is a problem
    int64u      To_int64u   (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
        /// @brief Convert into unsigned Int (64 bits)
        /// @warning only hexadecimal and no rounding are currenlty supported \n
        /// @return the value corresponding \n
        ///         0 if there is a problem
    int128u     To_int128u   (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
        /// @brief Convert into float
        /// @return the value corresponding \n
        ///         0 if there is a problem
    float32     To_float32  (ztring_t Options=Ztring_Nothing) const;
    float64     To_float64  (ztring_t Options=Ztring_Nothing) const;
    float80     To_float80  (ztring_t Options=Ztring_Nothing) const;

    //Static versions
    static Ztring ToZtring_From_Local(const std::string &S)                               {return Ztring().From_Local(S);};
    static Ztring ToZtring_From_Local(const char  *S)                                     {return Ztring().From_Local(S);};
    static Ztring ToZtring_From_Local(const char  *S, size_type Start,  size_type Length) {return Ztring().From_Local(S, Start, Length);};
    static Ztring ToZtring_From_Local(const char  *S, size_type Length)                   {return Ztring().From_Local(S, Length);};
    static Ztring ToZtring_From_CC4  (const char  *S)                                     {return Ztring().From_CC4(S);};
    static Ztring ToZtring_From_CC4  (const int8u *S)                                     {return Ztring().From_CC4(S);};
    static Ztring ToZtring_From_CC4  (const int32u S)                                     {return Ztring().From_CC4(S);};
    static Ztring ToZtring_From_CC3  (const char  *S)                                     {return Ztring().From_CC3(S);};
    static Ztring ToZtring_From_CC3  (const int8u *S)                                     {return Ztring().From_CC3(S);};
    static Ztring ToZtring_From_CC3  (const int32u S)                                     {return Ztring().From_CC3(S);};
    static Ztring ToZtring_From_CC2  (const char  *S)                                     {return Ztring().From_CC2(S);};
    static Ztring ToZtring_From_CC2  (const int8u *S)                                     {return Ztring().From_CC2(S);};
    static Ztring ToZtring_From_CC2  (const int16u S)                                     {return Ztring().From_CC2(S);};
    static Ztring ToZtring_From_CC1  (const char  *S)                                     {return Ztring().From_CC1(S);};
    static Ztring ToZtring_From_CC1  (const int8u *S)                                     {return Ztring().From_CC1(S);};
    static Ztring ToZtring_From_CC1  (const int8u  S)                                     {return Ztring().From_CC1(S);};
    static Ztring ToZtring  (const int8s    I, int8u Radix=10)                   {return Ztring().From_Number(I, Radix);};
    static Ztring ToZtring  (const int8u    I, int8u Radix=10)                   {return Ztring().From_Number(I, Radix);};
    static Ztring ToZtring  (const int16s   I, int8u Radix=10)                   {return Ztring().From_Number(I, Radix);};
    static Ztring ToZtring  (const int16u   I, int8u Radix=10)                   {return Ztring().From_Number(I, Radix);};
    static Ztring ToZtring  (const int32s   I, int8u Radix=10)                   {return Ztring().From_Number(I, Radix);};
    static Ztring ToZtring  (const int32u   I, int8u Radix=10)                   {return Ztring().From_Number(I, Radix);};
    static Ztring ToZtring  (const int64s   I, int8u Radix=10)                   {return Ztring().From_Number(I, Radix);};
    static Ztring ToZtring  (const int64u   I, int8u Radix=10)                   {return Ztring().From_Number(I, Radix);};
    static Ztring ToZtring  (const int128u  I, int8u Radix=10)                   {return Ztring().From_Number(I, Radix);};
    static Ztring ToZtring  (const float32  F, int8u AfterComma=3)               {return Ztring().From_Number(F, AfterComma);};
    static Ztring ToZtring  (const float64  F, int8u AfterComma=3)               {return Ztring().From_Number(F, AfterComma);};
    static Ztring ToZtring  (const float80  F, int8u AfterComma=3)               {return Ztring().From_Number(F, AfterComma);};
    #ifdef NEED_SIZET
    static Ztring ToZtring  (const size_t   I,  int8u Radix=10)                  {return Ztring().From_Number(I, Radix);};
    #endif //NEED_SIZET

    //Edition
        /// @brief test if it is a number
    bool IsNumber() const;
        /// @brief convert into lowercase
    Ztring &MakeLowerCase();
        /// @brief convert into uppercase
    Ztring &MakeUpperCase();
        /// @brief Remove leading whitespaces from a string
    Ztring &TrimLeft(Char ToTrim=_T(' '));
        /// @brief Remove trailing whitespaces from a string
    Ztring &TrimRight(Char ToTrim=_T(' '));
        /// @brief Remove leading and trailing whitespaces from a string
    Ztring &Trim(Char ToTrim=_T(' '));
        /// @brief Quotes a string
    Ztring &Quote(Char ToTrim=_T('\"'));
        /// @brief return a string between two strings
        /// @param Begin First string
        /// @param End Second string
        /// @param Pos Position to begin to scan string
        /// @param Options Options for searching \n
        ///                Available : Ztring_CaseSensitive
        /// @return The substring \n
        ///         "" if not found
    Ztring SubString (const tstring &Begin, const tstring &End, size_type Pos=0, ztring_t Options=Ztring_Nothing) const;
        /// @brief replace a string by another one
        /// @param ToFind string to find
        /// @param ToReplace string wich replace the string found
        /// @param Pos Position to begin to scan string
        /// @param Options Options for searching \n
        ///                Available : Ztring_CaseSensitive, Ztring_Recursive
        /// @return The count of replacements
    size_type FindAndReplace (const tstring &ToFind, const tstring &ReplaceBy, size_type Pos=0, ztring_t Options=Ztring_Nothing); //Remplace une chaine par une autre
        /// @brief Count the number of occurencies of a string in the string
        /// @param ToCount string to count
        /// @param Options Options for count \n
        ///                Available : Ztring_CaseSensitive
        /// @return the count

    //Information
    size_type Count (const Ztring &ToCount, ztring_t Options=Ztring_Nothing) const;
        /// @brief compare with another string
        /// @param ToCompare string to compare with
        /// @param Options Options for comaparing \n
        ///                Available : Ztring_CaseSensitive
        /// @return The result of comparasion
    bool Compare (const Ztring &ToCompare, const Ztring &Comparator=_T("=="), ztring_t Options=Ztring_Nothing) const;
};

} //NameSpace

#endif