This file is indexed.

/usr/include/Wt/WString is in libwt-dev 3.1.10-1ubuntu2.

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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
// This may look like C code, but it's really -*- C++ -*-
/*
 * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
 *
 * See the LICENSE file for terms of use.
 */
#ifndef WSTRING_H_
#define WSTRING_H_

#include <Wt/WDllDefs.h>
#include <Wt/WGlobal>

#include <string>
#include <vector>
#include <iosfwd>
#ifndef WT_NO_STD_LOCALE
#include <locale>
#endif

namespace Wt {

/*! \class WString Wt/WString Wt/WString
 *  \brief A unicode string class, with support for localization.
 *
 * %Wt offers this string to facilitate handling of unicode text
 * through the user interface, and to offer support for localized text
 * using message resource bundles.
 *
 * A %WString may be constructed from a std::string, std::wstring or
 * c-style strings (const char * and const wchar_t *), and converted
 * to each of these strings taking into account the locale in which
 * the %Wt application runs on the web server. Independent of the
 * locale on the web server, you may convert from and to UTF8 unicode
 * encoded std::strings.
 *
 * By using the static functions WString::tr() (or WWidget::tr()), one
 * may construct a localized string. The key is used to retrieve its
 * current value from the application's message-resource
 * bundles.
 *
 * Argument place holder in a string, denoted using {<i>n</i>} for the
 * <i>n</i>'th argument, may be substituted by values set using
 * arg(int) and arg(std::string).
 *
 * %WString is used by all built-in widgets for displayed text. By
 * calling WApplication::setLocale() or WApplication::refresh(), the
 * contents of every %WString is reevaluated in the new locale, by
 * calling refresh(). In this way, the contents of the whole user
 * interface is adapted to a possibly changed locale.
 *
 * To benefit from the localization properties of %WString, you should
 * design your own widget classes to use %WString in their interface
 * for any text that is displayed. In this way, your own widgets will
 * automatically, and without any extra effort, participate in a
 * relocalization triggered by WApplication::setLocale().
 *
 * This string class does not provide anything more than basic
 * manipulations. Instead, you should convert to a standard library
 * string class to manipulate the string contents and perform string
 * algorithms on them. In particular, we recommend to use the
 * conversion methods toUTF8(), fromUTF8() to convert from and to UTF8
 * encoded std::strings. In this way, you can support the whole
 * unicode character set, with backward compatible support for the
 * standard 7-bit ASCII set. Since %WString internally uses
 * UTF8-encoding, and UTF8-encoding is used by the library for
 * communication with the browser, there is no actual conversion
 * overhead. Only when you need to run string algorithms that require
 * the actual length of the string in number of characters, you would
 * need to convert to a wide string representation such as
 * std::wstring.
 *
 * \sa WApplication::messageResourceBundle()
 * \sa WApplication::locale()
 */
class WT_API WString
{
public:
  /*! \brief Creates an empty string
   *
   * Create a literal string with empty contents ("").
   */
  WString();

#ifndef WT_NO_STD_WSTRING
  /*! \brief Creates a %WString from a wide C string
   *
   * The wide string is implicitly converted to proper unicode. Note
   * that there are known issues with the portability of wchar_t since
   * its width and encoding are platform dependent.
   */
  WString(const wchar_t *value);
#endif

  /*! \brief Copy constructor
   */
  WString(const WString& other);

#ifndef WT_NO_STD_WSTRING
  /*! \brief Creates a %WString from a wide C++ string
   *
   * The wide string is implicitly converted to proper unicode. Note
   * that there are known issues with the portability of wchar_t since
   * its width and encoding are platform dependent.
   */
  WString(const std::wstring& value);
#endif

