git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27952
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// Plural forms parser
// ----------------------------------------------------------------------------
// Plural forms parser
// ----------------------------------------------------------------------------
Simplified Grammar
Expression:
Simplified Grammar
Expression:
MultiplicativeExpression ">=" MultiplicativeExpression
MultiplicativeExpression "<=" MultiplicativeExpression
MultiplicativeExpression
MultiplicativeExpression ">=" MultiplicativeExpression
MultiplicativeExpression "<=" MultiplicativeExpression
MultiplicativeExpression
MultiplicativeExpression:
PmExpression '%' PmExpression
PmExpression
MultiplicativeExpression:
PmExpression '%' PmExpression
PmExpression
wxPluralFormsToken m_token;
wxPluralFormsNodePtr m_nodes[3];
};
wxPluralFormsToken m_token;
wxPluralFormsNodePtr m_nodes[3];
};
wxPluralFormsNodePtr::~wxPluralFormsNodePtr()
{
delete m_p;
wxPluralFormsNodePtr::~wxPluralFormsNodePtr()
{
delete m_p;
{
public:
wxPluralFormsCalculator() : m_nplurals(0), m_plural(0) {}
{
public:
wxPluralFormsCalculator() : m_nplurals(0), m_plural(0) {}
// input: number, returns msgstr index
int evaluate(int n) const;
// input: number, returns msgstr index
int evaluate(int n) const;
void init(wxPluralFormsToken::Number nplurals, wxPluralFormsNode* plural);
wxString getString() const;
void init(wxPluralFormsToken::Number nplurals, wxPluralFormsNode* plural);
wxString getString() const;
private:
wxPluralFormsToken::Number m_nplurals;
wxPluralFormsNodePtr m_plural;
private:
wxPluralFormsToken::Number m_nplurals;
wxPluralFormsNodePtr m_plural;
wxPluralFormsScanner& m_scanner;
const wxPluralFormsToken& token() const;
bool nextToken();
wxPluralFormsScanner& m_scanner;
const wxPluralFormsToken& token() const;
bool nextToken();
wxPluralFormsNode* expression();
wxPluralFormsNode* logicalOrExpression();
wxPluralFormsNode* logicalAndExpression();
wxPluralFormsNode* expression();
wxPluralFormsNode* logicalOrExpression();
wxPluralFormsNode* logicalAndExpression();
*m_pTransTable; // translated
wxString m_charset;
*m_pTransTable; // translated
wxString m_charset;
// swap the 2 halves of 32 bit integer if needed
size_t32 Swap(size_t32 ui) const
{
// swap the 2 halves of 32 bit integer if needed
size_t32 Swap(size_t32 ui) const
{
}
return (const char *)(m_pData + ofsString);
}
return (const char *)(m_pData + ofsString);
bool m_bSwapped; // wrong endianness?
bool m_bSwapped; // wrong endianness?
m_pTransTable = (wxMsgTableEntry *)(m_pData +
Swap(pHeader->ofsTransTable));
m_nSize = nSize;
m_pTransTable = (wxMsgTableEntry *)(m_pData +
Swap(pHeader->ofsTransTable));
m_nSize = nSize;
// now parse catalog's header and try to extract catalog charset and
// plural forms formula from it:
// now parse catalog's header and try to extract catalog charset and
// plural forms formula from it:
}
}
// else: incorrectly filled Content-Type header
}
}
// else: incorrectly filled Content-Type header
// Extract plural forms:
begin = header.Find(wxT("Plural-Forms:"));
if (begin != wxNOT_FOUND)
// Extract plural forms:
begin = header.Find(wxT("Plural-Forms:"));
if (begin != wxNOT_FOUND)
{
wxASSERT_MSG( !m_initialized,
_T("you can't call wxLocale::Init more than once") );
{
wxASSERT_MSG( !m_initialized,
_T("you can't call wxLocale::Init more than once") );
m_initialized = true;
m_strLocale = szName;
m_strShort = szShort;
m_initialized = true;
m_strLocale = szName;
m_strShort = szShort;
- m_pszOldLocale = wxStrdup(localeName);
+ m_pszOldLocale = wxStrdup(localeName);
}
else
m_pszOldLocale = NULL;
}
else
m_pszOldLocale = NULL;
// #ifdef SETLOCALE_FAILS_ON_UNICODE_LANGS bellow.
#define SETLOCALE_FAILS_ON_UNICODE_LANGS
#endif
// #ifdef SETLOCALE_FAILS_ON_UNICODE_LANGS bellow.
#define SETLOCALE_FAILS_ON_UNICODE_LANGS
#endif
+
+#if !wxUSE_UNICODE
+ const
+#endif
wxMB2WXbuf retloc = wxT("C");
if (language != wxLANGUAGE_DEFAULT)
{
wxMB2WXbuf retloc = wxT("C");
if (language != wxLANGUAGE_DEFAULT)
{
#ifdef SETLOCALE_FAILS_ON_UNICODE_LANGS
= -1
#endif
#ifdef SETLOCALE_FAILS_ON_UNICODE_LANGS
= -1
#endif
default:
return wxEmptyString;
}
default:
return wxEmptyString;
}
#endif // __WXMSW__/!__WXMSW__
#endif // __WXMSW__/!__WXMSW__