From ec8f21d472da69c29ae8255d579dc3c768ca3393 Mon Sep 17 00:00:00 2001 From: jez_higgins <> Date: Thu, 11 Sep 2003 13:01:00 +0000 Subject: [PATCH] namespace ArabicaInternal -> Arabica::Internal --- SAX/SAX.vcproj | 7 ++--- Utils/impl/iso88591_utf8.cpp | 4 +-- Utils/impl/iso88591_utf8.h | 8 ++++-- Utils/impl/ucs2_utf16.cpp | 49 +++++++++++++++++------------------ Utils/impl/ucs2_utf16.h | 13 +++++----- Utils/impl/ucs2_utf8.cpp | 4 +-- Utils/impl/ucs2_utf8.h | 9 +++++-- Utils/iso88591utf8codecvt.cpp | 4 +-- Utils/utf16beucs2codecvt.cpp | 4 +-- Utils/utf16leucs2codecvt.cpp | 4 +-- Utils/utf16utf8codecvt.cpp | 4 +-- Utils/utf8iso88591codecvt.cpp | 4 +-- Utils/utf8ucs2codecvt.cpp | 4 +-- 13 files changed, 63 insertions(+), 55 deletions(-) diff --git a/SAX/SAX.vcproj b/SAX/SAX.vcproj index 983a0558..3c5364c2 100644 --- a/SAX/SAX.vcproj +++ b/SAX/SAX.vcproj @@ -27,8 +27,8 @@ RuntimeLibrary="5" TreatWChar_tAsBuiltInType="TRUE" RuntimeTypeInfo="TRUE" - UsePrecompiledHeader="2" - PrecompiledHeaderFile=".\Debug/SAX.pch" + UsePrecompiledHeader="0" + PrecompiledHeaderFile="" AssemblerListingLocation=".\Debug/" ObjectFile=".\Debug/" ProgramDataBaseFileName=".\Debug/" @@ -423,7 +423,8 @@ Name="Release|Win32"> diff --git a/Utils/impl/iso88591_utf8.cpp b/Utils/impl/iso88591_utf8.cpp index 701d3c5e..9297a8b9 100644 --- a/Utils/impl/iso88591_utf8.cpp +++ b/Utils/impl/iso88591_utf8.cpp @@ -24,7 +24,7 @@ namespace { }; } // namespace -std::codecvt_base::result ArabicaInternal::iso88591_2_utf8( +std::codecvt_base::result Arabica::Internal::iso88591_2_utf8( const char* from, const char* from_end, const char*& from_next, char* to, char* to_limit, char*& to_next) { @@ -58,7 +58,7 @@ std::codecvt_base::result ArabicaInternal::iso88591_2_utf8( return std::codecvt_base::ok; } // iso88591_2_utf8 -std::codecvt_base::result ArabicaInternal::utf8_2_iso88591( +std::codecvt_base::result Arabica::Internal::utf8_2_iso88591( const char* from, const char* from_end, const char*& from_next, char* to, char* to_limit, char*& to_next) { diff --git a/Utils/impl/iso88591_utf8.h b/Utils/impl/iso88591_utf8.h index a92f3680..076d523a 100644 --- a/Utils/impl/iso88591_utf8.h +++ b/Utils/impl/iso88591_utf8.h @@ -3,13 +3,17 @@ #include -namespace ArabicaInternal { +namespace Arabica +{ +namespace Internal +{ std::codecvt_base::result iso88591_2_utf8(const char* from, const char* from_end, const char*& from_next, char* to, char* to_limit, char*& to_next); std::codecvt_base::result utf8_2_iso88591(const char* from, const char* from_end, const char*& from_next, char* to, char* to_limit, char*& to_next); -} // namespace ArabicaInternal +} // namespace Internal +} // namespace Arabica #endif diff --git a/Utils/impl/ucs2_utf16.cpp b/Utils/impl/ucs2_utf16.cpp index 587d2113..3850edd7 100644 --- a/Utils/impl/ucs2_utf16.cpp +++ b/Utils/impl/ucs2_utf16.cpp @@ -1,9 +1,27 @@ -//--------------------------------------------------------------------------- -// $Id$ -//--------------------------------------------------------------------------- +// -------------------------------------------------------------------------- +// -------------------------------------------------------------------------- #include "ucs2_utf16.h" -//--------------------------------------------------------------------------- -std::codecvt_base::result ArabicaInternal::ucs2_2_utf16( +// -------------------------------------------------------------------------- +std::codecvt_base::result Arabica::Internal::utf16_2_ucs2( + bool be, + const char* from, const char* from_end, const char*& from_next, + wchar_t* to, wchar_t* to_limit, wchar_t*& to_next) +{ + from_next = from; + to_next = to; + + while((from_next+2 < from_end) && (to_next < to_limit)) + { + wchar_t b1 = static_cast(*from_next++); + wchar_t b2 = static_cast(*from_next++); + + *to_next++ = be ? ((b2 << 8) + b1) : ((b1 << 8) + b2); + } // while + + return (from_next == from_end) ? std::codecvt_base::ok : std::codecvt_base::partial; +} // utf16_2_ucs2 + +std::codecvt_base::result Arabica::Internal::ucs2_2_utf16( bool be, const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, char* to, char* to_limit, char*& to_next) @@ -34,24 +52,5 @@ std::codecvt_base::result ArabicaInternal::ucs2_2_utf16( } // while(from_next < from_end) return std::codecvt_base::ok; -} // iso88591_2_utf8 - -std::codecvt_base::result ArabicaInternal::utf16_2_ucs2( - bool be, - const char* from, const char* from_end, const char*& from_next, - wchar_t* to, wchar_t* to_limit, wchar_t*& to_next) -{ - from_next = from; - to_next = to; - - while((from_next+2 < from_end) && (to_next < to_limit)) - { - wchar_t b1 = static_cast(*from_next++); - wchar_t b2 = static_cast(*from_next++); - - *to_next++ = be ? ((b2 << 8) + b1) : ((b1 << 8) + b2); - } // while - - return (from_next == from_end) ? std::codecvt_base::ok : std::codecvt_base::partial; -} // utf8_2_iso88591 +} // ucs2_2_utf8 // end of file diff --git a/Utils/impl/ucs2_utf16.h b/Utils/impl/ucs2_utf16.h index f2c41182..d8c3e569 100644 --- a/Utils/impl/ucs2_utf16.h +++ b/Utils/impl/ucs2_utf16.h @@ -1,16 +1,15 @@ #ifndef ARABICA_UTILS_UCS2_UTF16_H #define ARABICA_UTILS_UCS2_UTF16_H - #include - -namespace ArabicaInternal { - +namespace Arabica +{ +namespace Internal +{ std::codecvt_base::result ucs2_2_utf16(bool be, const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, char* to, char* to_limit, char*& to_next); - std::codecvt_base::result utf16_2_ucs2(bool be, const char* from, const char* from_end, const char*& from_next, wchar_t* to, wchar_t* to_limit, wchar_t*& to_next); -} // namespace ArabicaInternal - +} // namepsace Internal +} // namespace Arabica #endif diff --git a/Utils/impl/ucs2_utf8.cpp b/Utils/impl/ucs2_utf8.cpp index ebd9a713..6d940275 100644 --- a/Utils/impl/ucs2_utf8.cpp +++ b/Utils/impl/ucs2_utf8.cpp @@ -27,7 +27,7 @@ namespace { }; } // namespace -std::codecvt_base::result ArabicaInternal::ucs2_2_utf8( +std::codecvt_base::result Arabica::Internal::ucs2_2_utf8( const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, char* to, char* to_limit, char*& to_next) { @@ -60,7 +60,7 @@ std::codecvt_base::result ArabicaInternal::ucs2_2_utf8( return std::codecvt_base::ok; } // iso88591_2_utf8 -std::codecvt_base::result ArabicaInternal::utf8_2_ucs2( +std::codecvt_base::result Arabica::Internal::utf8_2_ucs2( const char* from, const char* from_end, const char*& from_next, wchar_t* to, wchar_t* to_limit, wchar_t*& to_next) { diff --git a/Utils/impl/ucs2_utf8.h b/Utils/impl/ucs2_utf8.h index 9efed28f..3d8cc45a 100644 --- a/Utils/impl/ucs2_utf8.h +++ b/Utils/impl/ucs2_utf8.h @@ -3,13 +3,18 @@ #include -namespace ArabicaInternal { +namespace Arabica +{ +namespace Internal +{ std::codecvt_base::result ucs2_2_utf8(const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, char* to, char* to_limit, char*& to_next); std::codecvt_base::result utf8_2_ucs2(const char* from, const char* from_end, const char*& from_next, wchar_t* to, wchar_t* to_limit, wchar_t*& to_next); -} // namespace ArabicaInternal + +} // namespace Internal +} // namespace Arabica #endif diff --git a/Utils/iso88591utf8codecvt.cpp b/Utils/iso88591utf8codecvt.cpp index bcc9ff18..d50b33d6 100644 --- a/Utils/iso88591utf8codecvt.cpp +++ b/Utils/iso88591utf8codecvt.cpp @@ -14,7 +14,7 @@ std::codecvt_base::result iso88591utf8codecvt::do_out(std::mbstate_t& /* state * char* to_limit, char*& to_next) const { - return ArabicaInternal::utf8_2_iso88591(from, from_end, from_next, to, to_limit, to_next); + return Arabica::Internal::utf8_2_iso88591(from, from_end, from_next, to, to_limit, to_next); } // do_out std::codecvt_base::result iso88591utf8codecvt::do_in(std::mbstate_t& /* state */, @@ -25,7 +25,7 @@ std::codecvt_base::result iso88591utf8codecvt::do_in(std::mbstate_t& /* state */ char* to_limit, char*& to_next) const { - return ArabicaInternal::iso88591_2_utf8(from, from_end, from_next, to, to_limit, to_next); + return Arabica::Internal::iso88591_2_utf8(from, from_end, from_next, to, to_limit, to_next); } // do_in std::codecvt_base::result iso88591utf8codecvt::do_unshift(std::mbstate_t& /* state */, diff --git a/Utils/utf16beucs2codecvt.cpp b/Utils/utf16beucs2codecvt.cpp index 012d4bab..1bfd8841 100644 --- a/Utils/utf16beucs2codecvt.cpp +++ b/Utils/utf16beucs2codecvt.cpp @@ -21,7 +21,7 @@ std::codecvt_base::result utf16beucs2codecvt::do_out(std::mbstate_t& /* state */ char* to_limit, char*& to_next) const { - return ArabicaInternal::ucs2_2_utf16(true, from, from_end, from_next, to, to_limit, to_next); + return Arabica::Internal::ucs2_2_utf16(true, from, from_end, from_next, to, to_limit, to_next); } // do_out std::codecvt_base::result utf16beucs2codecvt::do_in(std::mbstate_t& /* state */, @@ -32,7 +32,7 @@ std::codecvt_base::result utf16beucs2codecvt::do_in(std::mbstate_t& /* state */, wchar_t* to_limit, wchar_t*& to_next) const { - return ArabicaInternal::utf16_2_ucs2(true, from, from_end, from_next, to, to_limit, to_next); + return Arabica::Internal::utf16_2_ucs2(true, from, from_end, from_next, to, to_limit, to_next); } // do_in std::codecvt_base::result utf16beucs2codecvt::do_unshift(std::mbstate_t& /* state */, diff --git a/Utils/utf16leucs2codecvt.cpp b/Utils/utf16leucs2codecvt.cpp index af42e5ac..c7c41293 100644 --- a/Utils/utf16leucs2codecvt.cpp +++ b/Utils/utf16leucs2codecvt.cpp @@ -20,7 +20,7 @@ std::codecvt_base::result utf16leucs2codecvt::do_out(std::mbstate_t& /* state */ char* to_limit, char*& to_next) const { - return ArabicaInternal::ucs2_2_utf16(false, from, from_end, from_next, to, to_limit, to_next); + return Arabica::Internal::ucs2_2_utf16(false, from, from_end, from_next, to, to_limit, to_next); } // do_out std::codecvt_base::result utf16leucs2codecvt::do_in(std::mbstate_t& /* state */, @@ -31,7 +31,7 @@ std::codecvt_base::result utf16leucs2codecvt::do_in(std::mbstate_t& /* state */, wchar_t* to_limit, wchar_t*& to_next) const { - return ArabicaInternal::utf16_2_ucs2(false, from, from_end, from_next, to, to_limit, to_next); + return Arabica::Internal::utf16_2_ucs2(false, from, from_end, from_next, to, to_limit, to_next); } // do_in std::codecvt_base::result utf16leucs2codecvt::do_unshift(std::mbstate_t& /* state */, diff --git a/Utils/utf16utf8codecvt.cpp b/Utils/utf16utf8codecvt.cpp index cdccd307..93f9e883 100644 --- a/Utils/utf16utf8codecvt.cpp +++ b/Utils/utf16utf8codecvt.cpp @@ -16,7 +16,7 @@ std::codecvt_base::result utf16utf8codecvt::do_out(std::mbstate_t& /* state */, wchar_t* to_limit, wchar_t*& to_next) const { - return ArabicaInternal::utf8_2_ucs2(from, from_end, from_next, to, to_limit, to_next); + return Arabica::Internal::utf8_2_ucs2(from, from_end, from_next, to, to_limit, to_next); } // do_out std::codecvt_base::result utf16utf8codecvt::do_in(std::mbstate_t& /* state */, @@ -27,7 +27,7 @@ std::codecvt_base::result utf16utf8codecvt::do_in(std::mbstate_t& /* state */, char* to_limit, char*& to_next) const { - return ArabicaInternal::ucs2_2_utf8(from, from_end, from_next, to, to_limit, to_next); + return Arabica::Internal::ucs2_2_utf8(from, from_end, from_next, to, to_limit, to_next); } // do_in std::codecvt_base::result utf16utf8codecvt::do_unshift(std::mbstate_t& /* state */, diff --git a/Utils/utf8iso88591codecvt.cpp b/Utils/utf8iso88591codecvt.cpp index 7be56655..9b435d1f 100644 --- a/Utils/utf8iso88591codecvt.cpp +++ b/Utils/utf8iso88591codecvt.cpp @@ -14,7 +14,7 @@ std::codecvt_base::result utf8iso88591codecvt::do_out(std::mbstate_t& /* state * char* to_limit, char*& to_next) const { - return ArabicaInternal::iso88591_2_utf8(from, from_end, from_next, to, to_limit, to_next); + return Arabica::Internal::iso88591_2_utf8(from, from_end, from_next, to, to_limit, to_next); } // do_out std::codecvt_base::result utf8iso88591codecvt::do_in(std::mbstate_t& /* state */, @@ -25,7 +25,7 @@ std::codecvt_base::result utf8iso88591codecvt::do_in(std::mbstate_t& /* state */ char* to_limit, char*& to_next) const { - return ArabicaInternal::utf8_2_iso88591(from, from_end, from_next, to, to_limit, to_next); + return Arabica::Internal::utf8_2_iso88591(from, from_end, from_next, to, to_limit, to_next); } // do_in std::codecvt_base::result utf8iso88591codecvt::do_unshift(std::mbstate_t& /* state */, diff --git a/Utils/utf8ucs2codecvt.cpp b/Utils/utf8ucs2codecvt.cpp index acd37a72..0655225b 100644 --- a/Utils/utf8ucs2codecvt.cpp +++ b/Utils/utf8ucs2codecvt.cpp @@ -15,7 +15,7 @@ std::codecvt_base::result utf8ucs2codecvt::do_out(std::mbstate_t& /* state */, char* to_limit, char*& to_next) const { - return ArabicaInternal::ucs2_2_utf8(from, from_end, from_next, to, to_limit, to_next); + return Arabica::Internal::ucs2_2_utf8(from, from_end, from_next, to, to_limit, to_next); } // do_out std::codecvt_base::result utf8ucs2codecvt::do_in(std::mbstate_t& /* state */, @@ -26,7 +26,7 @@ std::codecvt_base::result utf8ucs2codecvt::do_in(std::mbstate_t& /* state */, wchar_t* to_limit, wchar_t*& to_next) const { - return ArabicaInternal::utf8_2_ucs2(from, from_end, from_next, to, to_limit, to_next); + return Arabica::Internal::utf8_2_ucs2(from, from_end, from_next, to, to_limit, to_next); } // do_in std::codecvt_base::result utf8ucs2codecvt::do_unshift(std::mbstate_t& /* state */,