wxNativeEncoding::To/FromString now stores wxFontEncoding info as well (don't worry, wxFontMapper stores data under different name now)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5460 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2000-01-16 22:53:19 +00:00
parent 62ea506eaf
commit 1e1d0be191
5 changed files with 55 additions and 13 deletions

View File

@@ -48,12 +48,18 @@
// ----------------------------------------------------------------------------
// convert to/from the string representation: format is
// facename[;charset]
// encodingid;facename[;charset]
bool wxNativeEncodingInfo::FromString(const wxString& s)
{
wxStringTokenizer tokenizer(s, _T(";"));
wxString encid = tokenizer.GetNextToken();
long enc;
if ( !encid.ToLong(&enc) )
return FALSE;
encoding = (wxFontEncoding)enc;
facename = tokenizer.GetNextToken();
if ( !facename )
return FALSE;
@@ -79,7 +85,10 @@ bool wxNativeEncodingInfo::FromString(const wxString& s)
wxString wxNativeEncodingInfo::ToString() const
{
wxString s(facename);
wxString s;
s << (long)encoding << _T(';') << facename;
if ( charset != 0 )
{
s << _T(';') << charset;

View File

@@ -48,12 +48,18 @@
// ----------------------------------------------------------------------------
// convert to/from the string representation: format is
// facename[;charset]
// encodingid;facename[;charset]
bool wxNativeEncodingInfo::FromString(const wxString& s)
{
wxStringTokenizer tokenizer(s, _T(";"));
wxString encid = tokenizer.GetNextToken();
long enc;
if ( !encid.ToLong(&enc) )
return FALSE;
encoding = (wxFontEncoding)enc;
facename = tokenizer.GetNextToken();
if ( !facename )
return FALSE;
@@ -79,7 +85,10 @@ bool wxNativeEncodingInfo::FromString(const wxString& s)
wxString wxNativeEncodingInfo::ToString() const
{
wxString s(facename);
wxString s;
s << (long)encoding << _T(';') << facename;
if ( charset != 0 )
{
s << _T(';') << charset;

View File

@@ -50,12 +50,18 @@
// ----------------------------------------------------------------------------
// convert to/from the string representation: format is
// facename[;charset]
// encodingid;facename[;charset]
bool wxNativeEncodingInfo::FromString(const wxString& s)
{
wxStringTokenizer tokenizer(s, _T(";"));
wxString encid = tokenizer.GetNextToken();
long enc;
if ( !encid.ToLong(&enc) )
return FALSE;
encoding = (wxFontEncoding)enc;
facename = tokenizer.GetNextToken();
if ( !facename )
return FALSE;
@@ -81,10 +87,12 @@ bool wxNativeEncodingInfo::FromString(const wxString& s)
wxString wxNativeEncodingInfo::ToString() const
{
wxString s(facename);
wxString s;
s << (long)encoding << _T(';') << facename;
if ( charset != ANSI_CHARSET )
{
s << _T(';') << charset;
s << _T(';') << charset;
}
return s;

View File

@@ -42,12 +42,18 @@
// ----------------------------------------------------------------------------
// convert to/from the string representation: format is
// facename[;charset]
// encodingid;facename[;charset]
bool wxNativeEncodingInfo::FromString(const wxString& s)
{
wxStringTokenizer tokenizer(s, _T(";"));
wxString encid = tokenizer.GetNextToken();
long enc;
if ( !encid.ToLong(&enc) )
return FALSE;
encoding = (wxFontEncoding)enc;
facename = tokenizer.GetNextToken();
if ( !facename )
return FALSE;
@@ -74,7 +80,10 @@ bool wxNativeEncodingInfo::FromString(const wxString& s)
wxString wxNativeEncodingInfo::ToString() const
{
wxString s(facename);
wxString s;
s << (long)encoding << _T(';') << facename;
// TODO: what is this for OS/2?
/*
if ( charset != ANSI_CHARSET )

View File

@@ -106,10 +106,17 @@ static wxNativeFont wxLoadQueryFont(int pointSize,
// ----------------------------------------------------------------------------
// convert to/from the string representation: format is
// registry-encoding[-facename]
// encodingid;registry;encoding[;facename]
bool wxNativeEncodingInfo::FromString(const wxString& s)
{
wxStringTokenizer tokenizer(s, _T("-"));
wxStringTokenizer tokenizer(s, _T(";"));
// cannot use "-" because it may be part of encoding name
wxString encid = tokenizer.GetNextToken();
long enc;
if ( !encid.ToLong(&enc) )
return FALSE;
encoding = (wxFontEncoding)enc;
xregistry = tokenizer.GetNextToken();
if ( !xregistry )
@@ -128,10 +135,10 @@ bool wxNativeEncodingInfo::FromString(const wxString& s)
wxString wxNativeEncodingInfo::ToString() const
{
wxString s;
s << xregistry << _T('-') << xencoding;
s << (long)encoding << _T(';') << xregistry << _T(';') << xencoding;
if ( !!facename )
{
s << _T('-') << facename;
s << _T(';') << facename;
}
return s;