e.g.: 07555 means: 7 for owner 5 for group 5 for others 5 for guests (not logged users) added: the sticky bit for directories e.g. permissions to a directory with a sticky bit set can be set to: 017555 rewritten: rm/mv winix functions to correctly understand the sticky bit added: Dir::FollowLink() recognizes ".." and "." now consequently System::FollowAllLinks recognizes it too added: umask -- calculating privileges for new files/directories all users have their own umask (in meta) and there is one in the config (for guests and when a user has not definied its own one) removed: mount option: only_root_remove git-svn-id: svn://ttmath.org/publicrep/winix/trunk@801 e52654a7-88a9-db11-a3e9-0013d4bc506e
96 lines
1.8 KiB
C++
Executable File
96 lines
1.8 KiB
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2008-2012, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#ifndef headerfile_winix_core_dircontainer
|
|
#define headerfile_winix_core_dircontainer
|
|
|
|
#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 GetVar();
|
|
|
|
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(); // IMPROVE ME: may it should be renamed to ChildBegin() similarly as FindFirstChild() ?
|
|
ParentIterator ParentEnd();
|
|
ParentSizeType ParentSize();
|
|
bool ParentEmpty();
|
|
ParentIterator FindFirstChild(long parent);
|
|
ParentIterator NextChild(ParentIterator pi);
|
|
|
|
bool IsNameOfSpecialFolder(const std::wstring & name);
|
|
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;
|
|
|
|
// true if there is a var dir in the table
|
|
bool is_var;
|
|
|
|
// var
|
|
Iterator var_iter;
|
|
|
|
// indexes
|
|
TableId table_id;
|
|
TableParent table_parent;
|
|
|
|
// names of folders
|
|
static std::wstring dir_etc, dir_var;
|
|
};
|
|
|
|
|
|
#endif
|