initial declaration of wx*Char*Buffer and wxUniChar* classes (need someone more experienced to document the various methods)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57063 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -6,6 +6,78 @@
|
|||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
wxCharTypeBuffer<T> is a template class for storing characters.
|
||||||
|
|
||||||
|
@todo provide better docs for this class
|
||||||
|
|
||||||
|
@nolibrary
|
||||||
|
@category{misc}
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
class wxCharTypeBuffer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef T CharType;
|
||||||
|
|
||||||
|
wxCharTypeBuffer(const CharType *str = NULL);
|
||||||
|
wxCharTypeBuffer(size_t len);
|
||||||
|
wxCharTypeBuffer(const wxCharTypeBuffer& src);
|
||||||
|
~wxCharTypeBuffer();
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
wxCharTypeBuffer& operator=(const CharType *str);
|
||||||
|
wxCharTypeBuffer& operator=(const wxCharTypeBuffer& src);
|
||||||
|
|
||||||
|
bool extend(size_t len);
|
||||||
|
|
||||||
|
CharType *data();
|
||||||
|
const CharType *data() const;
|
||||||
|
operator const CharType *() const;
|
||||||
|
CharType operator[](size_t n) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
This is a specialization of wxCharTypeBuffer<T> for @c char type.
|
||||||
|
|
||||||
|
@todo provide better docs for this class
|
||||||
|
|
||||||
|
@nolibrary
|
||||||
|
@category{misc}
|
||||||
|
*/
|
||||||
|
class wxCharBuffer : public wxCharTypeBuffer<char>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef wxCharTypeBuffer<char> wxCharTypeBufferBase;
|
||||||
|
|
||||||
|
wxCharBuffer(const wxCharTypeBufferBase& buf);
|
||||||
|
wxCharBuffer(const CharType *str = NULL);
|
||||||
|
wxCharBuffer(size_t len);
|
||||||
|
wxCharBuffer(const wxCStrData& cstr);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
This is a specialization of wxCharTypeBuffer<T> for @c wchar_t type.
|
||||||
|
This class is available only when <tt>wxUSE_WCHAR_T==1</tt>
|
||||||
|
|
||||||
|
@nolibrary
|
||||||
|
@category{misc}
|
||||||
|
*/
|
||||||
|
class wxWCharBuffer : public wxCharTypeBuffer<wchar_t>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef wxCharTypeBuffer<wchar_t> wxCharTypeBufferBase;
|
||||||
|
|
||||||
|
wxWCharBuffer(const wxCharTypeBufferBase& buf);
|
||||||
|
wxWCharBuffer(const CharType *str = NULL);
|
||||||
|
wxWCharBuffer(size_t len);
|
||||||
|
wxWCharBuffer(const wxCStrData& cstr);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class wxMemoryBuffer
|
@class wxMemoryBuffer
|
||||||
|
|
||||||
|
112
interface/wx/unichar.h
Normal file
112
interface/wx/unichar.h
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: unichar.h
|
||||||
|
// Purpose: interface of wxUniChar
|
||||||
|
// Author: wxWidgets team
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxUniChar
|
||||||
|
|
||||||
|
This class represents a single Unicode character. It can be converted to
|
||||||
|
and from @c char or @c wchar_t and implements commonly used character operations.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{data}
|
||||||
|
*/
|
||||||
|
class wxUniChar
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
This is not wchar_t on purpose, it needs to represent the entire
|
||||||
|
Unicode code points range and wchar_t may be too small for that
|
||||||
|
(e.g. on Win32 where wchar_t* is encoded in UTF-16).
|
||||||
|
*/
|
||||||
|
typedef wxUint32 value_type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Default ctor.
|
||||||
|
*/
|
||||||
|
wxUniChar()
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Create the character from 8bit character value encoded in the current
|
||||||
|
locale's charset.
|
||||||
|
*/
|
||||||
|
wxUniChar(char c);
|
||||||
|
wxUniChar(unsigned char c);
|
||||||
|
//@}
|
||||||
|
|
||||||
|
wxUniChar(int c);
|
||||||
|
wxUniChar(unsigned int c);
|
||||||
|
wxUniChar(long int c);
|
||||||
|
wxUniChar(unsigned long int c);
|
||||||
|
wxUniChar(short int c);
|
||||||
|
wxUniChar(unsigned short int c);
|
||||||
|
|
||||||
|
wxUniChar(const wxUniCharRef& c);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns Unicode code point value of the character.
|
||||||
|
*/
|
||||||
|
value_type GetValue() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns true if the character is an ASCII character.
|
||||||
|
*/
|
||||||
|
bool IsAscii() const;
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Conversions to char and wchar_t types: all of those are needed to be
|
||||||
|
able to pass wxUniChars to various standard narrow and wide character
|
||||||
|
functions.
|
||||||
|
*/
|
||||||
|
operator char() const { return To8bit(m_value); }
|
||||||
|
operator unsigned char() const { return (unsigned char)To8bit(m_value); }
|
||||||
|
operator wchar_t() const { return (wchar_t)m_value; }
|
||||||
|
operator int() const { return (int)m_value; }
|
||||||
|
operator unsigned int() const { return (unsigned int)m_value; }
|
||||||
|
operator long int() const { return (long int)m_value; }
|
||||||
|
operator unsigned long int() const { return (unsigned long)m_value; }
|
||||||
|
operator short int() const { return (short int)m_value; }
|
||||||
|
operator unsigned short int() const { return (unsigned short int)m_value; }
|
||||||
|
//@}
|
||||||
|
|
||||||
|
//@{
|
||||||
|
/**
|
||||||
|
Assignment operators
|
||||||
|
*/
|
||||||
|
wxUniChar& operator=(const wxUniChar& c);
|
||||||
|
wxUniChar& operator=(const wxUniCharRef& c);
|
||||||
|
wxUniChar& operator=(char c);
|
||||||
|
wxUniChar& operator=(unsigned char c);
|
||||||
|
wxUniChar& operator=(wchar_t c);
|
||||||
|
wxUniChar& operator=(int c);
|
||||||
|
wxUniChar& operator=(unsigned int c);
|
||||||
|
wxUniChar& operator=(long int c);
|
||||||
|
wxUniChar& operator=(unsigned long int c);
|
||||||
|
wxUniChar& operator=(short int c);
|
||||||
|
wxUniChar& operator=(unsigned short int c);
|
||||||
|
//@}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class wxUniCharRef
|
||||||
|
|
||||||
|
Writeable reference to a character in wxString.
|
||||||
|
|
||||||
|
This class can be used in the same way wxChar is used, except that changing
|
||||||
|
its value updates the underlying string object.
|
||||||
|
|
||||||
|
@library{wxbase}
|
||||||
|
@category{data}
|
||||||
|
*/
|
||||||
|
class wxUniCharRef
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
};
|
||||||
|
|
Reference in New Issue
Block a user