  /*! \brief Creates a %WString from a C string.
   *
   * The C string is implicitly converted to unicode. When
   * \p encoding is \link Wt::LocalEncoding LocalEncoding\endlink,
   * the current locale is used to interpret the C string. When
   * encoding is \link Wt::UTF8 UTF8\endlink, the C string is
   * interpreted as a UTF8 encoded unicode string.
   */
  WString(const char *value, CharEncoding encoding = LocalEncoding);

#ifndef WT_NO_STD_LOCALE
  /*! \brief Creates a %WString from a C string.
   *
   * The C string is implicitly converted to unicode. The
   * string is interpreted within the character set of the given locale.
   */
  WString(const char *value, const std::locale &loc);
#endif


  /*! \brief Creates a %WString from a C++ string.
   *
   * The C++ string is implicitly converted to unicode. When
   * \p encoding is \link Wt::LocalEncoding LocalEncoding\endlink,
   * the current locale is used to interpret the C++ string. When
   * encoding is \link Wt::UTF8 UTF8\endlink, the C++ string is
   * interpreted as a UTF8 encoded unicode string.
   */
  WString(const std::string& value, CharEncoding encoding = LocalEncoding);

#ifndef WT_NO_STD_LOCALE
  /*! \brief Creates a %WString from a C++ string.
   *
   * The C++ string is implicitly converted to unicode. The
   * string is interpreted within the character set of the given locale.
   */
  WString(const std::string& value, const std::locale &loc);
#endif

  /*! \brief Destructor
   */
  ~WString();

  /*! \brief Assignment operator
   *
   * Copy another string into this string.
   */
  WString& operator= (const WString& rhs);

  /*! \brief Comparison operator
   *
   * Compares to strings and returns \c true if the strings are exactly
   * the same. This may require evaluating a localized string in the
   * current locale.
   */
  bool operator== (const WString& rhs) const;

  /*! \brief Comparison operator
   *
   * Compares to strings lexicographically. This may require
   * evaluating a localized string in the current locale. The unicode
   * representation of the strings are compared.
   */
  bool operator< (const WString& rhs) const;

  /*! \brief Comparison operator
   *
   * Compares to strings lexicographically. This may require
   * evaluating a localized string in the current locale. The unicode
   * representation of the strings are compared.
   */
  bool operator> (const WString& rhs) const;

  /*! \brief Self-concatenation operator
   *
   * Appends a string to the current value. If the string was localized,
   * this automatically converts it to a literal string, by evaluating the
   * string using the current locale.
   */
  WString& operator+= (const WString& rhs);

#ifndef WT_NO_STD_WSTRING
  /*! \brief Self-concatenation operator
   *
   * Appends a string to the current value. If the string was localized,
   * this automatically converts it to a literal string, by evaluating the
   * string using the current locale.
   */
  WString& operator+= (const std::wstring& rhs);
#endif

#ifndef WT_NO_STD_WSTRING
  /*! \brief Self-concatenation operator
   *
   * Appends a string to the current value. If the string was localized,
   * this automatically converts it to a literal string, by evaluating the
   * string using the current locale.
   */
  WString& operator+= (const wchar_t *rhs);
#endif

  /*! \brief Self-concatenation operator
   *
   * Appends a string to the current value. The right hand side is
   * interpreted in the server locale and converted to unicode. If the
   * string was localized, this automatically converts it to a literal
   * string, by evaluating the string using the current locale.
   */
  WString& operator+= (const std::string& rhs);

  /*! \brief Self-concatenation operator
   *
   * Appends a string to the current value. The right hand side is
   * interpreted in the server locale and converted to unicode. If the
   * string was localized, this automatically converts it to a literal
   * string, by evaluating the string using the current locale.
   */
  WString& operator+= (const char *rhs);

  /*! \brief Returns whether the string is empty.
   */
  bool empty() const;

  /*! \brief Creates a %WString from a UTF8 unicode encoded string.
   *
   * This is equivalent to using the constructor WString(\p value,
   * UTF8).
   *
   * When \p checkValid is \c true, the UTF8 encoding is validated. You
   * should enable this only if you cannot trust the origin of the string.
   * The library uses this internally whenever it receives data from the
   * browser (in UTF-8 format).
   */
  static WString fromUTF8(const std::string& value, bool checkValid = false);

