*** empty log message ***

This commit is contained in:
jez_higgins 2003-09-12 23:15:14 +00:00
parent 73b6ec0402
commit ac90b206a6
18 changed files with 187 additions and 104 deletions

View file

@ -10,9 +10,7 @@
#include <SAX/ArabicaConfig.h>
#ifdef ARABICA_VS6_WORKAROUND
namespace std {
typedef ::mbstate_t mbstate_t;
}
#include <Utils/impl/VS6Workaround.h>
#endif
namespace Arabica

View file

@ -21,10 +21,7 @@
#include <SAX/ArabicaConfig.h>
#ifdef ARABICA_VS6_WORKAROUND
namespace std {
typedef ::mbstate_t mbstate_t;
}
#include <minmax.h>
#include <SAX/Utils/impl/VS6Workaround.h>
#endif
namespace Arabica
@ -191,11 +188,7 @@ std::streamsize convert_bufadaptor<charT, traitsT, externalCharT, externalTraits
if(!inBuffer_.capacity())
growInBuffer();
#ifndef ARABICA_VS6_WORKAROUND
size_t pbCount = std::min<size_t>(gptr() - eback(), pbSize_);
#else
size_t pbCount = min(gptr() - eback(), pbSize_);
#endif
memcpy(&(inBuffer_[0]) + (pbSize_-pbCount)*sizeof(charT),
gptr() - pbCount*sizeof(charT),
pbCount*sizeof(charT));

View file

@ -252,7 +252,7 @@ private:
typedef basic_iconvertstream<char> converting_istringstream;
typedef basic_oconvertstream<char> converting_ostringstream;
#ifndef ARABICA_NO_WCHAR_T
#ifndef ARABICA_NO_WSTRING_T
typedef basic_iconvertstream<wchar_t> converting_iwstringstream;
typedef basic_oconvertstream<wchar_t> converting_owstringstream;
#endif

View file

@ -0,0 +1,28 @@
#ifndef ARABICA_VS6_WORKAROUND_H
#define ARABICA_VS6_WORKAROUND_H
#ifndef ARABICA_VS6_WORKAROUND
#error "This file is only for use in Visual C++/Studio v6 builds."
#endif
#undef max
#undef min
namespace std {
typedef ::mbstate_t mbstate_t;
template<typename T>
T max(T a, T b)
{
return (a > b) ? b : a;
}
template<typename T>
T min(T a, T b)
{
return (a < b) ? a : b;
}
}
#endif

View file

@ -0,0 +1,78 @@
#include <SAX/ArabicaConfig.h>
#ifndef ARABICA_NO_CODECVT_SPECIALISATIONS
#include <Utils/impl/codecvt_specialisations.h>
namespace std
{
////////////////////////////////////////////////////////////////////////
codecvt_base::result
codecvt<char, wchar_t, mbstate_t>::
do_out(mbstate_t&, const char* from, const char* from_end, const char*& from_next,
wchar_t* to, wchar_t* to_limit, wchar_t*& to_next) const
{
int limit = std::max<int>(from_end - from, to_limit - to);
from_next = from;
to_next = to;
while(limit--)
*to_next++ = static_cast<wchar_t>(*from_next++);
return codecvt_base::ok;
} // do_out
codecvt_base::result
codecvt<char, wchar_t, mbstate_t>::
do_in(mbstate_t&, const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next,
char* to, char* to_limit, char*& to_next) const
{
int limit = std::max<int>(from_end - from, to_limit - to);
from_next = from;
to_next = to;
while(limit--)
*to_next++ = static_cast<char>(*from_next++);
return codecvt_base::ok;
} // do_in
codecvt_base::result
codecvt<char, wchar_t, mbstate_t>::
do_unshift(mbstate_t&, wchar_t* to, wchar_t* to_limit, wchar_t*& to_next) const
{
to_next = to;
return codecvt_base::noconv;
} // do_unshift
int
codecvt<char, wchar_t, mbstate_t>::
do_encoding() const throw()
{
return 1;
} // do_encoding
bool
codecvt<char, wchar_t, mbstate_t>::
do_always_noconv() const throw()
{
return false;
} // do_always_noconv
int
codecvt<char, wchar_t, mbstate_t>::
do_length(const mbstate_t&, const wchar_t* from, const wchar_t* end, size_t max) const
{
return std::min<int>(max, (end - from));
} // do_length
int
codecvt<char, wchar_t, mbstate_t>::
do_max_length() const throw()
{
return 1;
} // do_max_length
} // namespace std
#endif

