148 lines
3.0 KiB
C++
Executable File
148 lines
3.0 KiB
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2009-2010, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
|
|
#ifndef headerfile_winix_core_mounts
|
|
#define headerfile_winix_core_mounts
|
|
|
|
|
|
#include <map>
|
|
#include <string>
|
|
#include <vector>
|
|
#include "mount.h"
|
|
#include "error.h"
|
|
#include "dirs.h"
|
|
#include "db/db.h"
|
|
#include "request.h"
|
|
#include "mountparser.h"
|
|
|
|
|
|
|
|
class Mounts
|
|
{
|
|
public:
|
|
|
|
/*
|
|
mount point's types
|
|
*/
|
|
int AddMountType(const wchar_t * type);
|
|
int AddMountType(const std::wstring & type);
|
|
const std::wstring & GetMountType(int id);
|
|
|
|
// id of a specific mount type (the id is always valid)
|
|
int MountTypeCms() { return mount_type_cms; }
|
|
|
|
// return -1 if there is no such a mount type
|
|
// or index otherwhise
|
|
int FindMountType(const std::wstring & type);
|
|
|
|
|
|
/*
|
|
file systems
|
|
*/
|
|
int AddMountFs(const wchar_t * fs);
|
|
int AddMountFs(const std::wstring & fs);
|
|
const std::wstring & GetMountFs(int id);
|
|
|
|
// id of a specific file system (the id is always valid)
|
|
int MountFsSimplefs() { return mount_fs_simplefs; }
|
|
int MountFsHashfs() { return mount_fs_hashfs; }
|
|
|
|
|
|
/*
|
|
mount point's parameters
|
|
*/
|
|
int AddMountPar(const wchar_t * par);
|
|
int AddMountPar(const std::wstring & par);
|
|
const std::wstring & GetMountPar(int id);
|
|
|
|
int MountParPage() { return mount_par_page; }
|
|
int MountParThumbSize() { return mount_par_thumb_size; }
|
|
int MountParThumbMode() { return mount_par_thumb_mode; }
|
|
//int MountParThread() { return mount_par_thread; }
|
|
//int MountParCreatethreadOn() { return mount_par_createthread_on; }
|
|
int MountParOnlyRootRemove() { return mount_par_only_root_remove; }
|
|
int MountParEmacsOn() { return mount_par_emacs_on; }
|
|
int MountParMkdirOn() { return mount_par_mkdir_on; }
|
|
int MountParApp() { return mount_par_app; }
|
|
int MountParHtmlTemplate() { return mount_par_html_template; }
|
|
|
|
|
|
void SetDirs(Dirs * pdirs);
|
|
void SetDb(Db * pdb);
|
|
void SetCur(Cur * pcur);
|
|
|
|
// dir_id, mount_point
|
|
typedef std::map<long, Mount> MountTab;
|
|
|
|
Mounts();
|
|
void CreateMounts();
|
|
|
|
Error ReadMounts(const std::wstring & mounts);
|
|
Error ReadMounts();
|
|
|
|
void CalcCurMount();
|
|
Mount * CalcMount(long dir_id);
|
|
|
|
// current mount point
|
|
// will not be null after calling CalcCurMount() or ReadMounts([...])
|
|
Mount * pmount;
|
|
|
|
|
|
const MountTab * GetMountTab();
|
|
|
|
private:
|
|
|
|
Db * db;
|
|
Dirs * dirs;
|
|
Cur * cur;
|
|
|
|
Mount empty_mount;
|
|
const std::wstring empty_str;
|
|
|
|
MountParser mount_parser;
|
|
|
|
std::vector<std::wstring> mount_type_tab;
|
|
|
|
int mount_type_cms;
|
|
|
|
// simplefs
|
|
// hashfs
|
|
std::vector<std::wstring> mount_fs_tab;
|
|
|
|
int mount_fs_simplefs;
|
|
int mount_fs_hashfs;
|
|
|
|
std::vector<std::wstring> mount_par_tab;
|
|
|
|
int mount_par_page;
|
|
int mount_par_thumb_size;
|
|
int mount_par_thumb_mode;
|
|
//int mount_par_thread;
|
|
//int mount_par_createthread_on;
|
|
int mount_par_only_root_remove;
|
|
int mount_par_emacs_on;
|
|
int mount_par_mkdir_on;
|
|
int mount_par_app;
|
|
int mount_par_html_template;
|
|
|
|
|
|
MountTab mount_tab;
|
|
|
|
void CreateMountType();
|
|
void CreateMountFs();
|
|
void CreateMountPar();
|
|
|
|
void MountCmsForRoot();
|
|
};
|
|
|
|
|
|
|
|
#endif
|