You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.1 KiB
76 lines
2.1 KiB
15 years ago
|
/*
|
||
13 years ago
|
This file is part of tdepim.
|
||
15 years ago
|
|
||
|
Copyright (c) 2004 Tobias Koenig <tokoe@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.
|
||
|
*/
|
||
|
|
||
|
#ifndef TODOSTATEMAPPER_H
|
||
|
#define TODOSTATEMAPPER_H
|
||
|
|
||
15 years ago
|
#include <tqdatastream.h>
|
||
|
#include <tqmap.h>
|
||
15 years ago
|
|
||
|
class TodoStateMapper
|
||
|
{
|
||
|
public:
|
||
|
/**
|
||
|
Create Id mapper. You have to set path and identifier before you can call
|
||
|
load() or save().
|
||
|
*/
|
||
|
TodoStateMapper();
|
||
|
~TodoStateMapper();
|
||
|
|
||
15 years ago
|
void setPath( const TQString &path );
|
||
|
void setIdentifier( const TQString &identifier );
|
||
15 years ago
|
|
||
|
bool load();
|
||
|
bool save();
|
||
|
|
||
|
void clear();
|
||
|
|
||
15 years ago
|
void addTodoState( const TQString &uid, int localState, const TQString &remoteState );
|
||
15 years ago
|
|
||
15 years ago
|
TQString remoteState( const TQString &uid, int localState );
|
||
15 years ago
|
|
||
15 years ago
|
void remove( const TQString &uid );
|
||
15 years ago
|
|
||
15 years ago
|
static int toLocal( const TQString &remoteState );
|
||
|
static TQString toRemote( int localState );
|
||
15 years ago
|
|
||
|
protected:
|
||
15 years ago
|
TQString filename();
|
||
15 years ago
|
|
||
|
private:
|
||
15 years ago
|
TQString mPath;
|
||
|
TQString mIdentifier;
|
||
15 years ago
|
|
||
|
typedef struct {
|
||
15 years ago
|
TQString uid;
|
||
15 years ago
|
int localState;
|
||
15 years ago
|
TQString remoteState;
|
||
15 years ago
|
} TodoStateMapEntry;
|
||
|
|
||
15 years ago
|
typedef TQMap<TQString, TodoStateMapEntry> TodoStateMap;
|
||
15 years ago
|
TodoStateMap mTodoStateMap;
|
||
|
|
||
15 years ago
|
friend TQDataStream &operator<<( TQDataStream&, const TodoStateMapEntry& );
|
||
|
friend TQDataStream &operator>>( TQDataStream&, TodoStateMapEntry& );
|
||
15 years ago
|
};
|
||
|
|
||
|
#endif
|