67 lines
1.2 KiB
C
67 lines
1.2 KiB
C
|
/*
|
||
|
* This file is a part of CMSLU -- Content Management System like Unix
|
||
|
* and is not publicly distributed
|
||
|
*
|
||
|
* Copyright (c) 2008, Tomasz Sowa
|
||
|
* All rights reserved.
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
#ifndef headerfiledircontainer
|
||
|
#define headerfiledircontainer
|
||
|
|
||
|
#include <vector>
|
||
|
#include <map>
|
||
|
#include "item.h"
|
||
|
#include "log.h"
|
||
|
|
||
|
|
||
|
class DirContainer
|
||
|
{
|
||
|
|
||
|
public:
|
||
|
typedef std::vector<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 Begin();
|
||
|
Iterator End();
|
||
|
SizeType Size();
|
||
|
bool Empty();
|
||
|
void PushBack(const Item & item);
|
||
|
void Clear();
|
||
|
|
||
|
Iterator FindId(long id);
|
||
|
|
||
|
ParentIterator ParentBegin();
|
||
|
ParentIterator ParentEnd();
|
||
|
ParentSizeType ParentSize();
|
||
|
bool ParentEmpty();
|
||
|
ParentIterator FindFirstParent(long parent);
|
||
|
ParentIterator NextParent(ParentIterator pi);
|
||
|
|
||
|
|
||
|
private:
|
||
|
|
||
|
void AddIndexes(Iterator item);
|
||
|
void RebuildIndexes();
|
||
|
|
||
|
// main table with dirs
|
||
|
Table table;
|
||
|
|
||
|
// indexes
|
||
|
TableId table_id;
|
||
|
TableParent table_parent;
|
||
|
};
|
||
|
|
||
|
|
||
|
#endif
|