2011-08-26 01:53:49 +02:00
|
|
|
/*
|
|
|
|
* This file is a part of Winix
|
|
|
|
* and is not publicly distributed
|
|
|
|
*
|
2012-01-12 03:24:08 +01:00
|
|
|
* Copyright (c) 2011-2012, Tomasz Sowa
|
2011-08-26 01:53:49 +02:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef headerfile_winix_plugins_groupitem_groupinfo
|
|
|
|
#define headerfile_winix_plugins_groupitem_groupinfo
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include "groups.h"
|
2012-01-12 03:24:08 +01:00
|
|
|
#include "confparser/confparser.h"
|
2011-08-26 01:53:49 +02:00
|
|
|
#include "core/item.h"
|
|
|
|
#include "core/system.h"
|
2011-10-16 23:33:45 +02:00
|
|
|
#include "core/config.h"
|
2011-08-26 01:53:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace GroupItem
|
|
|
|
{
|
|
|
|
|
|
|
|
struct GroupsWrapItem
|
|
|
|
{
|
|
|
|
bool to_delete;
|
|
|
|
std::wstring file_name;
|
|
|
|
Groups groups;
|
|
|
|
|
|
|
|
GroupsWrapItem()
|
|
|
|
{
|
|
|
|
to_delete = false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GroupInfo
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
|
|
GroupInfo();
|
|
|
|
|
|
|
|
void SetSystem(System * psystem);
|
2011-10-16 23:33:45 +02:00
|
|
|
void SetConfig(Config * pconfig);
|
|
|
|
|
2011-08-26 01:53:49 +02:00
|
|
|
void ReadGroupsConfigs(bool skip_existing_configs);
|
|
|
|
Groups * FindGroups(long dir_id); // can return a null pointer
|
|
|
|
|
|
|
|
|
|
|
|
int mount_par_group_conf;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
System * system;
|
2011-10-16 23:33:45 +02:00
|
|
|
Config * config;
|
2011-08-26 01:53:49 +02:00
|
|
|
|
2011-10-16 23:33:45 +02:00
|
|
|
// map[mount_dir_id] -> GroupsWrapItem
|
2011-08-26 01:53:49 +02:00
|
|
|
typedef std::map<long, GroupsWrapItem> GroupsWrap;
|
|
|
|
GroupsWrap groups_wrap;
|
|
|
|
|
2012-01-12 03:24:08 +01:00
|
|
|
PT::ConfParser conf_parser;
|
2011-08-26 01:53:49 +02:00
|
|
|
std::vector<Item*> config_dir_tab;
|
|
|
|
Item config_file;
|
|
|
|
|
|
|
|
void MarkAllGroupsToDelete();
|
|
|
|
void DeleteAllMarkedGroups();
|
|
|
|
bool GetConfContent(const std::wstring & path);
|
|
|
|
bool ParseGroupsConf(long mount_dir_id, const std::wstring & path);
|
|
|
|
bool ParseGroups(const std::wstring & str, Groups & groups);
|
|
|
|
void ReadGroupsConf(Mounts & mounts, bool skip_existing_configs);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|