View file

@ -7,42 +7,42 @@ namespace std
{
template<>
class codecvt<char, wchar_t, mbstate_t> :
public codecvt_base
class codecvt<char, wchar_t, std::mbstate_t>
{
protected:
virtual result do_out(mbstate_t&,
const char* from,
const char* from_end,
const char*& from_next,
wchar_t* to,
wchar_t* to_limit,
wchar_t*& to_next) const = 0;
virtual codecvt_base::result do_out(mbstate_t&,
const char* from,
const char* from_end,
const char*& from_next,
wchar_t* to,
wchar_t* to_limit,
wchar_t*& to_next) const;
virtual result do_in(mbstate_t&,
const wchar_t* from,
const wchar_t* from_end,
const wchar_t*& from_next,
char* to,
char* to_limit,
char*& to_next) const = 0;
virtual codecvt_base::result do_in(mbstate_t&,
const wchar_t* from,
const wchar_t* from_end,
const wchar_t*& from_next,
char* to,
char* to_limit,
char*& to_next) const;
virtual result do_unshift(mbstate_t&,
wchar_t* to,
wchar_t* to_limit,
wchar_t*& to_next) const = 0;
virtual codecvt_base::result do_unshift(mbstate_t&,
wchar_t* to,
wchar_t* to_limit,
wchar_t*& to_next) const;
virtual int do_encoding() const throw() = 0;
virtual int do_encoding() const throw();
virtual bool do_always_noconv() const throw() = 0;
virtual bool do_always_noconv() const throw();
virtual int do_length(const mbstate_t&,
const wchar_t* from,
const wchar_t* end,
size_t max) const = 0;
size_t max) const;
virtual int do_max_length() const throw() = 0;
};
virtual int do_max_length() const throw();
}; // class codecvt<char, wchar_t, std::mbstate_t> :
}
} // namespace std
#endif

View file

@ -1,15 +1,22 @@
#ifndef ARABICA_UTILS_UCS2_UTF16_H
#define ARABICA_UTILS_UCS2_UTF16_H
#include <locale>
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);
} // namepsace Internal
} // namespace Arabica
#endif

View file

@ -4,12 +4,9 @@
//
///////////////////////////////////////////
#include "rot13codecvt.h"
#include <Utils/rot13codecvt.h>
#ifdef ARABICA_VS6_WORKAROUND
namespace std {
template<typename T>
T max(T a, T b) { return a > b ? a : b; }
}
#include <Utils/impl/VS6Workaround.h>
#endif
using namespace Arabica::convert;

View file

@ -9,9 +9,7 @@
#include <locale>
#include <SAX/ArabicaConfig.h>
#ifdef ARABICA_VS6_WORKAROUND
namespace std {
typedef ::mbstate_t mbstate_t;
}
#include <Utils/impl/VS6Workaround.h>
#endif
namespace Arabica

View file

