first phase of transition to unified Unicode build:

1. changed c_str() to return wxCStrData (implicitly convertible to wxChar*)
2. added template type-safe wrappers for vararg functions
3. added wxUniChar class representing single Unicode character
4. changed wxString::operator[] and wxString::iterator to return wxUniChar


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44865 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2007-03-17 10:26:10 +00:00
parent cd632a8617
commit c9f7896861
80 changed files with 2229 additions and 435 deletions

79
src/common/strvararg.cpp Normal file
View File

@@ -0,0 +1,79 @@
///////////////////////////////////////////////////////////////////////////////
// Name: src/common/strvararg.cpp
// Purpose: macros for implementing type-safe vararg passing of strings
// Author: Vaclav Slavik
// Created: 2007-02-19
// RCS-ID: $Id$
// Copyright: (c) 2007 REA Elektronik GmbH
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/strvararg.h"
#include "wx/buffer.h"
#include "wx/strconv.h"
#include "wx/string.h"
// ============================================================================
// implementation
// ============================================================================
const wxArgNativeCharType *wxArgNormalizer<const wxCStrData&>::get() const
{
return m_value;
}
const wxArgNativeCharType *wxArgNormalizer<const wxString&>::get() const
{
return m_value.c_str();
}
#if wxUSE_UNICODE_WCHAR
wxArgNormalizer<const char*>::wxArgNormalizer(const char *value)
{
m_value = new wxWCharBuffer(wxConvLibc.cMB2WC(value));
}
wxArgNormalizer<const char*>::~wxArgNormalizer()
{
delete m_value;
}
const wchar_t *wxArgNormalizer<const char*>::get() const
{
return m_value->data();
}
#elif wxUSE_WCHAR_T // !wxUSE_UNICODE_WCHAR && wxUSE_WCHAR_T
wxArgNormalizer<const wchar_t*>::wxArgNormalizer(const wchar_t *value)
{
m_value = new wxCharBuffer(wxConvLibc.cWC2MB(value));
}
wxArgNormalizer<const wchar_t*>::~wxArgNormalizer()
{
delete m_value;
}
const char *wxArgNormalizer<const wchar_t*>::get() const
{
return m_value->data();
}
#endif // wxUSE_UNICODE_WCHAR / !wxUSE_UNICODE_WCHAR && wxUSE_WCHAR_T