winix/plugins/groupitem/groups.h

106 lines
1.6 KiB
C++
Executable File

/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_plugins_groupitem_groups
#define headerfile_winix_plugins_groupitem_groups
#include <map>
#include <vector>
#include <string>
namespace GroupItem
{
class Groups
{
public:
/*
adding a new group
this method returns a group index
*/
size_t AddGroup();
/*
adding a new path to the last group
*/
void AddPath(const std::wstring & path);
/*
finding a group which has the specified path
this method returns a group index
if there is not such a path everywhere then group size is returned
*/
size_t Find(const std::wstring & path);
/*
returning how many groups we have
*/
size_t Size();
/*
returning the size of the specified group
*/
size_t GroupSize(size_t group_index);
/*
returning a path of the specified group and position
or en empty string if indexes are out of ranges
*/
const std::wstring & GroupPath(size_t group_index, size_t path_index);
/*
removing all groups
*/
void Clear();
private:
/*
paths_map[L"path_name"] -> group index
*/
typedef std::map<std::wstring, size_t> PathsMap;
PathsMap paths_map;
/*
groups[group_index] -> index in paths_names
the group consists of elements from
groups_tab[groups_index] to groups_tab[groups_index+1] (without the last one)
*/
typedef std::vector<size_t> GroupsTab;
GroupsTab groups_tab;
/*
paths_names
*/
typedef std::vector<const std::wstring*> PathsNames;
PathsNames paths_names;
const std::wstring empty_str;
};
}
#endif