• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

kresources

KRES::IdMapper

KRES::IdMapper Class Reference

#include <idmapper.h>

List of all members.


Detailed Description

Keeps a map of paths and identifiers.

An Id Mapper maps Ids. What to or what for is not entirely clear, but maps have categories. This is probably an adjoint functor, since adjoint functors are everywhere.

Definition at line 51 of file idmapper.h.


Public Member Functions

QString asString () const
void clear ()
QString fingerprint (const QString &localId) const
QString identifier () const
 IdMapper (const QString &path, const QString &identifier=QString())
 IdMapper ()
bool load ()
QString localId (const QString &remoteId) const
QString path () const
QString remoteId (const QString &localId) const
QMap< QString, QString > remoteIdMap () const
void removeRemoteId (const QString &remoteId)
bool save ()
void setFingerprint (const QString &localId, const QString &fingerprint)
void setIdentifier (const QString &identifier)
void setPath (const QString &path)
void setRemoteId (const QString &localId, const QString &remoteId)
 ~IdMapper ()

Protected Member Functions

QString filename ()

Constructor & Destructor Documentation

KRES::IdMapper::IdMapper (  ) 

Create Id mapper.

You have to set path and identifier before you can call load() or save().

Definition at line 55 of file idmapper.cpp.

KRES::IdMapper::IdMapper ( const QString &  path,
const QString &  identifier = QString() 
) [explicit]

Create Id mapper.

The path specifies the category of mapping, the identifier the concrete object.

If you don't pass an identifier you have to set it before calling load() or save().

The current implementation stores the data at /share/apps/<path>/<identifier>.

Parameters:
path Category of mapping (path into the mapping namespace)
identifier The concrete mapping object (filename in namespace)

Definition at line 60 of file idmapper.cpp.

KRES::IdMapper::~IdMapper (  ) 

Destructor.

Definition at line 67 of file idmapper.cpp.


Member Function Documentation

QString KRES::IdMapper::asString (  )  const

Returns a string representation of the id pairs, that's useful for debugging.

Definition at line 199 of file idmapper.cpp.

void KRES::IdMapper::clear (  ) 

Clears the map.

Definition at line 152 of file idmapper.cpp.

QString KRES::IdMapper::filename (  )  [protected]

Filename of the map when stored on disk.

Used in save() and load(),

See also:
IdMapper( const QString &path, const QString &identifier )

Definition at line 92 of file idmapper.cpp.

QString KRES::IdMapper::fingerprint ( const QString &  localId  )  const

Returns the fingerprint for the map.

Parameters:
localId Local Id to get the fingerprint for.
Todo:
Figure out if this returns the last fingerprint set by setFingerprint() only or if anything else can change it.

Definition at line 220 of file idmapper.cpp.

QString KRES::IdMapper::identifier (  )  const

Return id map identifier.

Definition at line 87 of file idmapper.cpp.

bool KRES::IdMapper::load (  ) 

Loads the map.

Definition at line 103 of file idmapper.cpp.

QString KRES::IdMapper::localId ( const QString &  remoteId  )  const

Returns the local id for the given remote id.

Parameters:
remoteId Remote Id to get the local Id for.

Definition at line 187 of file idmapper.cpp.

QString KRES::IdMapper::path (  )  const

Return id map path.

Definition at line 77 of file idmapper.cpp.

QString KRES::IdMapper::remoteId ( const QString &  localId  )  const

Returns the remote id of the given local id.

Parameters:
localId Local Id to get the remote Id from.
See also:
setRemoteId()

removeRemoteId()

Definition at line 175 of file idmapper.cpp.

QMap< QString, QString > KRES::IdMapper::remoteIdMap (  )  const

Returns the entire map of local-to-remote Ids.

Definition at line 229 of file idmapper.cpp.

void KRES::IdMapper::removeRemoteId ( const QString &  remoteId  ) 

Removes the remote id.

Parameters:
remoteId remote Id to remove.
Todo:
So what does that do? Remove local Ids with only that one remote Id? Remove the remote Id from all local Ids that have it?
See also:
setRemoteId()

Definition at line 163 of file idmapper.cpp.

bool KRES::IdMapper::save (  ) 

Saves the map.

Definition at line 127 of file idmapper.cpp.

void KRES::IdMapper::setFingerprint ( const QString &  localId,
const QString &  fingerprint 
)

Stores a fingerprint for an id which can be used to detect if the locally held version differs from what is on the server.

This can be a sequence number of an md5 hash depending on what the server provides.

Parameters:
localId Local Id to set the fingerprint on.
fingerprint Fingerprint (any string will do, though an md5 hash is probably a good idea) of the Id.

Definition at line 215 of file idmapper.cpp.

void KRES::IdMapper::setIdentifier ( const QString &  identifier  ) 

Set id map identifier.

Parameters:
identifier the identifier (filename) within the mapping namespace

Definition at line 82 of file idmapper.cpp.

void KRES::IdMapper::setPath ( const QString &  path  ) 

Set id map path.

Parameters:
path Path to use into mapping namespace.
See also:
IdMapper()

Definition at line 72 of file idmapper.cpp.

void KRES::IdMapper::setRemoteId ( const QString &  localId,
const QString &  remoteId 
)

Stores the remote id for the given local id.

Parameters:
localId Local Id to set remote for.
remoteId Remote Id to associate with this local Id.
See also:
remoteId()

localId()

Todo:
What happens when you set the same remote Id for more than one localId?

Definition at line 158 of file idmapper.cpp.


The documentation for this class was generated from the following files:
  • idmapper.h
  • idmapper.cpp

kresources

Skip menu "kresources"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  • kabc
  • kblog
  • kcal
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.6
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal