Audacity 3.2.0
Public Types | Public Member Functions | Private Attributes | List of all members
Registry::OrderingPreferenceInitializer Struct Reference

#include <Registry.h>

Inheritance diagram for Registry::OrderingPreferenceInitializer:
[legend]
Collaboration diagram for Registry::OrderingPreferenceInitializer:
[legend]

Public Types

using Literal = const wxChar *
 
using Pair = std::pair< Literal, Literal >
 
using Pairs = std::vector< Pair >
 

Public Member Functions

 OrderingPreferenceInitializer (Literal root, Pairs pairs)
 
void operator() () override
 
- Public Member Functions inherited from PreferenceInitializer
 PreferenceInitializer ()
 
virtual ~PreferenceInitializer ()
 
virtual void operator() ()=0
 

Private Attributes

Pairs mPairs
 
Literal mRoot
 

Additional Inherited Members

- Static Public Member Functions inherited from PreferenceInitializer
static void ReinitializeAll ()
 

Detailed Description

Definition at line 642 of file Registry.h.

Member Typedef Documentation

◆ Literal

Definition at line 644 of file Registry.h.

◆ Pair

Definition at line 645 of file Registry.h.

◆ Pairs

Definition at line 646 of file Registry.h.

Constructor & Destructor Documentation

◆ OrderingPreferenceInitializer()

Registry::OrderingPreferenceInitializer::OrderingPreferenceInitializer ( Literal  root,
Pairs  pairs 
)

Definition at line 742 of file Registry.cpp.

744 : mPairs{ std::move( pairs ) }
745 , mRoot{ root }
746{
747 (*this)();
748}

Member Function Documentation

◆ operator()()

void Registry::OrderingPreferenceInitializer::operator() ( )
overridevirtual

Implements PreferenceInitializer.

Definition at line 750 of file Registry.cpp.

751{
752 bool doFlush = false;
753 for (const auto &pair : mPairs) {
754 const auto key = wxString{'/'} + mRoot + pair.first;
755 if ( gPrefs->Read(key).empty() ) {
756 gPrefs->Write( key, pair.second );
757 doFlush = true;
758 }
759 }
760
761 if (doFlush)
762 gPrefs->Flush();
763}
static const AudacityProject::AttachedObjects::RegisteredFactory key
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
virtual bool Flush() noexcept=0
virtual bool Write(const wxString &key, bool value)=0
virtual bool Read(const wxString &key, bool *value) const =0

References audacity::BasicSettings::Flush(), gPrefs, key, mPairs, mRoot, audacity::BasicSettings::Read(), and audacity::BasicSettings::Write().

Here is the call graph for this function:

Member Data Documentation

◆ mPairs

Pairs Registry::OrderingPreferenceInitializer::mPairs
private

Definition at line 659 of file Registry.h.

Referenced by operator()().

◆ mRoot

Literal Registry::OrderingPreferenceInitializer::mRoot
private

Definition at line 660 of file Registry.h.

Referenced by operator()().


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