Moved common code into new get_device_entry() method

svn path=/trunk/; revision=988
This commit is contained in:
Curtis Gedak 2008-11-29 16:22:48 +00:00
parent ffd362cb42
commit ab50d0254f
3 changed files with 14 additions and 4 deletions

View File

@ -1,5 +1,8 @@
2008-11-29 Curtis Gedak <gedakc@gmail.com>
* include/FS_Info.h,
src/FS_Info.cc: Moved common code into new get_device_entry() method.
* configure.in: Append -svn to version for continuing development
2008-11-28 Curtis Gedak <gedakc@gmail.com>

View File

@ -32,6 +32,7 @@ public:
Glib::ustring get_uuid( const Glib::ustring & path ) ;
private:
void load_fs_info_cache() ;
Glib::ustring get_device_entry( const Glib::ustring & path ) ;
Glib::ustring fs_info_cache ;
};

View File

@ -41,14 +41,21 @@ void FS_Info::load_fs_info_cache()
}
}
Glib::ustring FS_Info::get_device_entry( const Glib::ustring & path )
{
//Retrieve the line containing the device path
Glib::ustring regexp = "^" + path + ":([^\n]*)$" ;
Glib::ustring entry = Utils::regexp_label( fs_info_cache, regexp ) ;
return entry;
}
Glib::ustring FS_Info::get_label( const Glib::ustring & path, bool & found )
{
Glib::ustring label = "" ;
found = false ;
//Retrieve the line containing the device path
Glib::ustring regexp = "^" + path + ":([^\n]*)$" ;
Glib::ustring temp = Utils::regexp_label( fs_info_cache, regexp ) ;
Glib::ustring temp = get_device_entry( path ) ;
//Set indicator if LABEL found
if ( Utils::regexp_label( temp, "(LABEL=\")") != "" )
@ -62,8 +69,7 @@ Glib::ustring FS_Info::get_label( const Glib::ustring & path, bool & found )
Glib::ustring FS_Info::get_uuid( const Glib::ustring & path )
{
//Retrieve the line containing the device path
Glib::ustring regexp = "^" + path + ":([^\n]*)$" ;
Glib::ustring temp = Utils::regexp_label( fs_info_cache, regexp ) ;
Glib::ustring temp = get_device_entry( path ) ;
//Retrieve the UUID
Glib::ustring uuid = Utils::regexp_label( temp, "UUID=\"([^\"]*)\"" ) ;