idmapper.h
00001 /* 00002 This file is part of tdepim. 00003 00004 Copyright (c) 2004 Tobias Koenig <tokoe@kde.org> 00005 Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 00021 */ 00022 #ifndef KPIM_IDMAPPER_H 00023 #define KPIM_IDMAPPER_H 00024 00025 #include <tqmap.h> 00026 #include <tqvariant.h> 00027 00028 #include <tdepimmacros.h> 00029 00030 namespace KPIM { 00031 00037 class KDE_EXPORT IdMapper 00038 { 00039 public: 00044 IdMapper(); 00055 IdMapper( const TQString &path, const TQString &identifier = TQString() ); 00057 ~IdMapper(); 00058 00062 void setPath( const TQString &path ); 00066 TQString path() const { return mPath; } 00067 00071 void setIdentifier( const TQString &identifier ); 00075 TQString identifier() const { return mIdentifier; } 00076 00080 bool load(); 00081 00085 bool save(); 00086 00090 void clear(); 00091 00095 void setRemoteId( const TQString &localId, const TQString &remoteId ); 00096 00100 void removeRemoteId( const TQString &remoteId ); 00101 00105 TQString remoteId( const TQString &localId ) const; 00106 00110 TQString localId( const TQString &remoteId ) const; 00111 00112 00119 void setFingerprint( const TQString &localId, const TQString &fingerprint ); 00120 00127 const TQString &fingerprint( const TQString &localId ) const; 00128 00129 00135 TQMap<TQString, TQString> remoteIdMap() const; 00136 00141 TQString asString() const; 00142 00143 protected: 00147 TQString filename(); 00148 00149 private: 00150 TQMap<TQString, TQVariant> mIdMap; 00151 TQMap<TQString, TQString> mFingerprintMap; 00152 00153 TQString mPath; 00154 TQString mIdentifier; 00155 }; 00156 00157 } 00158 00159 #endif