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