[gparted] Create get_byte_length method



commit fe9ee68385d5f8267055b2e79bd465efc86c6afd
Author: Curtis Gedak <gedakc gmail com>
Date:   Tue Apr 27 11:28:36 2010 -0600

    Create get_byte_length method

 include/Partition.h |    1 +
 src/Partition.cc    |    8 ++++++++
 2 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/include/Partition.h b/include/Partition.h
index 3037e14..d1b0eba 100644
--- a/include/Partition.h
+++ b/include/Partition.h
@@ -82,6 +82,7 @@ public:
 	
 	void add_path( const Glib::ustring & path, bool clear_paths = false ) ;
 	void add_paths( const std::vector<Glib::ustring> & paths, bool clear_paths = false ) ;
+	Byte_Value get_byte_length() const ;
 	Sector get_length() const ; 
 	Glib::ustring get_path() const ;
 	std::vector<Glib::ustring> get_paths() const ;
diff --git a/src/Partition.cc b/src/Partition.cc
index ab22fb6..535aba0 100644
--- a/src/Partition.cc
+++ b/src/Partition.cc
@@ -154,6 +154,14 @@ void Partition::add_paths( const std::vector<Glib::ustring> & paths, bool clear_
 	sort_paths_and_remove_duplicates() ;
 }
 
+Byte_Value Partition::get_byte_length() const 
+{
+	if ( get_length() >= 0 )
+		return get_length() * sector_size ;
+	else
+		return -1 ;
+}
+
 Sector Partition::get_length() const 
 {
 	if ( sector_start >= 0 && sector_end >= 0 )



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]