Audacity 3.2.0
Classes | Functions
NumericConverterFormats Namespace Reference

Classes

struct  DefaultFormatRegistrator
 

Functions

NumericFormatSymbol Default (const NumericConverterType &type)
 Returns the default format for the type or empty symbol, if no default symbol is registered. More...
 
NUMERIC_FORMATS_API NumericFormatSymbol Lookup (const FormatterContext &context, const NumericConverterType &type, const NumericFormatID &formatIdentifier)
 Looks up the format, returns Default for the type if the format is not registered. More...
 
NUMERIC_FORMATS_API NumericFormatSymbol DefaultSelectionFormat ()
 
NUMERIC_FORMATS_API NumericFormatSymbol TimeAndSampleFormat ()
 
NUMERIC_FORMATS_API NumericFormatSymbol SecondsFormat ()
 
NUMERIC_FORMATS_API NumericFormatSymbol HoursMinsSecondsFormat ()
 
NUMERIC_FORMATS_API NumericFormatSymbol MillisecondsFormat ()
 
NUMERIC_FORMATS_API NumericFormatSymbol HundredthsFormat ()
 
NUMERIC_FORMATS_API NumericFormatSymbol HertzFormat ()
 
NUMERIC_FORMATS_API NumericFormatSymbol OctavesFormat ()
 
NUMERIC_FORMATS_API NumericFormatID GetBestDurationFormat (const NumericFormatID &timeFormat)
 Return the best duration format for the given time format. Currently is an identity function. More...
 

Function Documentation

◆ Default()

NUMERIC_FORMATS_API NumericFormatSymbol NumericConverterFormats::Default ( const NumericConverterType type)

Returns the default format for the type or empty symbol, if no default symbol is registered.

Definition at line 47 of file NumericConverterFormats.cpp.

48{
49 auto& defaultSymbols = GetDefaultSymbols();
50
51 auto it = defaultSymbols.find(type);
52
53 if (it != defaultSymbols.end())
54 return it->second;
55
56 // Fail the debug build early
57 assert(false);
58
59 return {};
60}
std::unordered_map< NumericConverterType, NumericFormatSymbol > & GetDefaultSymbols()

References anonymous_namespace{NumericConverterFormats.cpp}::GetDefaultSymbols().

Referenced by Lookup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DefaultSelectionFormat()

NUMERIC_FORMATS_API NumericFormatSymbol NumericConverterFormats::DefaultSelectionFormat ( )

Definition at line 78 of file NumericConverterFormats.cpp.

79{
80 return MillisecondsFormat();
81}
NUMERIC_FORMATS_API NumericFormatSymbol MillisecondsFormat()

References MillisecondsFormat().

Referenced by ChangeSpeedBase::ChangeSpeedBase(), EffectBase::DoEffect(), and ChangeSpeedBase::DoLoadFactoryDefaults().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetBestDurationFormat()

NUMERIC_FORMATS_API NumericFormatID NumericConverterFormats::GetBestDurationFormat ( const NumericFormatID timeFormat)

Return the best duration format for the given time format. Currently is an identity function.

Definition at line 130 of file NumericConverterFormats.cpp.

131{
132 return timeFormat;
133}

Referenced by SelectionBar::UpdateTimeControlsFormat().

Here is the caller graph for this function:

◆ HertzFormat()

NUMERIC_FORMATS_API NumericFormatSymbol NumericConverterFormats::HertzFormat ( )

Definition at line 117 of file NumericConverterFormats.cpp.

118{
119 /* i18n-hint: Name of display format that shows frequency in hertz */
120 return { XO("Hz") };
121}
XO("Cut/Copy/Paste")

References XO().

Referenced by Grid::Grid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HoursMinsSecondsFormat()

NUMERIC_FORMATS_API NumericFormatSymbol NumericConverterFormats::HoursMinsSecondsFormat ( )

Definition at line 96 of file NumericConverterFormats.cpp.