  /*! \brief Creates a %WString from a UTF8 unicode encoded string.
   *
   * This is equivalent to using the constructor WString(\p value,
   * UTF8).
   *
   * When \p checkValid is \c true, the UTF8 encoding is validated. You
   * should enable this only if you cannot trust the origin of the string.
   * The library uses this internally whenever it receives data from the
   * browser (in UTF-8 format).
   */
  static WString fromUTF8(const char *value, bool checkValid = false);

  /*! \brief Returns the value as a UTF8 unicode encoded string.
   *
   * For a localized string, returns the current localized value.
   *
   * \sa fromUTF8()
   */
  std::string toUTF8() const;

  /*! \brief Creates a localized string from a key.
   *
   * Whenever the value of the string is needed, the key is used for a
   * lookup in the application message resource bundles taking into
   * account the current application locale. If the key cannot be
   * resolved, its value is set to '??key??'.
   *
   * \sa WApplication::messageResourceBundle(), WApplication::locale(), WApplication::localizedStrings()
   */
  static WString tr(const char *key);

  /*! \brief Creates a localized string with the specified key.
   *
   * \sa tr(const char *)
   */
  static WString tr(const std::string& key);

  /*! \brief Creates a localized string from a key for a number \p n.
   *
   * Whenever the value of the string is needed, the \p key is used for a
   * lookup in the application message resource bundles taking into
   * account the current application locale. This function fetches the
   * appropriate plural case for the translation corresponding to the
   * quantity \p n.
   *
   * If the \p key cannot be resolved, its value is set to '??key??'.
   *
   * \sa WApplication::messageResourceBundle(), WApplication::locale(), WApplication::localizedStrings()
   */
  static WString trn(const char *key, ::uint64_t n);

  /*! \brief Creates a localized string with the specified key for a
      number \c n.
   *
   * \sa trn(const char *)
   */
  static WString trn(const std::string& key, ::uint64_t n);

#ifndef WT_NO_STD_WSTRING
  /*! \brief Returns the value as a wide C++ string.
   *
   * A localized string is resolved using the WApplication::localizedStrings().
   *
   * Argument place holders are substitued with actual arguments.
   */
  std::wstring value() const;
#endif

  /*! \brief Returns the value as a narrow C++ string.
   *
   * A localized string is resolved using the WApplication::localizedStrings().
   *
   * Argument place holders are substitued with actual arguments.
   *
   * Any wide character is narrowed using the provided locale, possibly
   * losing information. If you wish to keep all information, use toUTF8()
   * instead, which encodes wide characters in the string.
   *
   * \sa toUTF8()
   */
#ifndef WT_NO_STD_LOCALE
  std::string narrow(const std::locale &loc = std::locale()) const;
#else
  std::string narrow() const;
#endif

#ifndef WT_NO_STD_WSTRING
  /*! \brief Returns the value as a wide C++ string.
   *
   * A localized string is resolved using the WApplication::localizedStrings().
   *
   * Argument place holders are substitued with actual arguments.
   */
  operator std::wstring() const;
#endif

  /*! \brief Retuns whether the string is literal or localized.
   *
   * \sa tr()
   */
  bool literal() const { return !impl_ || impl_->key_.empty(); }

  /*! \brief Returns the key for a localized string.
   *
   * When the string is literal, the result is undefined.
   */
  const std::string key() const;

#ifndef WT_NO_STD_WSTRING
  /*! \brief Substitutes the next positional argument with a string value.
   *
   * In the string, the \p n-th argument is referred to as using
   * {\p n}.
   *
   * For example: the string "<tt>{1} bought {2} apples in the
   * shop.</tt>" with first argument value "<tt>Bart</tt>" and second
   * argument value <tt>5</tt> becomes: "<tt>Bart bought 5 apples in
   * the shop.</tt>"
   */
  WString& arg(const std::wstring& value);
#endif

