• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

kresources

  • KRES
  • IdMapper
Public Member Functions | Protected Member Functions | List of all members
KRES::IdMapper Class Reference

#include <idmapper.h>

Public Member Functions

 IdMapper ()
 
 IdMapper (const QString &path, const QString &identifier=QString())
 
 ~IdMapper ()
 
QString asString () const
 
void clear ()
 
QString fingerprint (const QString &localId) const
 
QString identifier () const
 
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)
 

Protected Member Functions

QString filename ()
 

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.

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
pathCategory of mapping (path into the mapping namespace)
identifierThe 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 210 of file idmapper.cpp.

void KRES::IdMapper::clear ( )

Clears the map.

Definition at line 156 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
localIdLocal 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 233 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
remoteIdRemote Id to get the local Id for.

Definition at line 198 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
localIdLocal Id to get the remote Id from.
See also
setRemoteId()
removeRemoteId()

Definition at line 186 of file idmapper.cpp.

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

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

Definition at line 242 of file idmapper.cpp.

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

Removes the remote id.

Parameters
remoteIdremote 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 169 of file idmapper.cpp.

bool KRES::IdMapper::save ( )

Saves the map.

Definition at line 131 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
localIdLocal Id to set the fingerprint on.
fingerprintFingerprint (any string will do, though an md5 hash is probably a good idea) of the Id.

Definition at line 226 of file idmapper.cpp.

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

Set id map identifier.

Parameters
identifierthe 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
pathPath 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
localIdLocal Id to set remote for.
remoteIdRemote 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 162 of file idmapper.cpp.


The documentation for this class was generated from the following files:
  • idmapper.h
  • idmapper.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kresources

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

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal