[#1214] Add squeleton for history manager

This commit is contained in:
Emmanuel Milou
2009-05-28 16:49:07 -04:00
parent 9b162d26e2
commit d5941aeeef
5 changed files with 222 additions and 0 deletions

View File

@ -0,0 +1,10 @@
SUBDIRS =
noinst_LTLIBRARIES = libhistory.la
libhistory_la_SOURCES = \
historyitem.h \
historyitem.cpp \
historymanager.h \
historymanager.cpp \

View File

@ -0,0 +1,31 @@
/*
* Copyright (C) 2009 Savoir-Faire Linux inc.
*
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <historyitem.h>
HistoryItem::HistoryItem (int timestamp, CallType call_type, std::string peer, AccountID account_id)
{
// TODO
}
HistoryItem::~HistoryItem ()
{
// TODO
}

View File

@ -0,0 +1,70 @@
/*
* Copyright (C) 2009 Savoir-Faire Linux inc.
*
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _HISTORY_ITEM
#define _HISTORY_ITEM
typedef struct {
CALL_MISSED,
CALL_INCOMING,
CALL_OUTGOING
}CallType;
class HistoryItem {
public:
/*
* Constructor
*/
HistoryItem (int, CallType, std::string, AccountID = "");
/*
* Destructor
*/
~HistoryItem ();
private:
/*
* Timestamp representing the date of the call
*/
int _timestamp;
/*
* Represents the type of call
* Has be either CALL_MISSED, CALL_INCOMING or CALL_OUTGOING
*/
CallType _call_type;
/*
* The information about the callee/caller, depending on the type of call
*/
std::string _peer;
/*
* The account the call was made with
*/
AccountID _account_id;
};
#endif // HISTORY_ITEM

View File

@ -0,0 +1,47 @@
/*
* Copyright (C) 2009 Savoir-Faire Linux inc.
*
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <historymanager.h>
HistoryManager::HistoryManager () {
// TODO
}
HistoryManager::~HistoryManager () {
// TODO
}
int HistoryManager::load_history_from_file (void)
{
// TODO
return 0;
}
int HistoryManager::save_history_to_file (void)
{
// TODO
return 0;
}
void HistoryManager::add_new_history_entry (HistoryItem new_item)
{
// TODO
}

View File

@ -0,0 +1,64 @@
/*
* Copyright (C) 2009 Savoir-Faire Linux inc.
*
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _HISTORY_MANAGER
#define _HISTORY_MANAGER
#include <historyitem.h>
typedef std::map <std::string, HistoryItem*> HistoryItemMap;
class HistoryManager {
public:
/*
* Constructor
*/
HistoryManager ();
/*
* Destructor
*/
~HistoryManager ();
/*
* Load the history from a file to the dedicated data structure
*/
int load_history_from_file (void);
/*
* Inverse method, ie save a data structure containing the history into a file
*/
int save_history_to_file (void);
private:
/*
* Add a new history item in the data structure
*/
void add_new_history_entry (HistoryItem new_item);
/*
* Map containing the history items
*/
HistoryItemMap _history_items;
};
#endif //_HISTORY_MANAGER