  /*! \brief Substitutes the next positional argument with a string value.
   *
   * In the string, the \p n-th argument is referred to as using
   * {\p n}.
   *
   * For example: the string "<tt>{1} bought {2} apples in the
   * shop.</tt>" with first argument value "<tt>Bart</tt>" and second
   * argument value <tt>5</tt> becomes: "<tt>Bart bought 5 apples in
   * the shop.</tt>"
   */
  WString& arg(const std::string& value, CharEncoding = LocalEncoding);

  WString& arg(const char *value, CharEncoding = LocalEncoding);

  /*! \brief Substitutes the next positional argument with a string value.
   *
   * In the string, the \p n-th argument is referred to as using
   * {\p n}.
   *
   * For example: the string "<tt>{1} bought {2} apples in the
   * shop.</tt>" with first argument value "<tt>Bart</tt>" and second
   * argument value <tt>5</tt> becomes: "<tt>Bart bought 5 apples in
   * the shop.</tt>"
   */
  WString& arg(const WString& value);

  /*! \brief Substitutes the next positional argument with an integer value.
   *
   * In the string, the \p n-th argument is reffered to as using
   * {\p n}.
   *
   * For example: the string "<tt>{1} bought {2} apples in the
   * shop.</tt>" with first argument value "<tt>Bart</tt>" and second
   * argument value <tt>5</tt> becomes: "<tt>Bart bought 5 apples in
   * the shop.</tt>"
   */
  WString& arg(int value);

  /*! \brief Substitutes the next positional argument with a double value.
   *
   * In the string, the \p n-th argument is reffered to as using
   * {\p n}.
   *
   * For example: the string "<tt>{1} bought {2} apples in the
   * shop.</tt>" with first argument value "<tt>Bart</tt>" and second
   * argument value <tt>5</tt> becomes: "<tt>Bart bought 5 apples in
   * the shop.</tt>"
   */
  WString& arg(double value);

  /*! \brief Returns the list of arguments
   *
   * Each argument is UTF8 encoded.
   */
  const std::vector<std::string>& args() const;

  /*! \brief Refreshes the string.
   *
   * For a localized string, its value is resolved again.
   *
   * Returns whether the value has (potentially) changed.
   */
  bool refresh();

  /*! \brief Returns the string as a JavaScript literal
   *
   * The \p delimiter may be a single or double quote.
   *
   * \sa WWebWidget::jsStringLiteral()
   */
  std::string jsStringLiteral(char delimiter = '\'') const;

#ifdef WT_CNOR
  WString& operator+(const char *);
  WString& operator+(const WString &);
#endif

  /*! \brief Comparison operator
   *
   * Compares to strings and returns \c true if the strings are exactly
   * the same. This may require evaluating a localized string in the
   * current locale.
   */
  bool operator!= (const WString& rhs) const { return !(*this == rhs); }

  /** \brief An empty string.
   */
  static const WString Empty;

  static void checkUTF8Encoding(std::string& value);

private:
  WString(const char *key, bool, ::uint64_t n = -1);

  std::string utf8_;

  void resolveKey(const std::string& key, std::string& result) const;

  void makeLiteral();

  struct Impl {
    std::string              key_;
    std::vector<std::string> arguments_;
    ::int64_t n_;

    Impl();
  };

  static std::vector<std::string> stArguments_;

  void createImpl();

