JX Application Framework
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
JPrefObject Class Referenceabstract

#include <JPrefObject.h>

Inheritance diagram for JPrefObject:
[legend]

Public Member Functions

 JPrefObject (JPrefsManager *prefsMgr, const JPrefID &id)
 
virtual ~JPrefObject ()
 
bool PrefInfoValid () const
 
bool GetPrefInfo (JPrefsManager **mgr, JIndex *id) const
 
void SetPrefInfo (JPrefsManager *prefsMgr, const JPrefID &id)
 
void ReadPrefs ()
 
void WritePrefs () const
 

Protected Member Functions

virtual void ReadPrefs (std::istream &input)=0
 
virtual void WritePrefs (std::ostream &output) const =0
 

Detailed Description

Base class for objects that own an ID in a preferences file.  To read/
write preferences, simply call JPrefObject::Read/WritePrefs().

This is designed to be a mixin class, but must only be used once since
it assumes a single id in the prefs file.  It should also not be
inherited virtually.

Even though Read/WritePrefs() is virtual, it should never be overridden
more than once, in the leaf class.  Otherwise, one will eventually have
to insert an override of these functions into the inheritance path, and
this will require that derived classes know about the change.  The better
way to handle it is for the leaf class to either read/write everything
explicitly via access functions provided by the base classes or to call
subsidiary read/write functions in each base class.  This makes it
explicit that the leaf class knows what is stored and makes it much easier
to handle new information in base classes.

Constructor & Destructor Documentation

◆ JPrefObject()

JPrefObject::JPrefObject ( JPrefsManager prefsMgr,
const JPrefID id 
)

prefsMgr can be nullptr

◆ ~JPrefObject()

JPrefObject::~JPrefObject ( )
virtual

Member Function Documentation

◆ GetPrefInfo()

bool JPrefObject::GetPrefInfo ( JPrefsManager **  mgr,
JIndex id 
) const
inline

◆ PrefInfoValid()

bool JPrefObject::PrefInfoValid ( ) const
inline

◆ ReadPrefs() [1/2]

void JPrefObject::ReadPrefs ( )

◆ ReadPrefs() [2/2]

virtual void JPrefObject::ReadPrefs ( std::istream &  input)
protectedpure virtual

Implemented in JUpdateChecker, JXDockManager, and JXToolBar.

◆ SetPrefInfo()

void JPrefObject::SetPrefInfo ( JPrefsManager prefsMgr,
const JPrefID id 
)
inline

◆ WritePrefs() [1/2]

void JPrefObject::WritePrefs ( ) const

◆ WritePrefs() [2/2]

virtual void JPrefObject::WritePrefs ( std::ostream &  output) const
protectedpure virtual

Implemented in JXToolBar, JUpdateChecker, and JXDockManager.


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