| 1 | <?xml version="1.0" encoding="utf-8"?> |
|---|
| 2 | <!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" |
|---|
| 3 | "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd"> |
|---|
| 4 | <section id="string_algo.rationale" last-revision="$Date: 2004/07/16 09:06:39 $"> |
|---|
| 5 | <title>Rationale</title> |
|---|
| 6 | |
|---|
| 7 | <using-namespace name="boost"/> |
|---|
| 8 | <using-namespace name="boost::algorithm"/> |
|---|
| 9 | |
|---|
| 10 | <section it="string_algo.locale"> |
|---|
| 11 | <title>Locales</title> |
|---|
| 12 | |
|---|
| 13 | <para> |
|---|
| 14 | Locales have a very close relation to string processing. They contain information about |
|---|
| 15 | the character sets and are used, for example, to change the case of characters and |
|---|
| 16 | to classify the characters. |
|---|
| 17 | </para> |
|---|
| 18 | <para> |
|---|
| 19 | C++ allows to work with multiple different instances of locales at once. If an algorithm |
|---|
| 20 | manipulates some data in a way that requires the usage of locales, there must be a way |
|---|
| 21 | to specify them. However, one instance of locales is sufficient for most of the applications, |
|---|
| 22 | and for a user it could be very tedious to specify which locales to use at every place |
|---|
| 23 | where it is needed. |
|---|
| 24 | </para> |
|---|
| 25 | <para> |
|---|
| 26 | Fortunately, the C++ standard allows to specify the <emphasis>global</emphasis> locales (using static member |
|---|
| 27 | function <code>std:locale::global()</code>). When instantiating an |
|---|
| 28 | <code>std::locale</code> class without explicit information, the instance will |
|---|
| 29 | be initialized with the <emphasis>global</emphasis> locale. This implies, that if an algorithm needs a locale, |
|---|
| 30 | it should have an <code>std::locale</code> parameter defaulting to <code>std::locale()</code>. |
|---|
| 31 | If a user needs to specify locales explicitly, she can do so. Otherwise the <emphasis>global</emphasis> |
|---|
| 32 | locales are used. |
|---|
| 33 | </para> |
|---|
| 34 | </section> |
|---|
| 35 | <section id="string_algo.regex"> |
|---|
| 36 | <title>Regular Expressions</title> |
|---|
| 37 | |
|---|
| 38 | <para> |
|---|
| 39 | Regular expressions are an essential part of text processing. For this reason, the library |
|---|
| 40 | also provides regex variants of some algorithms. The library does not attempt to replace |
|---|
| 41 | <libraryname>Boost.Regex</libraryname>; it merely wraps its functionality in a new interface. |
|---|
| 42 | As a part of this library, regex algorithms integrate smoothly with other components, which |
|---|
| 43 | brings additional value. |
|---|
| 44 | </para> |
|---|
| 45 | </section> |
|---|
| 46 | </section> |
|---|