]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/locale/examples/boundary.cpp
2 // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 #include <boost/locale.hpp>
15 using namespace boost::locale
;
19 // Make system default locale global
20 std::locale loc
= gen("");
25 string text
="Hello World! あにま! Linux2.6 and Windows7 is word and number. שָלוֹם עוֹלָם!";
29 boundary::ssegment_index
index(boundary::word
,text
.begin(),text
.end());
30 boundary::ssegment_index::iterator p
,e
;
32 for(p
=index
.begin(),e
=index
.end();p
!=e
;++p
) {
33 cout
<<"Part ["<<*p
<<"] has ";
34 if(p
->rule() & boundary::word_number
)
36 if(p
->rule() & boundary::word_letter
)
38 if(p
->rule() & boundary::word_kana
)
39 cout
<<"kana character(s) ";
40 if(p
->rule() & boundary::word_ideo
)
41 cout
<<"ideographic character(s) ";
42 if(p
->rule() & boundary::word_none
)
43 cout
<<"no word characters";
47 index
.map(boundary::character
,text
.begin(),text
.end());
49 for(p
=index
.begin(),e
=index
.end();p
!=e
;++p
) {
54 index
.map(boundary::line
,text
.begin(),text
.end());
56 for(p
=index
.begin(),e
=index
.end();p
!=e
;++p
) {
61 index
.map(boundary::sentence
,text
.begin(),text
.end());
63 for(p
=index
.begin(),e
=index
.end();p
!=e
;++p
) {
70 // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
72 // boostinspect:noascii