@ -32,6 +32,10 @@
# define INADDR_NONE ((in_addr_t) -1)
#endif
#ifdef ARABICA_VS6_WORKAROUND
#include <Utils/impl/VS6Workaround.h>
#endif
namespace Arabica
{
@ -272,11 +276,8 @@ int basic_socketbuf<charT, traitsT>::readSocket()
if(!inBuffer_.capacity())
growInBuffer();
#ifndef ARABICA_VS6_WORKAROUND
size_t pbCount = std::min<int>(gptr() - eback(), pbSize_);
#else
size_t pbCount = min(gptr() - eback(), pbSize_);
#endif
memcpy(&(inBuffer_[0]) + (pbSize_-pbCount)*sizeof(charT),
gptr() - pbCount*sizeof(charT),
pbCount*sizeof(charT));
@ -393,7 +394,7 @@ void basic_socketstream<charT, traitsT>::close()
typedef basic_socketbuf<char, std::char_traits<char> > socketbuf;
typedef basic_socketstream<char, std::char_traits<char> > socketstream;
#ifndef ARABICA_NO_WCHAR_T
#ifndef ARABICA_NO_WSTRING_T
typedef basic_socketbuf<wchar_t, std::char_traits<wchar_t> > wsocketbuf;
typedef basic_socketstream<wchar_t, std::char_traits<wchar_t> > wsocketstream;
#endif

View file

@ -1,15 +1,11 @@
//---------------------------------------------------------------------------
// $Id$
//---------------------------------------------------------------------------
#include "utf16beucs2codecvt.h"
#ifndef ARABICA_NO_WCHAR_T
#include "impl/ucs2_utf16.h"
#include <Utils/utf16beucs2codecvt.h>
#include <Utils/impl/ucs2_utf16.h>
#ifdef ARABICA_VS6_WORKAROUND
namespace std {
template<typename T>
T max(T a, T b) { return a > b ? a : b; }
}
#include <Utils/impl/VS6Workaround.h>
#endif
//---------------------------------------------------------------------------
using namespace Arabica::convert;
@ -53,6 +49,5 @@ int utf16beucs2codecvt::do_length(const std::mbstate_t&,
return std::max<int>((end-from), max/2);
} // do_length
#endif // ARABICA_NO_WCHAR_T
// end of file

View file

@ -8,13 +8,14 @@
// $Id$
//---------------------------------------------------------------------------
#include <SAX/ArabicaConfig.h>
#ifndef ARABICA_NO_WCHAR_T
#include <locale>
#if(_MSC_VER < 1300)
namespace std {
typedef ::mbstate_t mbstate_t;
}
#ifndef ARABICA_NO_CODECVT_SPECIALISATIONS
#include <Utils/impl/codecvt_specialisations.h>
#endif
#ifdef ARABICA_VS6_WORKAROUND
#include <Utils/impl/VS6Workaround.h>
#endif
namespace Arabica
@ -63,5 +64,4 @@ protected:
} // namespace convert
} // namespace Arabica
#endif // ARABICA_NO_WCHAR_T
#endif // ARABICA_UTF16BEUCS2_CODECVT_H
#endif

View file

@ -2,14 +2,10 @@
// $Id$
//---------------------------------------------------------------------------
#include "utf16leucs2codecvt.h"
#ifndef ARABICA_NO_WCHAR_T
#include "impl/ucs2_utf16.h"
#ifdef ARABICA_VS6_WORKAROUND
namespace std {
template<typename T>
T max(T a, T b) { return a > b ? a : b; }
}
#include <Utils/impl/VS6Workaround.h>
#endif
using namespace Arabica::convert;
@ -54,6 +50,5 @@ int utf16leucs2codecvt::do_length(const std::mbstate_t&,
return std::max<int>((end-from), max/2);
} // do_length
#endif // ARABICA_NO_WCHAR_T
// end of file

View file

@ -8,13 +8,14 @@
// $Id$
//---------------------------------------------------------------------------
#include <SAX/ArabicaConfig.h>
#ifndef ARABICA_NO_WCHAR_T
#include <locale>
#ifndef ARABICA_NO_CODECVT_SPECIALISATIONS
#include <Utils/impl/codecvt_specialisations.h>
#endif
#ifdef ARABICA_VS6_WORKAROUND
namespace std {
typedef ::mbstate_t mbstate_t;
}
#include <Utils/impl/VS6Workaround.h>
#endif
namespace Arabica
@ -63,5 +64,4 @@ protected:
} // namespace convert
} // namespace Arabica
#endif // ARABICA_NO_WCHAR_T
#endif // ARABICA_UTF16LEUCS2_CODECVT_H
#endif

