78 lines
1.8 KiB
C++
Executable File
78 lines
1.8 KiB
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2010, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#ifndef headerfile_winix_core_mountparser
|
|
#define headerfile_winix_core_mountparser
|
|
|
|
#include <map>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <stdlib.h>
|
|
#include <limits.h>
|
|
|
|
#include "mount.h"
|
|
#include "item.h"
|
|
#include "error.h"
|
|
#include "dirs.h"
|
|
|
|
|
|
|
|
class MountParser
|
|
{
|
|
public:
|
|
|
|
MountParser();
|
|
Error Parse(const std::wstring & input, std::map<long, Mount> & output);
|
|
void SetDirs(Dirs * pdirs);
|
|
void SetMountTypeTab(const std::vector<std::wstring> & tab);
|
|
void SetMountFsTab(const std::vector<std::wstring> & tab);
|
|
void SetMountParTab(const std::vector<std::wstring> & tab);
|
|
|
|
private:
|
|
|
|
Dirs * dirs;
|
|
|
|
const std::vector<std::wstring> * mount_type_tab;
|
|
const std::vector<std::wstring> * mount_fs_tab;
|
|
const std::vector<std::wstring> * mount_par_tab;
|
|
|
|
bool IsWhite(int c);
|
|
void SkipWhite();
|
|
void SkipLine();
|
|
void ReadWordQuote(std::wstring & res);
|
|
void ReadWordWhite(std::wstring & res);
|
|
void ReadWordComma(std::wstring & res);
|
|
void ReadWord(std::wstring & res, bool comma_bracket_separator = false);
|
|
void ReadParamArgsLoop(Mount::ParamRow::ParamArg & args);
|
|
void ReadParamArgs(Mount::ParamRow::ParamArg & args);
|
|
void ReadParamName(std::wstring & res);
|
|
void ReadParam(std::wstring & res, Mount::ParamRow::ParamArg & args);
|
|
int FindIndex(const std::vector<std::wstring> * tab, const std::wstring & value);
|
|
void ReadMountType();
|
|
void ReadMountPoint();
|
|
void ReadFs();
|
|
void LogMountParams();
|
|
void ReadMountParams();
|
|
void ReadRow(std::map<long, Mount> & output);
|
|
|
|
const wchar_t * pinput;
|
|
std::wstring temp;
|
|
std::wstring temp_arg;
|
|
Mount::ParamRow::ParamArg param_args;
|
|
|
|
|
|
Mount mount;
|
|
|
|
Item * pdir;
|
|
Error err;
|
|
};
|
|
|
|
|
|
#endif
|