[gparted] Use PartitionVector class throughout the code (#759726)



commit fae909897e92b55aed0624ec8ccf221806e23ef4
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sat May 23 20:22:37 2015 +0100

    Use PartitionVector class throughout the code (#759726)
    
    Replace all occurrences of std::vector<Partition> with PartitionVector.
    
    Bug 759726 - Implement Partition object polymorphism

 include/Device.h                       |    3 ++-
 include/Dialog_Partition_Resize_Move.h |   10 ++++++----
 include/Dialog_Rescue_Data.h           |    3 ++-
 include/DrawingAreaVisualDisk.h        |   15 ++++++++-------
 include/GParted_Core.h                 |   16 +++++++++-------
 include/Operation.h                    |   19 +++++++++++--------
 include/OperationChangeUUID.h          |    4 +++-
 include/OperationCheck.h               |    6 ++++--
 include/OperationCopy.h                |    6 ++++--
 include/OperationCreate.h              |    6 ++++--
 include/OperationDelete.h              |   12 +++++++-----
 include/OperationFormat.h              |    6 ++++--
 include/OperationLabelFileSystem.h     |    4 +++-
 include/OperationNamePartition.h       |    4 +++-
 include/OperationResizeMove.h          |   16 +++++++++-------
 include/Partition.h                    |    4 ++--
 include/TreeView_Detail.h              |    5 +++--
 include/Win_GParted.h                  |    3 ++-
 src/Dialog_Partition_Resize_Move.cc    |   10 ++++++----
 src/Dialog_Rescue_Data.cc              |    1 +
 src/DrawingAreaVisualDisk.cc           |   20 +++++++++++---------
 src/GParted_Core.cc                    |   18 ++++++++++--------
 src/Operation.cc                       |   18 +++++++++++-------
 src/OperationChangeUUID.cc             |    4 +++-
 src/OperationCheck.cc                  |    6 ++++--
 src/OperationCopy.cc                   |    6 ++++--
 src/OperationCreate.cc                 |    6 ++++--
 src/OperationDelete.cc                 |    8 +++++---
 src/OperationFormat.cc                 |    6 ++++--
 src/OperationLabelFileSystem.cc        |    4 +++-
 src/OperationNamePartition.cc          |    4 +++-
 src/OperationResizeMove.cc             |   12 +++++++-----
 src/TreeView_Detail.cc                 |    6 ++++--
 src/Win_GParted.cc                     |    6 ++++--
 34 files changed, 170 insertions(+), 107 deletions(-)
---
diff --git a/include/Device.h b/include/Device.h
index 7935a96..0112340 100644
--- a/include/Device.h
+++ b/include/Device.h
@@ -19,6 +19,7 @@
 #define GPARTED_DEVICE_H
 
 #include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -43,7 +44,7 @@ public:
        bool operator!=( const Device & device ) const ;
        
        void Reset() ;
-       std::vector<Partition> partitions ;
+       PartitionVector partitions;
        Sector length;
        Sector heads ;
        Sector sectors ;
diff --git a/include/Dialog_Partition_Resize_Move.h b/include/Dialog_Partition_Resize_Move.h
index e803ba6..98553b2 100644
--- a/include/Dialog_Partition_Resize_Move.h
+++ b/include/Dialog_Partition_Resize_Move.h
@@ -18,6 +18,8 @@
 #define GPARTED_DIALOG_PARTITION_RESIZE_MOVE_H
 
 #include "../include/Dialog_Base_Partition.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -26,12 +28,12 @@ class Dialog_Partition_Resize_Move : public Dialog_Base_Partition
 {
 public:
        Dialog_Partition_Resize_Move( const FS & fs, const Partition & selected_partition,
-                                     const std::vector <Partition> & partitions );
+                                     const PartitionVector & partitions );
 
 private:
-       void set_data( const Partition & selected_partition, const std::vector <Partition> & partitions );
-       void Resize_Move_Normal( const std::vector <Partition> & partitions ) ;
-       void Resize_Move_Extended( const std::vector <Partition> & partitions ) ;
+       void set_data( const Partition & selected_partition, const PartitionVector & partitions );
+       void Resize_Move_Normal( const PartitionVector & partitions );
+       void Resize_Move_Extended( const PartitionVector & partitions );
 };
 
 } //GParted
diff --git a/include/Dialog_Rescue_Data.h b/include/Dialog_Rescue_Data.h
index 0b3e54c..97425c1 100644
--- a/include/Dialog_Rescue_Data.h
+++ b/include/Dialog_Rescue_Data.h
@@ -24,6 +24,7 @@
 
 #include "../include/Device.h"
 #include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 #include <gtkmm/dialog.h>
 #include <gtkmm/frame.h>
@@ -51,7 +52,7 @@ private:
        bool is_inconsistent(const Partition &part);
 
        Device *device; //Parent device
-       std::vector<Partition> partitions; //Partitions readed from the buffer
+       PartitionVector partitions; //Partitions read from the buffer
        std::vector<int> overlappedPartitions;//List of guessed partitions that
                                                                                  //overlap active partitions
        Glib::ustring device_path;
diff --git a/include/DrawingAreaVisualDisk.h b/include/DrawingAreaVisualDisk.h
index ccd1a15..9f4b41a 100644
--- a/include/DrawingAreaVisualDisk.h
+++ b/include/DrawingAreaVisualDisk.h
@@ -18,6 +18,7 @@
 #define GPARTED_DRAWINGAREAVISUALDISK_H
 
 #include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 #include <gtkmm/drawingarea.h>
 
@@ -29,8 +30,8 @@ class DrawingAreaVisualDisk : public Gtk::DrawingArea
 public:
        DrawingAreaVisualDisk();
        ~DrawingAreaVisualDisk();
-       
-       void load_partitions( const std::vector<Partition> & partitions, Sector device_length );
+
+       void load_partitions( const PartitionVector & partitions, Sector device_length );
        void set_selected( const Partition * partition_ptr );
        void clear() ;
 
@@ -43,11 +44,11 @@ private:
        struct visual_partition ; 
 
        //private functions     
-       int get_total_separator_px( const std::vector<Partition> & partitions ) ;
-       
-       void set_static_data( const std::vector<Partition> & partitions, 
-                             std::vector<visual_partition> & visual_partitions,
-                             Sector length ) ;
+       int get_total_separator_px( const PartitionVector & partitions );
+
+       void set_static_data( const PartitionVector & partitions,
+                             std::vector<visual_partition> & visual_partitions,
+                             Sector length );
        int calc_length( std::vector<visual_partition> & visual_partitions, int length_px ) ;
        void calc_position_and_height( std::vector<visual_partition> & visual_partitions, int start, int 
border ) ;
        void calc_usage( std::vector<visual_partition> & visual_partitions ) ;
diff --git a/include/GParted_Core.h b/include/GParted_Core.h
index e378992..b36bb62 100644
--- a/include/GParted_Core.h
+++ b/include/GParted_Core.h
@@ -20,6 +20,8 @@
 
 #include "../include/FileSystem.h"
 #include "../include/Operation.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 #include <parted/parted.h>
 #include <vector>
@@ -90,15 +92,15 @@ private:
        void read_label( Partition & partition ) ;
        void read_uuid( Partition & partition ) ;
        void insert_unallocated( const Glib::ustring & device_path,
-                                std::vector<Partition> & partitions,
-                                Sector start,
-                                Sector end,
-                                Byte_Value sector_size,
-                                bool inside_extended ) ;
-       void set_mountpoints( std::vector<Partition> & partitions ) ;
+                                PartitionVector & partitions,
+                                Sector start,
+                                Sector end,
+                                Byte_Value sector_size,
+                                bool inside_extended );
+       void set_mountpoints( PartitionVector & partitions );
        bool set_mountpoints_helper( Partition & partitions, const Glib::ustring & path ) ;
        bool is_busy( FILESYSTEM fstype, const Glib::ustring & path ) ;
-       void set_used_sectors( std::vector<Partition> & partitions, PedDisk* lp_disk ) ;
+       void set_used_sectors( PartitionVector & partitions, PedDisk* lp_disk );
        void mounted_set_used_sectors( Partition & partition ) ;
 #ifdef HAVE_LIBPARTED_FS_RESIZE
        void LP_set_used_sectors( Partition & partition, PedDisk* lp_disk ) ;
diff --git a/include/Operation.h b/include/Operation.h
index 83ea8c8..b2121b3 100644
--- a/include/Operation.h
+++ b/include/Operation.h
@@ -20,6 +20,8 @@
 
 #include "../include/Device.h"
 #include "../include/OperationDetail.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -42,8 +44,8 @@ class Operation
 public:
        Operation() ;
        virtual ~Operation() {}
-       
-       virtual void apply_to_visual( std::vector<Partition> & partitions ) = 0 ;
+
+       virtual void apply_to_visual( PartitionVector & partitions ) = 0;
        virtual void create_description() = 0 ;
        virtual bool merge_operations( const Operation & candidate ) = 0;
 
@@ -59,12 +61,13 @@ public:
        OperationDetail operation_detail ;
 
 protected:
-       int find_index_original( const std::vector<Partition> & partitions ) ;
-       int find_index_new( const std::vector<Partition> & partitions );
-       int find_index_extended( const std::vector<Partition> & partitions ) ;
-       void insert_unallocated( std::vector<Partition> & partitions, Sector start, Sector end, Byte_Value 
sector_size, bool inside_extended );
-       void substitute_new( std::vector<Partition> & partitions );
-       void insert_new( std::vector<Partition> & partitions );
+       int find_index_original( const PartitionVector & partitions );
+       int find_index_new( const PartitionVector & partitions );
+       int find_index_extended( const PartitionVector & partitions );
+       void insert_unallocated( PartitionVector & partitions,
+                                Sector start, Sector end, Byte_Value sector_size, bool inside_extended );
+       void substitute_new( PartitionVector & partitions );
+       void insert_new( PartitionVector & partitions );
 };
 
 } //GParted
diff --git a/include/OperationChangeUUID.h b/include/OperationChangeUUID.h
index e34a0fd..9366e5c 100644
--- a/include/OperationChangeUUID.h
+++ b/include/OperationChangeUUID.h
@@ -18,6 +18,8 @@
 #define GPARTED_OPERATIONCHANGEUUID_H
 
 #include "../include/Operation.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -30,7 +32,7 @@ public:
                           , const Partition & partition_new
                           ) ;
 
-void apply_to_visual( std::vector<Partition> & partitions ) ;
+       void apply_to_visual( PartitionVector & partitions );
 
 private:
        void create_description() ;
diff --git a/include/OperationCheck.h b/include/OperationCheck.h
index 1d62ed2..3707d2e 100644
--- a/include/OperationCheck.h
+++ b/include/OperationCheck.h
@@ -18,6 +18,8 @@
 #define GPARTED_OPERATIONCHECK_H
 
 #include "../include/Operation.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -26,8 +28,8 @@ class OperationCheck : public Operation
 {
 public:
        OperationCheck( const Device & device, const Partition & partition ) ;
-       
-       void apply_to_visual( std::vector<Partition> & partitions ) ;
+
+       void apply_to_visual( PartitionVector & partitions );
 
 private:
        void create_description() ;
diff --git a/include/OperationCopy.h b/include/OperationCopy.h
index 43bbed4..fb6b62e 100644
--- a/include/OperationCopy.h
+++ b/include/OperationCopy.h
@@ -18,6 +18,8 @@
 #define GPARTED_OPERATIONCOPY_H
 
 #include "../include/Operation.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -29,8 +31,8 @@ public:
                       const Partition & partition_orig,
                       const Partition & partition_new,
                       const Partition & partition_copied ) ;
-       
-       void apply_to_visual( std::vector<Partition> & partitions ) ;
+
+       void apply_to_visual( PartitionVector & partitions );
 
        Partition partition_copied ;
 
diff --git a/include/OperationCreate.h b/include/OperationCreate.h
index 223b10a..4ae474e 100644
--- a/include/OperationCreate.h
+++ b/include/OperationCreate.h
@@ -18,6 +18,8 @@
 #define GPARTED_OPERATIONCREATE_H
 
 #include "../include/Operation.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -28,8 +30,8 @@ public:
        OperationCreate( const Device & device,
                         const Partition & partition_orig,
                         const Partition & partition_new ) ;
-       
-       void apply_to_visual( std::vector<Partition> & partitions ) ;
+
+       void apply_to_visual( PartitionVector & partitions );
 
 private:
        void create_description() ;
diff --git a/include/OperationDelete.h b/include/OperationDelete.h
index 333b919..296abc2 100644
--- a/include/OperationDelete.h
+++ b/include/OperationDelete.h
@@ -18,6 +18,8 @@
 #define GPARTED_OPERATIONDELETE_H
 
 #include "../include/Operation.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -26,14 +28,14 @@ class OperationDelete : public Operation
 {
 public:
        OperationDelete( const Device & device, const Partition & partition_orig ) ;
-       
-       void apply_to_visual( std::vector<Partition> & partitions ) ;
-               
+
+       void apply_to_visual( PartitionVector & partitions );
+
 private:
        void create_description() ;
        bool merge_operations( const Operation & candidate );
-       void remove_original_and_adjacent_unallocated( std::vector<Partition> & partitions, int index_orig ) ;
-} ;
+       void remove_original_and_adjacent_unallocated( PartitionVector & partitions, int index_orig );
+};
 
 } //GParted
 
diff --git a/include/OperationFormat.h b/include/OperationFormat.h
index afc4d5b..97eaed3 100644
--- a/include/OperationFormat.h
+++ b/include/OperationFormat.h
@@ -18,6 +18,8 @@
 #define GPARTED_OPERATIONFORMAT_H
 
 #include "../include/Operation.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -28,8 +30,8 @@ public:
        OperationFormat( const Device & device,
                         const Partition & partition_orig,
                         const Partition & partition_new ) ;
-       
-       void apply_to_visual( std::vector<Partition> & partitions ) ;
+
+       void apply_to_visual( PartitionVector & partitions );
 
 private:
        void create_description() ;
diff --git a/include/OperationLabelFileSystem.h b/include/OperationLabelFileSystem.h
index fa3459d..372ea1a 100644
--- a/include/OperationLabelFileSystem.h
+++ b/include/OperationLabelFileSystem.h
@@ -18,6 +18,8 @@
 #define GPARTED_OPERATIONLABELFILESYSTEM_H
 
 #include "../include/Operation.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -29,7 +31,7 @@ public:
                                  const Partition & partition_orig,
                                  const Partition & partition_new );
 
-       void apply_to_visual( std::vector<Partition> & partitions );
+       void apply_to_visual( PartitionVector & partitions );
 
 private:
        void create_description() ;
diff --git a/include/OperationNamePartition.h b/include/OperationNamePartition.h
index 1ac822b..c49f094 100644
--- a/include/OperationNamePartition.h
+++ b/include/OperationNamePartition.h
@@ -18,6 +18,8 @@
 #define GPARTED_OPERATIONNAMEPARTITION_H
 
 #include "../include/Operation.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -29,7 +31,7 @@ public:
                                const Partition & partition_orig,
                                const Partition & partition_new );
 
-       void apply_to_visual( std::vector<Partition> & partitions );
+       void apply_to_visual( PartitionVector & partitions );
 
 private:
        void create_description();
diff --git a/include/OperationResizeMove.h b/include/OperationResizeMove.h
index 96bd06d..462a9d2 100644
--- a/include/OperationResizeMove.h
+++ b/include/OperationResizeMove.h
@@ -18,6 +18,8 @@
 #define GPARTED_OPERATIONRESIZEMOVE_H
 
 #include "../include/Operation.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -28,18 +30,18 @@ public:
        OperationResizeMove( const Device & device,
                             const Partition & partition_orig,
                             const Partition & partition_new ) ;
-       
-       void apply_to_visual( std::vector<Partition> & partitions ) ;
+
+       void apply_to_visual( PartitionVector & partitions );
 
 private:
        void create_description() ;
        bool merge_operations( const Operation & candidate );
 
-       void apply_normal_to_visual( std::vector<Partition> & partitions ) ;
-       void apply_extended_to_visual( std::vector<Partition> & partitions ) ;
-       
-       void remove_adjacent_unallocated( std::vector<Partition> & partitions, int index_orig ) ; 
-} ;
+       void apply_normal_to_visual( PartitionVector & partitions );
+       void apply_extended_to_visual( PartitionVector & partitions );
+
+       void remove_adjacent_unallocated( PartitionVector & partitions, int index_orig );
+};
 
 } //GParted
 
diff --git a/include/Partition.h b/include/Partition.h
index a37ed08..f2e0ebe 100644
--- a/include/Partition.h
+++ b/include/Partition.h
@@ -140,8 +140,8 @@ public:
        bool busy;
        std::vector<Glib::ustring> messages ;
        std::vector<Glib::ustring> flags ;
-       
-       std::vector<Partition> logicals ;
+
+       PartitionVector logicals;
 
        bool strict_start ;     //Indicator if start sector must stay unchanged
        Sector free_space_before ;  //Free space preceding partition value
diff --git a/include/TreeView_Detail.h b/include/TreeView_Detail.h
index 8aedc18..059fc3b 100644
--- a/include/TreeView_Detail.h
+++ b/include/TreeView_Detail.h
@@ -18,6 +18,7 @@
 #define GPARTED_TREEVIEW_DETAIL_H
 
 #include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 #include <gtkmm/treeview.h>
 #include <gtkmm/treestore.h>
@@ -35,7 +36,7 @@ class TreeView_Detail : public Gtk::TreeView
 {
 public:
        TreeView_Detail();
-       void load_partitions( const std::vector<Partition> & partitions ) ;
+       void load_partitions( const PartitionVector & partitions );
        void set_selected( const Partition * partition_ptr );
        void clear() ;
 
@@ -45,7 +46,7 @@ public:
        sigc::signal< void, unsigned int, unsigned int > signal_popup_menu ;
 
 private:
-       void load_partitions( const std::vector<Partition> & partitions,
+       void load_partitions( const PartitionVector & partitions,
                              bool & mountpoints,
                              bool & labels,
                              bool & names,
diff --git a/include/Win_GParted.h b/include/Win_GParted.h
index 57c7ce4..63512d1 100644
--- a/include/Win_GParted.h
+++ b/include/Win_GParted.h
@@ -21,6 +21,7 @@
 #include "../include/Device.h"
 #include "../include/DrawingAreaVisualDisk.h"
 #include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 #include "../include/TreeView_Detail.h"
 #include "../include/GParted_Core.h"
 #include "../include/HBoxOperations.h" 
@@ -191,7 +192,7 @@ private:
 
 //private variables
        unsigned int current_device ;
-       std::vector<Partition> display_partitions;  // Copy of current device's partitions with any pending
+       PartitionVector display_partitions;         // Copy of current device's partitions with any pending
                                                    // operations applied, as currently being shown in the 
GUI.
        const Partition * selected_partition_ptr;   // Pointer to the selected partition.  (Alias to element
                                                    // in Win_GParted::display_partitions[] vector).
diff --git a/src/Dialog_Partition_Resize_Move.cc b/src/Dialog_Partition_Resize_Move.cc
index 68425aa..f907215 100644
--- a/src/Dialog_Partition_Resize_Move.cc
+++ b/src/Dialog_Partition_Resize_Move.cc
@@ -17,19 +17,21 @@
  
 #include "../include/Dialog_Partition_Resize_Move.h"
 #include "../include/GParted_Core.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
 
 Dialog_Partition_Resize_Move::Dialog_Partition_Resize_Move( const FS & fs, const Partition & 
selected_partition,
-                                                            const std::vector<Partition> & partitions )
+                                                            const PartitionVector & partitions )
 {
        this ->fs = fs ;
        set_data( selected_partition, partitions );
 }
 
 void Dialog_Partition_Resize_Move::set_data( const Partition & selected_partition,
-                                             const std::vector<Partition> & partitions )
+                                             const PartitionVector & partitions )
 {
        GRIP = true ; //prevents on spinbutton_changed from getting activated prematurely
 
@@ -60,7 +62,7 @@ void Dialog_Partition_Resize_Move::set_data( const Partition & selected_partitio
        this ->show_all_children() ;
 }
 
-void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partition> & partitions )
+void Dialog_Partition_Resize_Move::Resize_Move_Normal( const PartitionVector & partitions )
 {
        //little bit of paranoia ;)
        if ( ! new_partition.sector_usage_known() &&
@@ -215,7 +217,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
                       ) ;
 }
 
-void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector<Partition> & partitions )
+void Dialog_Partition_Resize_Move::Resize_Move_Extended( const PartitionVector & partitions )
 {
        //calculate total size in MiB's of previous, current and next partition
        //first find index of partition
diff --git a/src/Dialog_Rescue_Data.cc b/src/Dialog_Rescue_Data.cc
index 0b0e346..a54a02a 100644
--- a/src/Dialog_Rescue_Data.cc
+++ b/src/Dialog_Rescue_Data.cc
@@ -17,6 +17,7 @@
 
 #include "../include/Utils.h"
 #include "../include/Dialog_Rescue_Data.h"
+#include "../include/Partition.h"
 
 #include <gtkmm/messagedialog.h>
 #include <gtkmm/stock.h>
diff --git a/src/DrawingAreaVisualDisk.cc b/src/DrawingAreaVisualDisk.cc
index 65d0c5d..8702032 100644
--- a/src/DrawingAreaVisualDisk.cc
+++ b/src/DrawingAreaVisualDisk.cc
@@ -16,6 +16,8 @@
  */
 
 #include "../include/DrawingAreaVisualDisk.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 #define MAIN_BORDER 5
 #define BORDER 4
@@ -46,8 +48,8 @@ DrawingAreaVisualDisk::DrawingAreaVisualDisk()
        
        set_size_request( -1, HEIGHT ) ;
 }
-       
-void DrawingAreaVisualDisk::load_partitions( const std::vector<Partition> & partitions, Sector device_length 
)
+
+void DrawingAreaVisualDisk::load_partitions( const PartitionVector & partitions, Sector device_length )
 {
        clear() ;       
        
@@ -73,8 +75,8 @@ void DrawingAreaVisualDisk::clear()
        
        queue_resize() ;
 }
-       
-int DrawingAreaVisualDisk::get_total_separator_px( const std::vector<Partition> & partitions ) 
+
+int DrawingAreaVisualDisk::get_total_separator_px( const PartitionVector & partitions )
 {
        for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
                if ( partitions[ t ] .type == GParted::TYPE_EXTENDED )
@@ -84,9 +86,9 @@ int DrawingAreaVisualDisk::get_total_separator_px( const std::vector<Partition>
        return ( partitions .size() -1 ) * SEP ;
 }      
 
-void DrawingAreaVisualDisk::set_static_data( const std::vector<Partition> & partitions,
-                                            std::vector<visual_partition> & visual_partitions,
-                                            Sector length ) 
+void DrawingAreaVisualDisk::set_static_data( const PartitionVector & partitions,
+                                             std::vector<visual_partition> & visual_partitions,
+                                             Sector length )
 {
        for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
        {
@@ -100,8 +102,8 @@ void DrawingAreaVisualDisk::set_static_data( const std::vector<Partition> & part
                get_colormap() ->alloc_color( visual_partitions .back() .color );
 
                if ( partitions[ t ] .type == GParted::TYPE_EXTENDED )
-                       set_static_data( partitions[ t ] .logicals,
-                                        visual_partitions .back() .logicals, partition_length ) ;
+                       set_static_data( partitions[t].logicals,
+                                        visual_partitions.back().logicals, partition_length );
                else
                        visual_partitions .back() .pango_layout = create_pango_layout( 
                                partitions[ t ] .get_path() + "\n" + Utils::format_size( partition_length, 
partitions[ t ] .sector_size ) ) ;
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 485a764..f93d6db 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -22,6 +22,8 @@
 #include "../include/LVM2_PV_Info.h"
 #include "../include/Operation.h"
 #include "../include/OperationCopy.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 #include "../include/Proc_Partitions_Info.h"
 #include "../include/SWRaid_Info.h"
 
@@ -1677,11 +1679,11 @@ void GParted_Core::read_uuid( Partition & partition )
 }
 
 void GParted_Core::insert_unallocated( const Glib::ustring & device_path,
-                                      std::vector<Partition> & partitions,
-                                      Sector start,
-                                      Sector end,
-                                      Byte_Value sector_size,
-                                      bool inside_extended )
+                                       PartitionVector & partitions,
+                                       Sector start,
+                                       Sector end,
+                                       Byte_Value sector_size,
+                                       bool inside_extended )
 {
        Partition partition_temp ;
        partition_temp.Set_Unallocated( device_path, false, 0LL, 0LL, sector_size, inside_extended );
@@ -1731,8 +1733,8 @@ void GParted_Core::insert_unallocated( const Glib::ustring & device_path,
                partitions .push_back( partition_temp );
        }
 }
-       
-void GParted_Core::set_mountpoints( std::vector<Partition> & partitions ) 
+
+void GParted_Core::set_mountpoints( PartitionVector & partitions )
 {
 #ifndef USE_LIBPARTED_DMRAID
        DMRaid dmraid ; //Use cache of dmraid device information
@@ -1865,7 +1867,7 @@ bool GParted_Core::is_busy( FILESYSTEM fstype, const Glib::ustring & path )
        return busy ;
 }
 
-void GParted_Core::set_used_sectors( std::vector<Partition> & partitions, PedDisk* lp_disk )
+void GParted_Core::set_used_sectors( PartitionVector & partitions, PedDisk* lp_disk )
 {
        for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
        {
diff --git a/src/Operation.cc b/src/Operation.cc
index 5b16ca6..2c97d36 100644
--- a/src/Operation.cc
+++ b/src/Operation.cc
@@ -14,7 +14,10 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
+
 #include "../include/Operation.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -22,8 +25,8 @@ namespace GParted
 Operation::Operation()
 {
 }
-       
-int Operation::find_index_original( const std::vector<Partition> & partitions ) 
+
+int Operation::find_index_original( const PartitionVector & partitions )
 {
        for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
                if ( partition_original .sector_start >= partitions[ t ] .sector_start &&
@@ -35,7 +38,7 @@ int Operation::find_index_original( const std::vector<Partition> & partitions )
 
 // Find the partition in the vector that exactly matches or fully encloses
 // this->partition_new.  Return vector index or -1 when no match found.
-int Operation::find_index_new( const std::vector<Partition> & partitions )
+int Operation::find_index_new( const PartitionVector & partitions )
 {
        for ( unsigned int i = 0 ; i < partitions.size() ; i ++ )
                if ( partition_new.sector_start >= partitions[i].sector_start &&
@@ -45,7 +48,7 @@ int Operation::find_index_new( const std::vector<Partition> & partitions )
        return -1;
 }
 
-int Operation::find_index_extended( const std::vector<Partition> & partitions ) 
+int Operation::find_index_extended( const PartitionVector & partitions )
 {
        for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
                if ( partitions[ t ] .type == GParted::TYPE_EXTENDED )
@@ -54,7 +57,8 @@ int Operation::find_index_extended( const std::vector<Partition> & partitions )
        return -1 ;
 }
 
-void Operation::insert_unallocated( std::vector<Partition> & partitions, Sector start, Sector end, 
Byte_Value sector_size, bool inside_extended )
+void Operation::insert_unallocated( PartitionVector & partitions,
+                                    Sector start, Sector end, Byte_Value sector_size, bool inside_extended )
 {
        Partition UNALLOCATED ;
        UNALLOCATED.Set_Unallocated( device.get_path(), false, 0LL, 0LL, sector_size, inside_extended );
@@ -108,7 +112,7 @@ void Operation::insert_unallocated( std::vector<Partition> & partitions, Sector
 // Visual re-apply this operation, for operations which don't change the partition
 // boundaries.  Matches this operation's original partition in the vector and substitutes
 // it with this operation's new partition.
-void Operation::substitute_new( std::vector<Partition> & partitions )
+void Operation::substitute_new( PartitionVector & partitions )
 {
        int index_extended;
        int index;
@@ -132,7 +136,7 @@ void Operation::substitute_new( std::vector<Partition> & partitions )
 }
 
 // Visually re-apply this operation, for operations which create new partitions.
-void Operation::insert_new( std::vector<Partition> & partitions )
+void Operation::insert_new( PartitionVector & partitions )
 {
        // Create operations are unique in that they apply to unallocated space.  It only
        // matters that the new partition being created fits in an unallocated space when
diff --git a/src/OperationChangeUUID.cc b/src/OperationChangeUUID.cc
index e01482f..b610764 100644
--- a/src/OperationChangeUUID.cc
+++ b/src/OperationChangeUUID.cc
@@ -15,6 +15,8 @@
  */
 
 #include "../include/OperationChangeUUID.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -31,7 +33,7 @@ OperationChangeUUID::OperationChangeUUID( const Device & device
        this ->partition_new = partition_new ;
 }
 
-void OperationChangeUUID::apply_to_visual( std::vector<Partition> & partitions )
+void OperationChangeUUID::apply_to_visual( PartitionVector & partitions )
 {
        substitute_new( partitions );
 }
diff --git a/src/OperationCheck.cc b/src/OperationCheck.cc
index b3c5132..058644d 100644
--- a/src/OperationCheck.cc
+++ b/src/OperationCheck.cc
@@ -15,6 +15,8 @@
  */
 
 #include "../include/OperationCheck.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -26,8 +28,8 @@ OperationCheck::OperationCheck( const Device & device, const Partition & partiti
        this->device = device.get_copy_without_partitions();
        partition_original = partition ;
 }
-       
-void OperationCheck::apply_to_visual( std::vector<Partition> & partitions ) 
+
+void OperationCheck::apply_to_visual( PartitionVector & partitions )
 {
 }
 
diff --git a/src/OperationCopy.cc b/src/OperationCopy.cc
index bdd6d8d..892e3af 100644
--- a/src/OperationCopy.cc
+++ b/src/OperationCopy.cc
@@ -16,6 +16,8 @@
  */
 
 #include "../include/OperationCopy.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -35,8 +37,8 @@ OperationCopy::OperationCopy( const Device & device,
        this ->partition_new .add_path(  
                String::ucompose( _("copy of %1"), this ->partition_copied .get_path() ), true ) ;
 }
-       
-void OperationCopy::apply_to_visual( std::vector<Partition> & partitions ) 
+
+void OperationCopy::apply_to_visual( PartitionVector & partitions )
 {
        if ( partition_original.type == TYPE_UNALLOCATED )
                // Paste into unallocated space creating new partition
diff --git a/src/OperationCreate.cc b/src/OperationCreate.cc
index abe5b6f..e7deae0 100644
--- a/src/OperationCreate.cc
+++ b/src/OperationCreate.cc
@@ -16,6 +16,8 @@
  */
 
 #include "../include/OperationCreate.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -30,8 +32,8 @@ OperationCreate::OperationCreate( const Device & device,
        this ->partition_original = partition_orig ;
        this ->partition_new = partition_new ;
 }
-       
-void OperationCreate::apply_to_visual( std::vector<Partition> & partitions ) 
+
+void OperationCreate::apply_to_visual( PartitionVector & partitions )
 {
        insert_new( partitions );
 }
diff --git a/src/OperationDelete.cc b/src/OperationDelete.cc
index 20c6b75..77b9e12 100644
--- a/src/OperationDelete.cc
+++ b/src/OperationDelete.cc
@@ -16,6 +16,8 @@
  */
 
 #include "../include/OperationDelete.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -27,8 +29,8 @@ OperationDelete::OperationDelete( const Device & device, const Partition & parti
        this->device = device.get_copy_without_partitions();
        this ->partition_original = partition_orig ;
 }
-       
-void OperationDelete::apply_to_visual( std::vector<Partition> & partitions ) 
+
+void OperationDelete::apply_to_visual( PartitionVector & partitions )
 {
        int index_extended;
        int index;
@@ -96,7 +98,7 @@ bool OperationDelete::merge_operations( const Operation & candidate )
        return false;  // Can't merge with an already deleted partition
 }
 
-void OperationDelete::remove_original_and_adjacent_unallocated( std::vector<Partition> & partitions, int 
index_orig ) 
+void OperationDelete::remove_original_and_adjacent_unallocated( PartitionVector & partitions, int index_orig 
)
 {
        //remove unallocated space following the original partition
        if ( index_orig +1 < static_cast<int>( partitions .size() ) &&
diff --git a/src/OperationFormat.cc b/src/OperationFormat.cc
index 04db2cb..853b87d 100644
--- a/src/OperationFormat.cc
+++ b/src/OperationFormat.cc
@@ -15,6 +15,8 @@
  */
 
 #include "../include/OperationFormat.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -29,8 +31,8 @@ OperationFormat::OperationFormat( const Device & device,
        this ->partition_original = partition_orig ;
        this ->partition_new = partition_new ;
 }
-       
-void OperationFormat::apply_to_visual( std::vector<Partition> & partitions ) 
+
+void OperationFormat::apply_to_visual( PartitionVector & partitions )
 {
        if ( partition_original.whole_device && partition_new.filesystem == FS_CLEARED )
        {
diff --git a/src/OperationLabelFileSystem.cc b/src/OperationLabelFileSystem.cc
index 9d750bd..a91ae4e 100644
--- a/src/OperationLabelFileSystem.cc
+++ b/src/OperationLabelFileSystem.cc
@@ -15,6 +15,8 @@
  */
 
 #include "../include/OperationLabelFileSystem.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -30,7 +32,7 @@ OperationLabelFileSystem::OperationLabelFileSystem( const Device & device,
        this ->partition_new = partition_new ;
 }
 
-void OperationLabelFileSystem::apply_to_visual( std::vector<Partition> & partitions )
+void OperationLabelFileSystem::apply_to_visual( PartitionVector & partitions )
 {
        substitute_new( partitions );
 }
diff --git a/src/OperationNamePartition.cc b/src/OperationNamePartition.cc
index e352cd7..9414e4c 100644
--- a/src/OperationNamePartition.cc
+++ b/src/OperationNamePartition.cc
@@ -15,6 +15,8 @@
  */
 
 #include "../include/OperationNamePartition.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -30,7 +32,7 @@ OperationNamePartition::OperationNamePartition( const Device & device,
        this->partition_new = partition_new;
 }
 
-void OperationNamePartition::apply_to_visual( std::vector<Partition> & partitions )
+void OperationNamePartition::apply_to_visual( PartitionVector & partitions )
 {
        substitute_new( partitions );
 }
diff --git a/src/OperationResizeMove.cc b/src/OperationResizeMove.cc
index de51148..201f46e 100644
--- a/src/OperationResizeMove.cc
+++ b/src/OperationResizeMove.cc
@@ -16,6 +16,8 @@
  */
 
 #include "../include/OperationResizeMove.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 {
@@ -30,8 +32,8 @@ OperationResizeMove::OperationResizeMove( const Device & device,
        this ->partition_original = partition_orig ;
        this ->partition_new = partition_new ;
 }
-       
-void OperationResizeMove::apply_to_visual( std::vector<Partition> & partitions ) 
+
+void OperationResizeMove::apply_to_visual( PartitionVector & partitions )
 {
        if ( partition_original .type == GParted::TYPE_EXTENDED )
                apply_extended_to_visual( partitions ) ;
@@ -119,7 +121,7 @@ void OperationResizeMove::create_description()
                                                Utils::format_size( partition_new .get_sector_length(), 
partition_new .sector_size ) ) ;
 }
 
-void OperationResizeMove::apply_normal_to_visual( std::vector<Partition> & partitions )
+void OperationResizeMove::apply_normal_to_visual( PartitionVector & partitions )
 {
        int index_extended;
        int index;
@@ -159,7 +161,7 @@ void OperationResizeMove::apply_normal_to_visual( std::vector<Partition> & parti
        }
 }
 
-void OperationResizeMove::apply_extended_to_visual( std::vector<Partition> & partitions ) 
+void OperationResizeMove::apply_extended_to_visual( PartitionVector & partitions )
 {
        int index_extended;
 
@@ -201,7 +203,7 @@ void OperationResizeMove::apply_extended_to_visual( std::vector<Partition> & par
        }
 }
 
-void OperationResizeMove::remove_adjacent_unallocated( std::vector<Partition> & partitions, int index_orig ) 
+void OperationResizeMove::remove_adjacent_unallocated( PartitionVector & partitions, int index_orig )
 {
        //remove unallocated space following the original partition
        if ( index_orig +1 < static_cast<int>( partitions .size() ) &&
diff --git a/src/TreeView_Detail.cc b/src/TreeView_Detail.cc
index 91947e5..66b2529 100644
--- a/src/TreeView_Detail.cc
+++ b/src/TreeView_Detail.cc
@@ -16,6 +16,8 @@
  */
  
 #include "../include/TreeView_Detail.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 
 namespace GParted
 { 
@@ -84,7 +86,7 @@ TreeView_Detail::TreeView_Detail()
        }
 }
 
-void TreeView_Detail::load_partitions( const std::vector<Partition> & partitions ) 
+void TreeView_Detail::load_partitions( const PartitionVector & partitions )
 {
        bool mountpoints = false, labels = false, names = false;
        treestore_detail ->clear() ;
@@ -111,7 +113,7 @@ void TreeView_Detail::clear()
        treestore_detail ->clear() ;
 }
 
-void TreeView_Detail::load_partitions( const std::vector<Partition> & partitions,
+void TreeView_Detail::load_partitions( const PartitionVector & partitions,
                                        bool & mountpoints,
                                        bool & labels,
                                        bool & names,
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index 8e8e801..97008bd 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -36,6 +36,8 @@
 #include "../include/OperationChangeUUID.h"
 #include "../include/OperationLabelFileSystem.h"
 #include "../include/OperationNamePartition.h"
+#include "../include/Partition.h"
+#include "../include/PartitionVector.h"
 #include "../include/LVM2_PV_Info.h"
 #include "../config.h"
 
@@ -830,7 +832,7 @@ void Win_GParted::Refresh_Visual()
        // (2) Takes a copy of the partitions for the device currently being shown in the
        //     GUI and visually applies pending operations.
        //
-       //     Data owner: std::vector<Partition> Win_GParted::display_partitions
+       //     Data owner: PartitionVector Win_GParted::display_partitions
        //     Lifetime:   Valid until the next call to Refresh_Visual().
        //     Function:   Refresh_Visual()
        //
@@ -1708,7 +1710,7 @@ void Win_GParted::activate_resize()
        g_assert( selected_partition_ptr != NULL );  // Bug: Partition callback without a selected partition
        g_assert( valid_display_partition_ptr( selected_partition_ptr ) );  // Bug: Not pointing at a valid 
display partition object
 
-       std::vector<Partition> * display_partitions_ptr = &display_partitions;
+       PartitionVector * display_partitions_ptr = &display_partitions;
        if ( selected_partition_ptr->type == TYPE_LOGICAL )
        {
                unsigned int ext = 0 ;



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