Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | List of all members
NumericField Struct Referencefinal

#include <NumericConverterFormatter.h>

Public Member Functions

 NumericField (const NumericField &)=default
 
NumericFieldoperator= (const NumericField &)=default
 

Static Public Member Functions

static NumericField ForRange (size_t range, bool zeropad=true, size_t minDigits=0)
 
static NumericField WithDigits (size_t digits, bool zeropad=true)
 

Public Attributes

size_t digits { 0 }
 
wxString label
 
wxString formatStr
 
size_t pos { wxString::npos }
 

Private Member Functions

 NumericField (size_t digits, bool zeropad)
 

Detailed Description

Definition at line 22 of file NumericConverterFormatter.h.

Constructor & Destructor Documentation

◆ NumericField() [1/2]

NumericField::NumericField ( size_t  digits,
bool  zeropad 
)
private

Definition at line 36 of file NumericConverterFormatter.cpp.

37 : digits { _digits }
38{
39 if (zeropad && digits > 1)
40 formatStr.Printf(wxT("%%0%zud"), digits); // ex. "%03d" if digits is 3
41 else
42 formatStr = "%d";
43}
wxT("CloseDown"))

References digits, formatStr, and wxT().

Referenced by ForRange(), and WithDigits().

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

◆ NumericField() [2/2]

NumericField::NumericField ( const NumericField )
default

Member Function Documentation

◆ ForRange()

NumericField NumericField::ForRange ( size_t  range,
bool  zeropad = true,
size_t  minDigits = 0 
)
static

Definition at line 45 of file NumericConverterFormatter.cpp.

46{
47 // Previously, Audacity used 5 digits by default (why?)
48 return NumericField(
49 range > 1 ? std::max(minDigits, CalculateDigits(range)) : 5, zeropad);
50}
NumericField(size_t digits, bool zeropad)

References anonymous_namespace{NumericConverterFormatter.cpp}::CalculateDigits(), and NumericField().

Referenced by anonymous_namespace{ParsedNumericConverterFormatter.cpp}::ParsedNumericConverterFormatter::ParseFormatString(), anonymous_namespace{BeatsNumericConverterFormatter.cpp}::BeatsFormatter::UpdateFields(), and anonymous_namespace{BeatsNumericConverterFormatter.cpp}::BeatsFormatter::UpdateFormatForValue().

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

◆ operator=()

NumericField & NumericField::operator= ( const NumericField )
default

◆ WithDigits()

NumericField NumericField::WithDigits ( size_t  digits,
bool  zeropad = true 
)
static

Definition at line 52 of file NumericConverterFormatter.cpp.

53{
54 return NumericField(digits, zeropad);
55}

References digits, and NumericField().

Referenced by anonymous_namespace{BeatsNumericConverterFormatter.cpp}::BeatsFormatter::UpdateFields().

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

Member Data Documentation

◆ digits

size_t NumericField::digits { 0 }

Definition at line 35 of file NumericConverterFormatter.h.

Referenced by NumericField(), and WithDigits().

◆ formatStr

wxString NumericField::formatStr

Definition at line 38 of file NumericConverterFormatter.h.

Referenced by NumericField().

◆ label

wxString NumericField::label

Definition at line 37 of file NumericConverterFormatter.h.

◆ pos

size_t NumericField::pos { wxString::npos }

Definition at line 40 of file NumericConverterFormatter.h.


The documentation for this struct was generated from the following files: