(when called in a directory) added: to reload winix function: reloading (clearing) the cache from 'menu' plugin added: to 'menu' plugin possibility to read 'meta' information from files third argument 'withmeta' to menu_dir_tab ezc function e.g. [for menu_dir_tab "/directory" "..." "withmeta"]...[end] and some ezc functions to retrieve the meta values git-svn-id: svn://ttmath.org/publicrep/winix/trunk@921 e52654a7-88a9-db11-a3e9-0013d4bc506e
77 lines
1007 B
C++
Executable File
77 lines
1007 B
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2012-2013, Tomasz Sowa
|
|
* 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"
|
|
|
|
|
|
|
|
namespace Menu
|
|
{
|
|
|
|
|
|
struct MenuItem
|
|
{
|
|
long id; // item id
|
|
std::wstring url;
|
|
std::wstring subject;
|
|
PT::Space meta;
|
|
Item::Type type;
|
|
int file_type;
|
|
};
|
|
|
|
|
|
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
|
|
|
|
#endif
|