mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-26 07:39:45 -06:00
Import r67258 of the wxWidgets trunk, which I expect will before
long become wxWidgets 2.9.2, which in turn is expected to be the last 2.9 release before the 3.0 stable release. Since the full wxWidgets distribution is rather large, I have imported only the parts that we use, on a subdirectory basis: art include/wx/*.* include/wx/aui include/wx/cocoa include/wx/generic include/wx/gtk include/wx/meta include/wx/msw include/wx/osx include/wx/persist include/wx/private include/wx/protocol include/wx/unix src/aui src/common src/generic src/gtk src/msw src/osx src/unix git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7380 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
78
Externals/wxWidgets3/include/wx/numformatter.h
vendored
Normal file
78
Externals/wxWidgets3/include/wx/numformatter.h
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/numformatter.h
|
||||
// Purpose: wxNumberFormatter class
|
||||
// Author: Fulvio Senore, Vadim Zeitlin
|
||||
// Created: 2010-11-06
|
||||
// Copyright: (c) 2010 wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_NUMFORMATTER_H_
|
||||
#define _WX_NUMFORMATTER_H_
|
||||
|
||||
#include "wx/string.h"
|
||||
|
||||
// Helper class for formatting numbers with thousands separators which also
|
||||
// supports parsing the numbers formatted by it.
|
||||
class WXDLLIMPEXP_BASE wxNumberFormatter
|
||||
{
|
||||
public:
|
||||
// Bit masks for ToString()
|
||||
enum Style
|
||||
{
|
||||
Style_None = 0x00,
|
||||
Style_WithThousandsSep = 0x01,
|
||||
Style_NoTrailingZeroes = 0x02 // Only for floating point numbers
|
||||
};
|
||||
|
||||
// Format a number as a string. By default, the thousands separator is
|
||||
// used, specify Style_None to prevent this. For floating point numbers,
|
||||
// precision can also be specified.
|
||||
static wxString ToString(long val,
|
||||
int style = Style_WithThousandsSep);
|
||||
#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
|
||||
static wxString ToString(wxLongLong_t val,
|
||||
int style = Style_WithThousandsSep);
|
||||
#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
|
||||
static wxString ToString(double val,
|
||||
int precision,
|
||||
int style = Style_WithThousandsSep);
|
||||
|
||||
// Parse a string representing a number, possibly with thousands separator.
|
||||
//
|
||||
// Return true on success and stores the result in the provided location
|
||||
// which must be a valid non-NULL pointer.
|
||||
static bool FromString(wxString s, long *val);
|
||||
#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
|
||||
static bool FromString(wxString s, wxLongLong_t *val);
|
||||
#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
|
||||
static bool FromString(wxString s, double *val);
|
||||
|
||||
|
||||
// Get the decimal separator for the current locale. It is always defined
|
||||
// and we fall back to returning '.' in case of an error.
|
||||
static wxChar GetDecimalSeparator();
|
||||
|
||||
// Get the thousands separator if grouping of the digits is used by the
|
||||
// current locale. The value returned in sep should be only used if the
|
||||
// function returns true.
|
||||
static bool GetThousandsSeparatorIfUsed(wxChar *sep);
|
||||
|
||||
private:
|
||||
// Post-process the string representing an integer.
|
||||
static wxString PostProcessIntString(wxString s, int style);
|
||||
|
||||
// Add the thousands separators to a string representing a number without
|
||||
// the separators. This is used by ToString(Style_WithThousandsSep).
|
||||
static void AddThousandsSeparators(wxString& s);
|
||||
|
||||
// Remove trailing zeroes and, if there is nothing left after it, the
|
||||
// decimal separator itself from a string representing a floating point
|
||||
// number. Also used by ToString().
|
||||
static void RemoveTrailingZeroes(wxString& s);
|
||||
|
||||
// Remove all thousands separators from a string representing a number.
|
||||
static void RemoveThousandsSeparators(wxString& s);
|
||||
};
|
||||
|
||||
#endif // _WX_NUMFORMATTER_H_
|
Reference in New Issue
Block a user