refactoring

git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@523 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2009-11-17 01:04:01 +00:00
parent 2ca44ec361
commit dc5f002de3
17 changed files with 101 additions and 370 deletions

View File

@@ -19,6 +19,8 @@
#include "dircontainer.h"
// we do not support '..' in a path (for simplicity and security reasons)
class Dirs
{
@@ -26,41 +28,17 @@ public:
void Clear();
void ReadDirs();
// without any exceptions
// these methods return false in a case the path or name (with a specific parent) are invalid
// we do not support '..' in a path (for security reason)
bool IsDir(long id);
bool GetRootDir(Item ** item);
bool GetDir(const std::string & path, Item ** item);
bool GetDir(const std::string & name, long parent, Item ** item);
bool GetDirId(const std::string & path, long * id);
bool GetDirId(const std::string & name, long parent, long * id);
//!! ta nie bedzie chyba potrzebna
bool GetDirChilds(long parent, std::vector<Item> & childs_table); // only returns dir-children
// these methods return false if there is no such a dir
bool IsDir(long dir_id);
bool GetDirChilds(long parent_id, std::vector<Item*> & childs_table);
bool MakePath(long dir_id, std::string & path);
bool GetDirChilds(long parent, std::vector<Item*> & childs_table); // only returns dir-children
bool MakePath(long id, std::string & path);
static void SplitPath(const std::string & path, std::string & dir, std::string & file);
// with an Error exception
// if the path or name are invalid these methods throw an exception
Item * GetDirT(const std::string & path);
Item * GetDirT(const std::string & name, long parent);
long GetDirIdT(const std::string & path);
long GetDirIdT(const std::string & name, long parent);
// !! nowy interfejs
// returns null if there is no a root dir
// these methods return null if there is no such a dir
Item * GetRootDir();
Item * GetEtcDir();
Item * GetDir(const std::string & name, long parent);
@@ -68,13 +46,7 @@ public:
Item * GetDir(long id);
Item * AddDir(const Item & item);
static void SplitPath(const std::string & path, std::string & dir, std::string & file);
void DeleteDir(long id);
void CheckRootDir();