View file

@ -2,7 +2,6 @@
// $Id$
//---------------------------------------------------------------------------
#include "utf16utf8codecvt.h"
#ifndef ARABICA_NO_WCHAR_T
#include "impl/ucs2_utf8.h"
//---------------------------------------------------------------------------
// This facet converts from wide chars to char using the
@ -38,7 +37,7 @@ std::codecvt_base::result utf16utf8codecvt::do_unshift(std::mbstate_t& /* state
wchar_t*& to_next) const
{
to_next = to;
return noconv;
return std::codecvt_base::noconv;
} // do_unshift
int utf16utf8codecvt::do_length(const std::mbstate_t&,
@ -62,6 +61,5 @@ int utf16utf8codecvt::do_length(const std::mbstate_t&,
return (from_next-from);
} // do_length
#endif // ARABICA_NO_WCHAR_T
// end of file

View file

@ -14,27 +14,26 @@
//---------------------------------------------------------------------------
#include <SAX/ArabicaConfig.h>
#ifndef ARABICA_NO_WCHAR_T
#include <locale>
namespace Arabica
{
namespace convert
{
#ifndef ARABICA_NO_CODECVT_SPECIALISATIONS
#include <Utils/impl/codecvt_specialisations.h>
#endif
#ifdef ARABICA_VS6_WORKAROUND
namespace std {
typedef ::mbstate_t mbstate_t;
}
#include <Utils/impl/VS6Workaround.h>
#endif
namespace Arabica
{
namespace convert
{
class utf16utf8codecvt : public std::codecvt<char, wchar_t, std::mbstate_t>
{
protected:
typedef std::codecvt_base::result result;
virtual ~utf16utf8codecvt() { }
virtual result do_out(std::mbstate_t&,
@ -73,7 +72,5 @@ protected:
} // namespace convert
} // namespace Arabica
#endif // ARABICA_NO_WCHAR_T
#endif

View file

@ -1,10 +1,9 @@
//---------------------------------------------------------------------------
// $Id$
//---------------------------------------------------------------------------
#include "utf8ucs2codecvt.h"
#ifndef ARABICA_NO_WCHAR_T
#include "impl/ucs2_utf16.h"
#include "impl/ucs2_utf8.h"
#include <Utils/utf8ucs2codecvt.h>
#include <Utils/impl/ucs2_utf16.h>
#include <Utils/impl/ucs2_utf8.h>
//---------------------------------------------------------------------------
using namespace Arabica::convert;
@ -80,6 +79,5 @@ int utf8ucs2codecvt::do_length(const std::mbstate_t&,
return (from_next-from);
} // do_length
#endif // ARABICA_NO_WCHAR_T
// end of file

View file

@ -13,13 +13,14 @@
// $Id$
//---------------------------------------------------------------------------
#include <SAX/ArabicaConfig.h>
#ifndef ARABICA_NO_WCHAR_T
#include <locale>
#if(_MSC_VER < 1300)
namespace std {
typedef ::mbstate_t mbstate_t;
}
#ifndef ARABICA_NO_CODECVT_SPECIALISATIONS
#include <Utils/impl/codecvt_specialisations.h>
#endif
#ifdef ARABICA_VS6_WORKAROUND
#include <Utils/impl/VS6Workaround.h>
#endif
namespace Arabica
@ -68,5 +69,4 @@ protected:
} // namespace convert
} // namespace Arabica
#endif // ARABICA_NO_WCHAR_T
#endif // ARABICA_UTF8UCS2_CODECVT_H
#endif