[glibmm] Glib::MiscUtils: Use std::vector instead of Glib::ArrayHandle<>.



commit 9b90baa37d58f836fe1a23bf4bf6fdf2392ccded
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Mar 17 10:33:49 2017 +0100

    Glib::MiscUtils: Use std::vector instead of Glib::ArrayHandle<>.
    
    Using Glib::ArrayHandler<>::vector_to_array() and
    Glib::ArrayHandler<>::array_to_vector() instead, and only in the
    implementatoin instead of in the API.

 glib/src/miscutils.ccg |   12 ++++++------
 glib/src/miscutils.hg  |    7 +++----
 2 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/glib/src/miscutils.ccg b/glib/src/miscutils.ccg
index 4d2f331..579bcca 100644
--- a/glib/src/miscutils.ccg
+++ b/glib/src/miscutils.ccg
@@ -75,7 +75,7 @@ unsetenv(const std::string& variable)
   g_unsetenv(variable.c_str());
 }
 
-Glib::ArrayHandle<std::string>
+std::vector<std::string>
 listenv()
 {
   char** value = g_listenv();
@@ -84,7 +84,7 @@ listenv()
   {
     ++end;
   }
-  return Glib::ArrayHandle<std::string>(value, end - value, Glib::OWNERSHIP_DEEP);
+  return Glib::ArrayHandler<std::string>::array_to_vector(value, end - value, Glib::OWNERSHIP_DEEP);
 }
 
 std::string
@@ -202,10 +202,10 @@ path_get_dirname(const std::string& filename)
 }
 
 std::string
-build_filename(const Glib::ArrayHandle<std::string>& elements)
+build_filename(const std::vector<std::string>& elements)
 {
   return convert_return_gchar_ptr_to_stdstring(
-    g_build_filenamev(const_cast<char**>(elements.data())));
+    
g_build_filenamev(const_cast<char**>(Glib::ArrayHandler<std::string>::vector_to_array(elements).data())));
 }
 
 std::string
@@ -276,10 +276,10 @@ build_filename(const std::string& elem1, const std::string& elem2, const std::st
 }
 
 std::string
-build_path(const std::string& separator, const Glib::ArrayHandle<std::string>& elements)
+build_path(const std::string& separator, const std::vector<std::string>& elements)
 {
   return convert_return_gchar_ptr_to_stdstring(
-    g_build_pathv(separator.c_str(), const_cast<char**>(elements.data())));
+    g_build_pathv(separator.c_str(), 
const_cast<char**>(Glib::ArrayHandler<std::string>::vector_to_array(elements).data())));
 }
 
 std::string
diff --git a/glib/src/miscutils.hg b/glib/src/miscutils.hg
index 63040c0..d6e39ed 100644
--- a/glib/src/miscutils.hg
+++ b/glib/src/miscutils.hg
@@ -17,7 +17,6 @@
 
 _DEFS(glibmm,glib)
 
-#include <glibmm/arrayhandle.h>
 #include <glibmm/ustring.h>
 
 namespace Glib
@@ -134,7 +133,7 @@ void unsetenv(const std::string& variable);
  * @return Array of environment names (The generic ArrayHandle will be
  * implicitly converted to any STL compatible container type).
  */
-Glib::ArrayHandle<std::string> listenv();
+std::vector<std::string> listenv();
 
 /** Gets the user name of the current user.
  * @return The name of the current user.
@@ -267,7 +266,7 @@ std::string path_get_dirname(const std::string& filename);
  *   Any STL compatible container type is accepted.
  * @return The resulting path.
  */
-std::string build_filename(const Glib::ArrayHandle<std::string>& elements);
+std::string build_filename(const std::vector<std::string>&  elements);
 
 /** Creates a filename from two elements using the correct separator for filenames.
  * No attempt is made to force the resulting filename to be an absolute path.
@@ -433,7 +432,7 @@ std::string build_filename(const std::string& elem1, const std::string& elem2,
  * @return The resulting path.
  */
 std::string build_path(const std::string& separator,
-                       const Glib::ArrayHandle<std::string>& elements);
+                       const std::vector<std::string>&  elements);
 
 /** Locates the first executable named @a program in the user's path, in the
  * same way that <tt>execvp()</tt> would locate it.


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