  Impl *impl_;
};

#ifndef WT_CNOR

/* \brief Short hand for WString(const char * value, UTF8)
 *
 * \relates WString
 */
extern WString utf8(const char *value);

/* \brief Short hand for WString(const std::string& value, UTF8)
 *
 * \relates WString
 */
extern WString utf8(const std::string& value);

/*! \brief Concatenate two WStrings
 *
 * \relates WString
 */
extern WT_API WString operator+ (const WString& lhs, const WString& rhs);

#ifndef WT_NO_STD_WSTRING
/*! \brief Conatenate a WString with a C++ wide string
 *
 * \relates WString
 */
extern WT_API WString operator+ (const WString& lhs, const std::wstring& rhs);
#endif

#ifndef WT_NO_STD_WSTRING
/*! \brief Conatenate a WString with a C wide string
 *
 * \relates WString
 */
extern WT_API WString operator+ (const WString& lhs, const wchar_t *rhs);
#endif

/*! \brief Conatenate a WStrin with a C++ string
 *
 * \relates WString
 */
extern WT_API WString operator+ (const WString& lhs, const std::string& rhs);

/*! \brief Conatenate a WString with a C string
 *
 * \relates WString
 */
extern WT_API WString operator+ (const WString& lhs, const char *rhs);

#ifndef WT_NO_STD_WSTRING
/*! \brief Conatenate a C++ wide string with a WString
 *
 * \relates WString
 */
extern WT_API WString operator+ (const std::wstring& lhs, const WString& rhs);
#endif

#ifndef WT_NO_STD_WSTRING
/*! \brief Conatenate a C wide string with a WString
 *
 * \relates WString
 */
extern WT_API WString operator+ (const wchar_t *lhs, const WString& rhs);
#endif

/*! \brief Conatenate a C++ string with a WString
 *
 * \relates WString
 */
extern WT_API WString operator+ (const std::string& lhs, const WString& rhs);

/*! \brief Conatenate a C string with a WString
 *
 * \relates WString
 */
extern WT_API WString operator+ (const char *lhs, const WString& rhs);

/*! \brief Compare a C string with a WString
 *
 * \relates WString
 */
extern WT_API bool operator== (const char *lhs, const WString& rhs);

#ifndef WT_NO_STD_WSTRING
/*! \brief Compare a C wide string with a WString
 *
 * \relates WString
 */
extern WT_API bool operator== (const wchar_t *lhs, const WString& rhs);
#endif

/*! \brief Compare a C++ string with a WString
 *
 * \relates WString
 */
extern WT_API bool operator== (const std::string& lhs, const WString& rhs);

#ifndef WT_NO_STD_WSTRING
/*! \brief Compare a C++ wide string with a WString
 *
 * \relates WString
 */
extern WT_API bool operator== (const std::wstring& lhs, const WString& rhs);
#endif

/*! \brief Compare a C string with a WString
 *
 * \relates WString
 */
extern WT_API bool operator!= (const char *lhs, const WString& rhs);

#ifndef WT_NO_STD_WSTRING
/*! \brief Compare a C wide string with a WString
 *
 * \relates WString
 */
extern WT_API bool operator!= (const wchar_t *lhs, const WString& rhs);
#endif

/*! \brief Compare a C++ string with a WString
 *
 * \relates WString
 */
extern WT_API bool operator!= (const std::string& lhs, const WString& rhs);

#ifndef WT_NO_STD_WSTRING
/*! \brief Compare a C++ wide string with a WString
 *
 * \relates WString
 */
extern WT_API bool operator!= (const std::wstring& lhs, const WString& rhs);
#endif

#ifndef WT_NO_STD_WSTRING
/*! \brief Output a WString to a C++ wide stream
 *
 * \relates WString
 */
extern WT_API std::wostream& operator<< (std::wostream& lhs, const WString& rhs);
#endif

/*! \brief Output a WString to a C++ stream
 *
 * The string is narrowed using the currently global C++ locale, possibly
 * losing information.
 * \relates WString
 */
extern WT_API std::ostream& operator<< (std::ostream& lhs, const WString& rhs);

#endif // WT_CNOR

#ifndef WT_DEPRECATED_3_0_0
/*! \brief Alias for %WString (<b>deprecated</b>).
 *
 * \deprecated use WString instead.
 *
 * %WString provides all the functionality of the now deprecated
 * WMessage, but is used more consistently through the API.
 *
 * \relates WString
 */
typedef WString WMessage;
#endif // WT_DEPRECATED_3_0_0

}

#endif // WSTRING_H_