System.SysUtils.TFormatSettings

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

TFormatSettings = record

C++

struct DECLSPEC_DRECORD TFormatSettings
{
public:
    struct DECLSPEC_DRECORD TEraInfo
    {
    public:
        System::UnicodeString EraName;
        int EraOffset;
        System::TDate EraStart;
        System::TDate EraEnd;
    };
private:
    typedef System::StaticArray<System::UnicodeString, 12> _TFormatSettings__1;
    typedef System::StaticArray<System::UnicodeString, 12> _TFormatSettings__2;
    typedef System::StaticArray<System::UnicodeString, 7> _TFormatSettings__3;
    typedef System::StaticArray<System::UnicodeString, 7> _TFormatSettings__4;
    typedef System::DynamicArray<TEraInfo> _TFormatSettings__5;
private:
    static void __fastcall GetDayNames(TLocaleID Locale, TFormatSettings &AFormatSettings);
    static void __fastcall GetMonthNames(TLocaleID Locale, TFormatSettings &AFormatSettings);
    static void __fastcall GetEraInformation(TLocaleID Locale, TFormatSettings &AFormatSettings);
    static System::UnicodeString __fastcall GetString(TLocaleID Locale, int LocaleItem, int DefaultIndex, void * const *DefaultValues, const System::NativeInt DefaultValues_High);
private:
    static System::UnicodeString __fastcall TranslateDateFormat(TLocaleID Locale, int LocaleType, const System::UnicodeString Default, const System::WideChar SepDate, const System::WideChar SepTime)/* overload */;
    static System::UnicodeString __fastcall TranslateDateFormat(const System::UnicodeString Format, TLocaleID Locale, const System::WideChar SepDate, const System::WideChar SepTime)/* overload */;
    static System::UnicodeString __fastcall TranslateTimeFormat(TLocaleID Locale, int LocaleType, const System::UnicodeString Default, const System::WideChar SepTime)/* overload */;
    static System::UnicodeString __fastcall TranslateTimeFormat(const System::UnicodeString Format, TLocaleID Locale, const System::WideChar SepTime)/* overload */;
    static System::UnicodeString __fastcall AdjustLocaleName(const System::UnicodeString LocaleName, const System::UnicodeString ACharSet = System::UnicodeString());
public:
    System::UnicodeString CurrencyString;
    System::Byte CurrencyFormat;
    System::Byte CurrencyDecimals;
    System::WideChar DateSeparator;
    System::WideChar TimeSeparator;
    System::WideChar ListSeparator;
    System::UnicodeString ShortDateFormat;
    System::UnicodeString LongDateFormat;
    System::UnicodeString TimeAMString;
    System::UnicodeString TimePMString;
    System::UnicodeString ShortTimeFormat;
    System::UnicodeString LongTimeFormat;
    _TFormatSettings__1 ShortMonthNames;
    _TFormatSettings__2 LongMonthNames;
    _TFormatSettings__3 ShortDayNames;
    _TFormatSettings__4 LongDayNames;
    _TFormatSettings__5 EraInfo;
    System::WideChar ThousandSeparator;
    System::WideChar DecimalSeparator;
    System::Word TwoDigitYearCenturyWindow;
    System::Byte NegCurrFormat;
    System::UnicodeString NormalizedLocaleName;
    static TFormatSettings __fastcall Create()/* overload */;
    static TFormatSettings __fastcall Create(TLocaleID Locale)/* overload */;
    static TFormatSettings __fastcall Create(const System::UnicodeString LocaleName)/* overload */;
    static TFormatSettings __fastcall Invariant();
    int __fastcall GetEraYearOffset(const System::UnicodeString Name);
};

Properties

Type Visibility Source Unit Parent
record
struct
public
System.SysUtils.pas
System.SysUtils.hpp
System.SysUtils System.SysUtils

Description

TFormatSettings defines a thread-safe string formatting context.

TFormatSettings defines a data structure containing locale information used by the string formatting routine. Each member of TFormatSettings is equivalent to the global variable with the same name. A variable of type TFormatSettings defines a thread-safe context that formatting functions can use in place of the default global context, which is not thread-safe.

To create and use the thread-safe environment defined by TFormatSettings, follow these steps:

  1. Declare a variable of type TFormatSettings.
  2. Call TFormatSettings.Create to populate the TFormatSettings variable with locale information.
  3. Pass the TFormatSettings variable as the last parameter of the string formatting routine.

Each routine that accepts a TFormatSettings parameter is thread-safe, and is an overload of an equivalent function that refers to the global formatting variables.

Code Examples