mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-30 08:38:15 +01:00
namespace ArabicaInternal -> Arabica::Internal
This commit is contained in:
parent
10668086f8
commit
ec8f21d472
13 changed files with 63 additions and 55 deletions
|
@ -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">
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="cl /TC /EP ArabicaConfig.S > ArabicaConfig.h"
|
||||
CommandLine="cl /TC /EP ArabicaConfig.S > ArabicaConfig.h
|
||||
"
|
||||
Outputs="ArabicaConfig.h"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -3,13 +3,17 @@
|
|||
|
||||
#include <locale>
|
||||
|
||||
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
|
||||
|
|
|
@ -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<wchar_t>(*from_next++);
|
||||
wchar_t b2 = static_cast<wchar_t>(*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<wchar_t>(*from_next++);
|
||||
wchar_t b2 = static_cast<wchar_t>(*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
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
#ifndef ARABICA_UTILS_UCS2_UTF16_H
|
||||
#define ARABICA_UTILS_UCS2_UTF16_H
|
||||
|
||||
#include <locale>
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -3,13 +3,18 @@
|
|||
|
||||
#include <locale>
|
||||
|
||||
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
|
||||
|
|
|
@ -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 */,
|
||||
|
|
|
@ -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 */,
|
||||
|
|
|
@ -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 */,
|
||||
|
|
|
@ -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 */,
|
||||
|
|
|
@ -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 */,
|
||||
|
|
|
@ -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 */,
|
||||
|
|
Loading…
Add table
Reference in a new issue