97{
98 /* i18n-hint: Name of time display format that shows time in hours, minutes
99 * and seconds */
100 return { XO("hh:mm:ss") };
101}

References XO().

Referenced by Effect::GetSelectionFormat(), and TimeToolBar::SetToDefaultSize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HundredthsFormat()

NUMERIC_FORMATS_API NumericFormatSymbol NumericConverterFormats::HundredthsFormat ( )

Definition at line 110 of file NumericConverterFormats.cpp.

111{
112 /* i18n-hint: Name of time display format that shows time in hours,
113 * minutes, seconds and hundredths of a second (1/100 second) */
114 return { XO("hh:mm:ss + hundredths") };
115}

References XO().

Referenced by ContrastDialog::ContrastDialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lookup()

NUMERIC_FORMATS_API NumericFormatSymbol NumericConverterFormats::Lookup ( const FormatterContext context,
const NumericConverterType type,
const NumericFormatID formatIdentifier 
)

Looks up the format, returns Default for the type if the format is not registered.

Definition at line 62 of file NumericConverterFormats.cpp.

66{
67 if (formatIdentifier.empty())
68 return Default(type);
69
70 auto result = NumericConverterRegistry::Find(context, type, { formatIdentifier });
71
72 if (result == nullptr)
73 return Default(type);
74
75 return result->symbol;
76}
bool empty() const
Definition: Identifier.h:61
NumericFormatSymbol Default(const NumericConverterType &type)
Returns the default format for the type or empty symbol, if no default symbol is registered.
static const NumericConverterRegistryItem * Find(const FormatterContext &context, const NumericConverterType &type, const NumericFormatID &symbol)

References Default(), Identifier::empty(), and NumericConverterRegistry::Find().

Referenced by ProjectSerializer::Decode(), ProjectNumericFormats::LookupFormat(), LabelDialog::OnFreqUpdate(), EffectChangeSpeed::OnTimeCtrlUpdate(), LabelDialog::OnUpdate(), EffectChangeSpeed::PopulateOrExchange(), NumericConverter::SetFormatName(), and SelectionBar::UpdatePrefs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MillisecondsFormat()

NUMERIC_FORMATS_API NumericFormatSymbol NumericConverterFormats::MillisecondsFormat ( )

Definition at line 103 of file NumericConverterFormats.cpp.

104{
105 /* i18n-hint: Name of time display format that shows time in hours,
106 * minutes, seconds and milliseconds (1/1000 second) */
107 return { XO("hh:mm:ss + milliseconds") };
108}

References XO().

Referenced by DefaultSelectionFormat().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OctavesFormat()

NUMERIC_FORMATS_API NumericFormatSymbol NumericConverterFormats::OctavesFormat ( )

Definition at line 123 of file NumericConverterFormats.cpp.

124{
125 /* i18n-hint: Name of display format that shows log of frequency
126 * in octaves */
127 return { XO("octaves") };
128}

References XO().

Here is the call graph for this function:

◆ SecondsFormat()

NUMERIC_FORMATS_API NumericFormatSymbol NumericConverterFormats::SecondsFormat ( )

Definition at line 90 of file NumericConverterFormats.cpp.

91{
92 /* i18n-hint: Name of time display format that shows time in seconds */
93 return { XO("seconds") };
94}

References XO().

Referenced by Grid::Grid().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TimeAndSampleFormat()

NUMERIC_FORMATS_API NumericFormatSymbol NumericConverterFormats::TimeAndSampleFormat ( )

Definition at line 83 of file NumericConverterFormats.cpp.

84{
85 /* i18n-hint: Name of time display format that shows time in hours,
86 * minutes, seconds and samples (at the current project sample rate) */
87 return { XO("hh:mm:ss + samples") };
88}

References XO().

Referenced by EffectBase::DoEffect().

Here is the call graph for this function:
Here is the caller graph for this function: