kpilot

SyncAction::SyncMode Class Reference

This class encapsulates the different sync modes that can be used, and enforces a little discipline in changing the mode and messing around in general. More...

#include <syncAction.h>

List of all members.


Public Types

enum  Mode {
  eHotSync = 1, eFullSync = 2, eCopyPCToHH = 3, eCopyHHToPC = 4,
  eBackup = 5, eRestore = 6
}

Public Member Functions

bool isCopy () const
bool isFirstSync () const
bool isFullSync () const
bool isLocal () const
bool isSync () const
bool isTest () const
QStringList list () const
Mode mode () const
QString name () const
bool operator== (const SyncMode &m) const
bool operator== (const Mode &m) const
bool setMode (Mode m)
bool setMode (int)
bool setOptions (bool test, bool local)
 SyncMode (const QStringList &l)
 SyncMode (Mode m, bool test=false, bool local=false)

Static Public Member Functions

static QString name (Mode)

Detailed Description

This class encapsulates the different sync modes that can be used, and enforces a little discipline in changing the mode and messing around in general.

It replaces a simple enum by not much more, but it makes things like local test backups less likely to happen.

Note that this could all be packed into a bitfield (5 bits needed) but that makes for messy code in the end.

Definition at line 194 of file syncAction.h.


Member Enumeration Documentation

Available modes for the sync.

Enumerator:
eHotSync 
eFullSync 
eCopyPCToHH 
eCopyHHToPC 
eBackup 
eRestore 

Definition at line 198 of file syncAction.h.


Constructor & Destructor Documentation

SyncAction::SyncMode::SyncMode ( Mode  m,
bool  test = false,
bool  local = false 
)

Create a mode with the given Mode m and the mix-ins test and local, which determine whether the sync should actually change anything at all (test mode) and whether the HH is to be simulated by local databases.

Definition at line 160 of file syncAction.cc.

SyncAction::SyncMode::SyncMode ( const QStringList l  ) 

Create a mode by parsing the string list.

This is used mostly by the conduit proxies, which use a string list to pass aparameters to the shared library loader.

Definition at line 137 of file syncAction.cc.


Member Function Documentation

bool SyncAction::SyncMode::isCopy (  )  const [inline]

Classify every mode as either a sync (two-way) or copy (one-way) mode.

Definition at line 303 of file syncAction.h.

bool SyncAction::SyncMode::isFirstSync (  )  const [inline]

Definition at line 290 of file syncAction.h.

bool SyncAction::SyncMode::isFullSync (  )  const [inline]

Definition at line 284 of file syncAction.h.

bool SyncAction::SyncMode::isLocal (  )  const [inline]

Accessor for the local part of the mode.

Local syncs use a local database instead of one on the device link.

Definition at line 279 of file syncAction.h.

bool SyncAction::SyncMode::isSync (  )  const [inline]

Classify every mode as either a sync (two-way) or copy (one-way) mode.

Definition at line 296 of file syncAction.h.

bool SyncAction::SyncMode::isTest (  )  const [inline]

Accessor for the test part of the mode.

Test syncs should never actually modify data anywhere.

Definition at line 271 of file syncAction.h.

QStringList SyncAction::SyncMode::list (  )  const

Returns a QStringList that, when passed to the constructor of SyncMode, will re-create it.

Used to pass modes into shared library factories.

Definition at line 173 of file syncAction.cc.

Mode SyncAction::SyncMode::mode (  )  const [inline]

Returns the kind of sync; this is just incomplete information, since a test hot sync is very different from a non-test one.

Definition at line 225 of file syncAction.h.

QString SyncAction::SyncMode::name (  )  const

Returns a (human readable) name for this particular mode, including extra information about test and local mode.

Definition at line 214 of file syncAction.cc.

QString SyncAction::SyncMode::name ( Mode  e  )  [static]

Returns a standard name for each of the sync modes.

Definition at line 200 of file syncAction.cc.

bool SyncAction::SyncMode::operator== ( const SyncMode m  )  const [inline]

Longhand comparison.

Compares two modes for the same mode enum and mixins local and test.

Definition at line 261 of file syncAction.h.

bool SyncAction::SyncMode::operator== ( const Mode m  )  const [inline]

Shorthand to test for a specific mode enum.

This disregards the mixings local and test.

Definition at line 254 of file syncAction.h.

bool SyncAction::SyncMode::setMode ( Mode  m  ) 

Sets a mode from a mode, if possible.

This leaves the options unchanged, so as to reward properly-typed programming.

Definition at line 247 of file syncAction.cc.

bool SyncAction::SyncMode::setMode ( int  mode  ) 

Sets a mode from an integer mode, if possible.

If the mode is illegal, return false and set the mode to Hot Sync. As a side effect, options test and local are reset to false.

Definition at line 229 of file syncAction.cc.

bool SyncAction::SyncMode::setOptions ( bool  test,
bool  local 
) [inline]

Sets options.

Returns false if the combination of mode and the options is impossible.

Definition at line 244 of file syncAction.h.


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