2012-02-24 13:09:38 +01:00
|
|
|
/*
|
|
|
|
* This file is a part of Winix
|
|
|
|
* and is not publicly distributed
|
|
|
|
*
|
2014-02-12 17:30:49 +01:00
|
|
|
* Copyright (c) 2012-2014, Tomasz Sowa
|
2012-02-24 13:09:38 +01:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef headerfile_winix_plugins_menu_cache
|
|
|
|
#define headerfile_winix_plugins_menu_cache
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <list>
|
|
|
|
#include "core/item.h"
|
|
|
|
#include "core/dirs.h"
|
|
|
|
|
2014-02-12 17:30:49 +01:00
|
|
|
namespace Winix
|
|
|
|
{
|
2012-02-24 13:09:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
namespace Menu
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
struct MenuItem
|
|
|
|
{
|
2013-04-16 11:51:36 +02:00
|
|
|
long id; // item id
|
2012-02-24 13:09:38 +01:00
|
|
|
std::wstring url;
|
|
|
|
std::wstring subject;
|
2013-04-16 11:51:36 +02:00
|
|
|
PT::Space meta;
|
|
|
|
Item::Type type;
|
|
|
|
int file_type;
|
2012-02-24 13:09:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct CacheItem
|
|
|
|
{
|
|
|
|
long dir_id;
|
|
|
|
int param;
|
|
|
|
std::vector<MenuItem> menu_items;
|
|
|
|
std::wstring dir; // without the last slash
|
|
|
|
|
|
|
|
CacheItem()
|
|
|
|
{
|
|
|
|
dir_id = -1;
|
|
|
|
param = -1;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Cache
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
void SetDirs(Dirs * pdirs);
|
|
|
|
|
|
|
|
CacheItem * Get(long dir_id, int param);
|
|
|
|
CacheItem * Insert(long dir_id, int param);
|
|
|
|
void Remove(long dir_id);
|
|
|
|
void Clear();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
Dirs * dirs;
|
|
|
|
typedef std::list<CacheItem> Tab;
|
|
|
|
Tab tab;
|
|
|
|
CacheItem empty_cache_item;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2014-02-12 17:30:49 +01:00
|
|
|
} // namespace Winix
|
|
|
|
|
2012-02-24 13:09:38 +01:00
|
|
|
#endif
|