Audacity  3.0.3
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 ()
 

Private Attributes

Pairs mPairs
 
Literal mRoot
 

Additional Inherited Members

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

Detailed Description

Definition at line 272 of file Registry.h.

Member Typedef Documentation

◆ Literal

Definition at line 274 of file Registry.h.

◆ Pair

Definition at line 275 of file Registry.h.

◆ Pairs

Definition at line 276 of file Registry.h.

Constructor & Destructor Documentation

◆ OrderingPreferenceInitializer()

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

Definition at line 727 of file Registry.cpp.

729  : mPairs{ std::move( pairs ) }
730  , mRoot{ root }
731 {
732  (*this)();
733 }

Member Function Documentation

◆ operator()()

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

Implements PreferenceInitializer.

Definition at line 735 of file Registry.cpp.

736 {
737  bool doFlush = false;
738  for (const auto &pair : mPairs) {
739  const auto key = wxString{'/'} + mRoot + pair.first;
740  if ( gPrefs->Read(key).empty() ) {
741  gPrefs->Write( key, pair.second );
742  doFlush = true;
743  }
744  }
745 
746  if (doFlush)
747  gPrefs->Flush();
748 }

References FileConfig::Flush(), gPrefs, key, mPairs, and mRoot.

Here is the call graph for this function:

Member Data Documentation

◆ mPairs

Pairs Registry::OrderingPreferenceInitializer::mPairs
private

Definition at line 289 of file Registry.h.

Referenced by operator()().

◆ mRoot

Literal Registry::OrderingPreferenceInitializer::mRoot
private

Definition at line 290 of file Registry.h.

Referenced by operator()().


The documentation for this struct was generated from the following files:
gPrefs
FileConfig * gPrefs
Definition: Prefs.cpp:70
Registry::OrderingPreferenceInitializer::mPairs
Pairs mPairs
Definition: Registry.h:289
FileConfig::Flush
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143
key
static const AudacityProject::AttachedObjects::RegisteredFactory key
Definition: CommandManager.cpp:201
Registry::OrderingPreferenceInitializer::mRoot
Literal mRoot
Definition: Registry.h:290