Audacity 3.2.0
|
A context in which formatter operates. More...
#include <NumericConverterFormatterContext.h>
Public Member Functions | |
FormatterContext ()=default | |
FormatterContext (const FormatterContext &)=default | |
FormatterContext (FormatterContext &&)=default | |
FormatterContext & | operator= (const FormatterContext &)=default |
FormatterContext & | operator= (FormatterContext &&)=default |
~FormatterContext () | |
bool | HasProject () const |
Returns true if the reference to the project is valid at this moment. More... | |
std::shared_ptr< const AudacityProject > | GetProject () const |
Returns a potentially null pointer to the project. More... | |
bool | HasSampleRate () const |
Returns true if it is possible to get a sample rate from this context. More... | |
double | GetSampleRate (double defaultSampleRate=44100.0) const |
Returns a sample rate from this context. More... | |
Static Public Member Functions | |
static FormatterContext | EmptyContext () |
static FormatterContext | ProjectContext (const AudacityProject &project) |
static FormatterContext | SampleRateContext (double sampleRate) |
Private Member Functions | |
FormatterContext (const AudacityProject &project) | |
FormatterContext (double sampleRate) | |
Private Attributes | |
std::weak_ptr< const AudacityProject > | mProject |
std::optional< double > | mProjectRate |
A context in which formatter operates.
This class is used to pass additional information to the formatter, allowing AudacityProject to be an optional dependency
Definition at line 23 of file NumericConverterFormatterContext.h.
|
explicitprivate |
Definition at line 17 of file NumericConverterFormatterContext.cpp.
|
explicitprivate |
Definition at line 22 of file NumericConverterFormatterContext.cpp.
|
default |
|
default |
|
default |
FormatterContext::~FormatterContext | ( | ) |
Definition at line 43 of file NumericConverterFormatterContext.cpp.
|
static |
Definition at line 27 of file NumericConverterFormatterContext.cpp.
Referenced by TagsEditorDialog::PopulateOrExchange(), TimerRecordDialog::PopulateOrExchange(), and ExtImportPrefs::PopulateOrExchange().
std::shared_ptr< const AudacityProject > FormatterContext::GetProject | ( | ) | const |
Returns a potentially null pointer to the project.
Definition at line 52 of file NumericConverterFormatterContext.cpp.
References mProject.
Referenced by GetSampleRate().
double FormatterContext::GetSampleRate | ( | double | defaultSampleRate = 44100.0 | ) | const |
Returns a sample rate from this context.
Definition at line 62 of file NumericConverterFormatterContext.cpp.
References ProjectRate::Get(), GetProject(), ProjectRate::GetRate(), mProjectRate, and project.
bool FormatterContext::HasProject | ( | ) | const |
Returns true if the reference to the project is valid at this moment.
This operation is not thread-safe.The project isn't locked. Generally it is safe to assume that project outlives any of the formatters, so HasProject()
can be used as a hint when building the UI.
Definition at line 47 of file NumericConverterFormatterContext.cpp.
References mProject.
Referenced by HasSampleRate(), and anonymous_namespace{BeatsNumericConverterFormatter.cpp}::BeatsNumericConverterFormatterFactory::IsAcceptableInContext().
bool FormatterContext::HasSampleRate | ( | ) | const |
Returns true if it is possible to get a sample rate from this context.
Definition at line 57 of file NumericConverterFormatterContext.cpp.
References HasProject(), and mProjectRate.
Referenced by anonymous_namespace{ParsedNumericConverterFormatter.cpp}::ParsedNumericConverterFormatterFactory::IsAcceptableInContext().
|
default |
|
default |
|
static |
Definition at line 33 of file NumericConverterFormatterContext.cpp.
References project.
Referenced by SelectionBar::AddTime(), ProjectNumericFormats::LookupFormat(), LabelDialog::OnFreqUpdate(), LabelDialog::OnUpdate(), SpectralSelectionBar::Populate(), TimeToolBar::Populate(), LabelDialog::PopulateOrExchange(), TimeDialog::PopulateOrExchange(), TEST_CASE(), and SelectionBar::UpdatePrefs().
|
static |
Definition at line 38 of file NumericConverterFormatterContext.cpp.
References anonymous_namespace{ClipSegmentTest.cpp}::sampleRate.
Referenced by NyquistEffect::BuildEffectWindow(), LV2Editor::BuildPlain(), VSTEditor::BuildPlain(), ContrastDialog::ContrastDialog(), EffectRepeat::DisplayNewTime(), EffectChangeSpeed::OnTimeCtrlUpdate(), EffectDtmf::Editor::PopulateOrExchange(), EffectChangeSpeed::PopulateOrExchange(), EffectNoise::PopulateOrExchange(), EffectSilence::PopulateOrExchange(), EffectToneGen::PopulateOrExchange(), LadspaEditor::PopulateUI(), TEST_CASE(), and VST3Editor::VST3Editor().
|
private |
Definition at line 56 of file NumericConverterFormatterContext.h.
Referenced by GetProject(), and HasProject().
|
private |
Definition at line 57 of file NumericConverterFormatterContext.h.
Referenced by GetSampleRate(), and HasSampleRate().