added: mount points have parameters now
added: to the database: table 'thread' git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@499 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -51,6 +51,21 @@ void MountParser::ReadWord(std::string & res)
|
||||
}
|
||||
|
||||
|
||||
void MountParser::ReadParam(std::string & res)
|
||||
{
|
||||
res.clear();
|
||||
|
||||
while( *pinput && *pinput!=10 && *pinput!=',' && !IsWhite(*pinput) )
|
||||
{
|
||||
res += *pinput;
|
||||
++pinput;
|
||||
}
|
||||
|
||||
if( *pinput==',' )
|
||||
++pinput;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MountParser::ReadMountType()
|
||||
{
|
||||
@@ -59,13 +74,13 @@ void MountParser::ReadMountType()
|
||||
|
||||
if( temp == "cms" )
|
||||
{
|
||||
mount_type = Mount::cms;
|
||||
mount.type = Mount::cms;
|
||||
log << log3 << "MP: mount type: cms" << logend;
|
||||
}
|
||||
else
|
||||
if( temp == "thread" )
|
||||
{
|
||||
mount_type = Mount::thread;
|
||||
mount.type = Mount::thread;
|
||||
log << log3 << "MP: mount type: thread" << logend;
|
||||
}
|
||||
else
|
||||
@@ -88,6 +103,7 @@ void MountParser::ReadMountPoint()
|
||||
|
||||
if( pdir )
|
||||
{
|
||||
mount.dir_id = pdir->id;
|
||||
log << log3 << "MP: mount point: " << temp << logend;
|
||||
}
|
||||
else
|
||||
@@ -99,6 +115,27 @@ void MountParser::ReadMountPoint()
|
||||
|
||||
|
||||
|
||||
void MountParser::ReadMountParams()
|
||||
{
|
||||
SkipWhite();
|
||||
|
||||
for( ReadParam(temp) ; !temp.empty() ; ReadParam(temp) )
|
||||
{
|
||||
if( !mount.ParseStrParam(temp) )
|
||||
{
|
||||
log << log1 << "MP: unknown mount param: " << temp << logend;
|
||||
err = Error::mount_no_param;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log3 << "MP: mount param: " << temp << logend;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MountParser::ReadRow(std::map<long, Mount> & output)
|
||||
{
|
||||
ReadMountType();
|
||||
@@ -106,15 +143,14 @@ void MountParser::ReadRow(std::map<long, Mount> & output)
|
||||
if( err == Error::ok )
|
||||
ReadMountPoint();
|
||||
|
||||
if( err == Error::ok )
|
||||
ReadMountParams();
|
||||
|
||||
if( err == Error::ok )
|
||||
{
|
||||
Mount m;
|
||||
m.dir_id = pdir->id;
|
||||
m.type = mount_type;
|
||||
|
||||
output.insert( std::make_pair(pdir->id, m) );
|
||||
output.insert( std::make_pair(mount.dir_id, mount) );
|
||||
}
|
||||
|
||||
|
||||
SkipLine();
|
||||
}
|
||||
|
Reference in New Issue
Block a user