88 lines
1.6 KiB
C++
Executable File
88 lines
1.6 KiB
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2008-2010, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#ifndef headerfilecmslucoredircontainer
|
|
#define headerfilecmslucoredircontainer
|
|
|
|
#include <list>
|
|
#include <map>
|
|
#include "item.h"
|
|
|
|
|
|
|
|
class DirContainer
|
|
{
|
|
|
|
public:
|
|
typedef std::list<Item> Table;
|
|
typedef Table::iterator Iterator;
|
|
typedef Table::size_type SizeType;
|
|
|
|
typedef std::map<long, Iterator> TableId;
|
|
typedef std::multimap<long, Iterator> TableParent;
|
|
typedef TableParent::iterator ParentIterator;
|
|
typedef TableParent::size_type ParentSizeType;
|
|
|
|
|
|
DirContainer();
|
|
|
|
Iterator GetRoot();
|
|
Iterator GetEtc();
|
|
|
|
Iterator Begin();
|
|
Iterator End();
|
|
SizeType Size();
|
|
bool Empty();
|
|
Iterator PushBack(const Item & item);
|
|
bool ChangeParent(long dir_id, long new_parent_id);
|
|
void Clear();
|
|
|
|
Iterator FindId(long id);
|
|
|
|
bool DelById(long id);
|
|
|
|
ParentIterator ParentBegin();
|
|
ParentIterator ParentEnd();
|
|
ParentSizeType ParentSize();
|
|
bool ParentEmpty();
|
|
ParentIterator FindFirstParent(long parent);
|
|
ParentIterator NextParent(ParentIterator pi);
|
|
|
|
void FindSpecialFolders();
|
|
|
|
private:
|
|
|
|
void CheckSpecialFolder(const Item & item, Iterator iter);
|
|
|
|
// main table with dirs
|
|
Table table;
|
|
|
|
// true if there is a root dir in the table
|
|
bool is_root;
|
|
|
|
// root
|
|
Iterator root_iter;
|
|
|
|
// true if there is a etc dir in the table
|
|
bool is_etc;
|
|
|
|
// etc
|
|
Iterator etc_iter;
|
|
|
|
// indexes
|
|
TableId table_id;
|
|
TableParent table_parent;
|
|
|
|
// names of folders
|
|
static std::string dir_etc;
|
|
};
|
|
|
|
|
|
#endif
|