/usr/include/kresources/idmapper.h is in kdepimlibs5-dev 4:4.14.10-7+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | /*
This file is part of kdepim.
Copyright (c) 2004 Tobias Koenig <tokoe@kde.org>
Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/**
@file
This file is part of the KDE resource framework and defines the
IdMapper class.
@author Tobias Koenig
@author Cornelius Schumacher
*/
#ifndef KRESOURCES_IDMAPPER_H
#define KRESOURCES_IDMAPPER_H
#include <QtCore/QMap>
#include <QtCore/QString>
#include "kresources_export.h"
namespace KRES {
class IdMapperPrivate;
/**
@brief
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.
*/
class KRESOURCES_DEPRECATED_EXPORT IdMapper
{
public:
/**
Create Id mapper. You have to set path and identifier before you can call
load() or save().
*/
IdMapper();
/**
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
$(KDEHOME)/share/apps/\<path\>/\<identifier\>.
@param path Category of mapping (path into the mapping namespace)
@param identifier The concrete mapping object (filename in namespace)
*/
explicit IdMapper( const QString &path,
const QString &identifier = QString() );
/** Destructor. */
~IdMapper();
/**
Set id map path.
@param path Path to use into mapping namespace.
@see IdMapper()
*/
void setPath( const QString &path );
/**
Return id map path.
*/
QString path() const;
/**
Set id map identifier.
@param identifier the identifier (filename) within the mapping namespace
*/
void setIdentifier( const QString &identifier );
/**
Return id map identifier.
*/
QString identifier() const;
/**
Loads the map.
*/
bool load();
/**
Saves the map.
*/
bool save();
/**
Clears the map.
*/
void clear();
/**
Stores the remote id for the given local id.
@param localId Local Id to set remote for.
@param remoteId Remote Id to associate with this local Id.
@see remoteId()
@see localId()
@todo What happens when you set the same remote Id for more than
one localId?
*/
void setRemoteId( const QString &localId, const QString &remoteId );
/**
Removes the remote id.
@param 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 setRemoteId()
*/
void removeRemoteId( const QString &remoteId );
/**
Returns the remote id of the given local id.
@param localId Local Id to get the remote Id from.
@see setRemoteId()
@see removeRemoteId()
*/
QString remoteId( const QString &localId ) const;
/**
Returns the local id for the given remote id.
@param remoteId Remote Id to get the local Id for.
*/
QString localId( const QString &remoteId ) const;
/**
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.
@param localId Local Id to set the fingerprint on.
@param fingerprint Fingerprint (any string will do, though
an md5 hash is probably a good idea) of the Id.
*/
void setFingerprint( const QString &localId, const QString &fingerprint );
/**
Returns the fingerprint for the map.
@param 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.
*/
QString fingerprint( const QString &localId ) const;
/**
Returns the entire map of local-to-remote Ids.
*/
QMap<QString, QString> remoteIdMap() const;
/**
Returns a string representation of the id pairs, that's useful
for debugging.
*/
QString asString() const;
protected:
/**
Filename of the map when stored on disk. Used in save() and load(),
@see IdMapper( const QString &path, const QString &identifier )
*/
QString filename();
private:
IdMapperPrivate *const d;
};
}
#endif
|