76 lines
933 B
C++
76 lines
933 B
C++
|
/*
|
||
|
* This file is a part of CMSLU -- Content Management System like Unix
|
||
|
* and is not publicly distributed
|
||
|
*
|
||
|
* Copyright (c) 2009, Tomasz Sowa
|
||
|
* All rights reserved.
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
#include "mount.h"
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
Mount::Mount()
|
||
|
{
|
||
|
type = cms;
|
||
|
dir_id = -1;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
const char * Mount::TypeToStr()
|
||
|
{
|
||
|
static char buffer[30];
|
||
|
|
||
|
switch( type )
|
||
|
{
|
||
|
case cms:
|
||
|
sprintf(buffer, "cms");
|
||
|
break;
|
||
|
|
||
|
case thread:
|
||
|
sprintf(buffer, "thread");
|
||
|
break;
|
||
|
|
||
|
default:
|
||
|
sprintf(buffer, "the name is not set");
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
return buffer;
|
||
|
}
|
||
|
|
||
|
|
||
|
bool Mount::ParseStrParam(const std::string & param)
|
||
|
{
|
||
|
Param p = none;
|
||
|
|
||
|
if( param == "asc" )
|
||
|
p = asc;
|
||
|
else
|
||
|
if( param == "desc" )
|
||
|
p = desc;
|
||
|
else
|
||
|
if( param == "none" )
|
||
|
return true;
|
||
|
else
|
||
|
return false;
|
||
|
|
||
|
param_table.insert(p);
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
|
||
|
bool Mount::IsParam(Param p)
|
||
|
{
|
||
|
std::set<Param>::iterator i = param_table.find(p);
|
||
|
|
||
|
if( i == param_table.end() )
|
||
|
return false;
|
||
|
|
||
|
return true;
|
||
|
}
|