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