|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r59421 - in trunk/boost/spirit/home/support/char_encoding: . unicode
From: joel_at_[hidden]
Date: 2010-02-02 04:55:10
Author: djowel
Date: 2010-02-02 04:55:09 EST (Tue, 02 Feb 2010)
New Revision: 59421
URL: http://svn.boost.org/trac/boost/changeset/59421
Log:
Complete Unicode Level-1 support: table generation.
Added:
trunk/boost/spirit/home/support/char_encoding/unicode.hpp (contents, props changed)
Text files modified:
trunk/boost/spirit/home/support/char_encoding/ascii.hpp | 2 +-
trunk/boost/spirit/home/support/char_encoding/iso8859_1.hpp | 2 +-
trunk/boost/spirit/home/support/char_encoding/standard.hpp | 2 +-
trunk/boost/spirit/home/support/char_encoding/unicode/properties.hpp | 12 +++++++++++-
4 files changed, 14 insertions(+), 4 deletions(-)
Modified: trunk/boost/spirit/home/support/char_encoding/ascii.hpp
==============================================================================
--- trunk/boost/spirit/home/support/char_encoding/ascii.hpp (original)
+++ trunk/boost/spirit/home/support/char_encoding/ascii.hpp 2010-02-02 04:55:09 EST (Tue, 02 Feb 2010)
@@ -179,7 +179,7 @@
static bool
isascii_(int ch)
{
- return (0 == (ch & ~0x7f)) ? true : false;
+ return 0 == (ch & ~0x7f);
}
static bool
Modified: trunk/boost/spirit/home/support/char_encoding/iso8859_1.hpp
==============================================================================
--- trunk/boost/spirit/home/support/char_encoding/iso8859_1.hpp (original)
+++ trunk/boost/spirit/home/support/char_encoding/iso8859_1.hpp 2010-02-02 04:55:09 EST (Tue, 02 Feb 2010)
@@ -573,7 +573,7 @@
static bool
isascii_(int ch)
{
- return (0 == (ch & ~0x7f)) ? true : false;
+ return 0 == (ch & ~0x7f);
}
static bool
Modified: trunk/boost/spirit/home/support/char_encoding/standard.hpp
==============================================================================
--- trunk/boost/spirit/home/support/char_encoding/standard.hpp (original)
+++ trunk/boost/spirit/home/support/char_encoding/standard.hpp 2010-02-02 04:55:09 EST (Tue, 02 Feb 2010)
@@ -27,7 +27,7 @@
static bool
isascii_(int ch)
{
- return (0 == (ch & ~0x7f)) ? true : false;
+ return 0 == (ch & ~0x7f);
}
static bool
Added: trunk/boost/spirit/home/support/char_encoding/unicode.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/char_encoding/unicode.hpp 2010-02-02 04:55:09 EST (Tue, 02 Feb 2010)
@@ -0,0 +1,138 @@
+/*=============================================================================
+ Copyright (c) 2001-2010 Hartmut Kaiser
+ Copyright (c) 2001-2010 Joel de Guzman
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+#if !defined(BOOST_SPIRIT_UNICODE_1_JANUARY_12_2010_0728PM)
+#define BOOST_SPIRIT_UNICODE_1_JANUARY_12_2010_0728PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/cstdint.hpp>
+#include <boost/spirit/home/support/char_encoding/unicode/properties.hpp>
+
+namespace boost { namespace spirit { namespace char_encoding
+{
+ ///////////////////////////////////////////////////////////////////////////
+ // Test characters for specified conditions (using iso8859-1)
+ ///////////////////////////////////////////////////////////////////////////
+ struct unicode
+ {
+ typedef ::boost::uint32_t char_type;
+
+ static bool
+ isascii_(char_type ch)
+ {
+ return 0 == (ch & ~0x7f);
+ }
+
+ static bool
+ ischar(char_type ch)
+ {
+ // unicode code points in the range 0x00 to 0x10FFFF
+ return ch <= 0x10FFFF;
+ }
+
+ static bool
+ isalnum(char_type ch)
+ {
+ return unicode::is_alphanumeric(ch);
+ }
+
+ static bool
+ isalpha(char_type ch)
+ {
+ return unicode::is_alphabetic(ch);
+ }
+
+ static bool
+ isdigit(char_type ch)
+ {
+ return unicode::is_decimal_number(ch);
+ }
+
+ static bool
+ isxdigit(char_type ch)
+ {
+ return unicode::is_hexadecimal_number(ch);
+ }
+
+ static bool
+ iscntrl(char_type ch)
+ {
+ return unicode::is_control(ch);
+ }
+
+ static bool
+ isgraph(char_type ch)
+ {
+ return unicode::is_graph(ch);
+ }
+
+ static bool
+ islower(char_type ch)
+ {
+ return unicode::is_lowercase(ch);
+ }
+
+ static bool
+ isprint(char_type ch)
+ {
+ return unicode::is_print(ch);
+ }
+
+ static bool
+ ispunct(char_type ch)
+ {
+ return unicode::is_punctuation(ch);
+ }
+
+ static bool
+ isspace(char_type ch)
+ {
+ return unicode::is_punctuation(ch);
+ }
+
+ static int
+ isblank BOOST_PREVENT_MACRO_SUBSTITUTION (char_type ch)
+ {
+ return unicode::is_blank(ch);
+ }
+
+ static bool
+ isupper(char_type ch)
+ {
+ return unicode::is_uppercase(ch);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Simple character conversions
+ ///////////////////////////////////////////////////////////////////////////
+
+ static bool
+ tolower(char_type ch)
+ {
+ return unicode::to_lowercase(ch);
+ }
+
+ static bool
+ toupper(char_type ch)
+ {
+ return unicode::to_uppercase(ch);
+ }
+
+ static ::boost::uint32_t
+ toucs4(char_type ch)
+ {
+ return ch;
+ }
+ };
+
+}}}
+
+#endif
+
Modified: trunk/boost/spirit/home/support/char_encoding/unicode/properties.hpp
==============================================================================
--- trunk/boost/spirit/home/support/char_encoding/unicode/properties.hpp (original)
+++ trunk/boost/spirit/home/support/char_encoding/unicode/properties.hpp 2010-02-02 04:55:09 EST (Tue, 02 Feb 2010)
@@ -283,7 +283,17 @@
inline properties::script get_script(::boost::uint32_t ch)
{
- return static_cast<properties::script>(detail::script_lookup(r) & 0x3F);
+ return static_cast<properties::script>(detail::script_lookup(ch) & 0x3F);
+ }
+
+ inline ::boost::uint32_t to_lowercase(::boost::uint32_t ch)
+ {
+ return detail::lowercase_lookup(ch);
+ }
+
+ inline ::boost::uint32_t to_uppercase(::boost::uint32_t ch)
+ {
+ return detail::uppercase_lookup(ch);
}
}}}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk