[glibmm/vector] Glib now uses vectorutils.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm/vector] Glib now uses vectorutils.
- Date: Thu, 20 Jan 2011 20:35:15 +0000 (UTC)
commit 245b202d696dffa4ff176af7efd69247be642789
Author: Krzesimir Nowak <qdlacz gmail com>
Date: Thu Jan 20 21:31:02 2011 +0100
Glib now uses vectorutils.
glib/src/keyfile.ccg | 72 +++++++++++++++++++++++----------------------
glib/src/keyfile.hg | 35 +++++++++++-----------
glib/src/optiongroup.ccg | 22 ++++++++------
glib/src/regex.ccg | 5 ++-
glib/src/regex.hg | 15 +++++----
glib/src/shell.ccg | 6 ++--
glib/src/shell.hg | 8 ++--
glib/src/spawn.ccg | 37 ++++++++++++-----------
glib/src/spawn.hg | 21 +++++++------
9 files changed, 116 insertions(+), 105 deletions(-)
---
diff --git a/glib/src/keyfile.ccg b/glib/src/keyfile.ccg
index 27c6d3e..f93faba 100644
--- a/glib/src/keyfile.ccg
+++ b/glib/src/keyfile.ccg
@@ -15,6 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
namespace Glib
{
@@ -85,15 +87,15 @@ Glib::ustring KeyFile::to_data()
return Glib::convert_return_gchar_ptr_to_ustring(str);
}
-Glib::ArrayHandle<Glib::ustring> KeyFile::get_groups() const
+std::vector<Glib::ustring> KeyFile::get_groups() const
{
gsize length = 0;
char** const array = g_key_file_get_groups(const_cast<GKeyFile*>(gobj()), &length);
- return Glib::ArrayHandle<Glib::ustring>(array, length, Glib::OWNERSHIP_DEEP);
+ return Glib::VectorHandler<Glib::ustring>::array_to_vector(array, length, Glib::OWNERSHIP_DEEP);
}
-Glib::ArrayHandle<Glib::ustring> KeyFile::get_keys(const Glib::ustring& group_name) const
+std::vector<Glib::ustring> KeyFile::get_keys(const Glib::ustring& group_name) const
{
gsize length = 0;
GError* gerror = 0;
@@ -106,7 +108,7 @@ Glib::ArrayHandle<Glib::ustring> KeyFile::get_keys(const Glib::ustring& group_na
if(gerror)
Glib::Error::throw_exception(gerror);
- return Glib::ArrayHandle<Glib::ustring>(array, length, Glib::OWNERSHIP_DEEP);
+ return Glib::VectorHandler<Glib::ustring>::array_to_vector(array, length, Glib::OWNERSHIP_DEEP);
}
Glib::ustring KeyFile::get_locale_string(const Glib::ustring& group_name,
@@ -192,9 +194,9 @@ void KeyFile::set_double(const Glib::ustring& key, double value)
# define GLIBMM_ERROR_ARG
# define GLIBMM_THROW(err) if (err) Glib::Error::throw_exception(err)
-Glib::ArrayHandle<Glib::ustring> KeyFile::get_string_list(const Glib::ustring& group_name,
- const Glib::ustring& key
- GLIBMM_ERROR_ARG) const
+std::vector<Glib::ustring> KeyFile::get_string_list(const Glib::ustring& group_name,
+ const Glib::ustring& key
+ GLIBMM_ERROR_ARG) const
{
gsize length = 0;
GError* gerror = 0;
@@ -206,13 +208,13 @@ Glib::ArrayHandle<Glib::ustring> KeyFile::get_string_list(const Glib::ustring& g
GLIBMM_THROW(gerror);
- return Glib::ArrayHandle<Glib::ustring>(array, length, Glib::OWNERSHIP_DEEP);
+ return Glib::VectorHandler<Glib::ustring>::array_to_vector(array, length, Glib::OWNERSHIP_DEEP);
}
-Glib::ArrayHandle<Glib::ustring> KeyFile::get_locale_string_list(const Glib::ustring& group_name,
- const Glib::ustring& key,
- const Glib::ustring& locale
- GLIBMM_ERROR_ARG) const
+std::vector<Glib::ustring> KeyFile::get_locale_string_list(const Glib::ustring& group_name,
+ const Glib::ustring& key,
+ const Glib::ustring& locale
+ GLIBMM_ERROR_ARG) const
{
gsize length = 0;
GError* gerror = 0;
@@ -224,12 +226,12 @@ Glib::ArrayHandle<Glib::ustring> KeyFile::get_locale_string_list(const Glib::ust
GLIBMM_THROW(gerror);
- return Glib::ArrayHandle<Glib::ustring>(array, length, Glib::OWNERSHIP_DEEP);
+ return Glib::VectorHandler<Glib::ustring>::array_to_vector(array, length, Glib::OWNERSHIP_DEEP);
}
-Glib::ArrayHandle<bool> KeyFile::get_boolean_list(const Glib::ustring& group_name,
- const Glib::ustring& key
- GLIBMM_ERROR_ARG) const
+std::vector<bool> KeyFile::get_boolean_list(const Glib::ustring& group_name,
+ const Glib::ustring& key
+ GLIBMM_ERROR_ARG) const
{
gsize length = 0;
GError* gerror = 0;
@@ -241,12 +243,12 @@ Glib::ArrayHandle<bool> KeyFile::get_boolean_list(const Glib::ustring& group_nam
GLIBMM_THROW(gerror);
- return Glib::ArrayHandle<bool>(array, length, Glib::OWNERSHIP_SHALLOW);
+ return Glib::VectorHandler<bool>::array_to_vector(array, length, Glib::OWNERSHIP_SHALLOW);
}
-Glib::ArrayHandle<int> KeyFile::get_integer_list(const Glib::ustring& group_name,
- const Glib::ustring& key
- GLIBMM_ERROR_ARG) const
+std::vector<int> KeyFile::get_integer_list(const Glib::ustring& group_name,
+ const Glib::ustring& key
+ GLIBMM_ERROR_ARG) const
{
gsize length = 0;
GError* gerror = 0;
@@ -258,12 +260,12 @@ Glib::ArrayHandle<int> KeyFile::get_integer_list(const Glib::ustring& group_name
GLIBMM_THROW(gerror);
- return Glib::ArrayHandle<int>(array, length, Glib::OWNERSHIP_SHALLOW);
+ return Glib::VectorHandler<int>::array_to_vector(array, length, Glib::OWNERSHIP_SHALLOW);
}
-Glib::ArrayHandle<double> KeyFile::get_double_list(const Glib::ustring& group_name,
- const Glib::ustring& key
- GLIBMM_ERROR_ARG) const
+std::vector<double> KeyFile::get_double_list(const Glib::ustring& group_name,
+ const Glib::ustring& key
+ GLIBMM_ERROR_ARG) const
{
gsize length = 0;
GError* gerror = 0;
@@ -273,43 +275,43 @@ Glib::ArrayHandle<double> KeyFile::get_double_list(const Glib::ustring& group_na
&length, &gerror);
GLIBMM_THROW(gerror);
- return Glib::ArrayHandle<double>(array, length, Glib::OWNERSHIP_SHALLOW);
+ return Glib::VectorHandler<double>::array_to_vector(array, length, Glib::OWNERSHIP_SHALLOW);
}
void KeyFile::set_string_list(const Glib::ustring& group_name, const Glib::ustring& key,
- const Glib::ArrayHandle<Glib::ustring>& list)
+ const std::vector<Glib::ustring>& list)
{
g_key_file_set_string_list(gobj(), (group_name.empty()) ? 0 : group_name.c_str(),
- key.c_str(), list.data(), list.size());
+ key.c_str(), Glib::VectorHandler<Glib::ustring>::vector_to_array(list).data(), list.size());
}
void KeyFile::set_locale_string_list(const Glib::ustring& group_name,
const Glib::ustring& key, const Glib::ustring& locale,
- const Glib::ArrayHandle<Glib::ustring>& list)
+ const std::vector<Glib::ustring>& list)
{
g_key_file_set_locale_string_list(gobj(), (group_name.empty()) ? 0 : group_name.c_str(),
- key.c_str(), locale.c_str(), list.data(), list.size());
+ key.c_str(), locale.c_str(), Glib::VectorHandler<Glib::ustring>::vector_to_array(list).data(), list.size());
}
void KeyFile::set_integer_list(const Glib::ustring& group_name, const Glib::ustring& key,
- const Glib::ArrayHandle<int>& list)
+ const std::vector<int>& list)
{
g_key_file_set_integer_list(gobj(), (group_name.empty()) ? 0 : group_name.c_str(),
- key.c_str(), const_cast<int*>(list.data()), list.size());
+ key.c_str(), Glib::VectorHandler<int>::vector_to_array(list).data(), list.size());
}
void KeyFile::set_double_list(const Glib::ustring& group_name, const Glib::ustring& key,
- const Glib::ArrayHandle<double>& list)
+ const std::vector<double>& list)
{
g_key_file_set_double_list(gobj(), group_name.c_str(), key.c_str(),
- const_cast<double*>(list.data()), list.size());
+ Glib::VectorHandler<double>::vector_to_array(list).data(), list.size());
}
void KeyFile::set_boolean_list(const Glib::ustring& group_name, const Glib::ustring& key,
- const Glib::ArrayHandle<bool>& list)
+ const std::vector<bool>& list)
{
g_key_file_set_boolean_list(gobj(), (group_name.empty()) ? 0 : group_name.c_str(),
- key.c_str(), const_cast<gboolean*>(list.data()), list.size());
+ key.c_str(), Glib::VectorHandler<bool>::vector_to_array(list).data(), list.size());
}
Glib::ustring KeyFile::get_comment() const
diff --git a/glib/src/keyfile.hg b/glib/src/keyfile.hg
index 4796b24..dbff869 100644
--- a/glib/src/keyfile.hg
+++ b/glib/src/keyfile.hg
@@ -17,9 +17,10 @@
_DEFS(glibmm,glib)
+#include <vector>
+
#include <glibmmconfig.h>
#include <glibmm/ustring.h>
-#include <glibmm/arrayhandle.h>
#include <glibmm/error.h>
#include <glibmm/utility.h>
#include <glib.h>
@@ -131,9 +132,9 @@ public:
bool load_from_data(const Glib::ustring& data, KeyFileFlags flags = Glib::KEY_FILE_NONE);
_IGNORE(g_key_file_load_from_data)
-#m4 _CONVERSION(`const Glib::ArrayHandle<std::string>&', `const gchar**', `const_cast<const gchar**>($3.data())')
-#m4 _CONVERSION(`Glib::ArrayHandle<std::string>&', `gchar**', `const_cast<gchar**>($3.data())')
- _WRAP_METHOD(bool load_from_dirs(const std::string& file, const Glib::ArrayHandle<std::string>& search_dirs, Glib::ArrayHandle<std::string>& full_path, KeyFileFlags flags = Glib::KEY_FILE_NONE), g_key_file_load_from_dirs, errthrow)
+#m4 _CONVERSION(`const std::vector<std::string>&', `const gchar**', `const_cast<const gchar**>(VectorHandler<std::string>::vector_to_array($3).data())')
+#m4 _CONVERSION(`std::vector<std::string>&', `gchar**', `const_cast<gchar**>(VectorHandler<std::string>::vector_to_array($3).data())')
+ _WRAP_METHOD(bool load_from_dirs(const std::string& file, const std::vector<std::string>& search_dirs, std::vector<std::string>& full_path, KeyFileFlags flags = Glib::KEY_FILE_NONE), g_key_file_load_from_dirs, errthrow)
/** Looks for a KeyFile named @a file in the paths returned from
* g_get_user_data_dir() and g_get_system_data_dirs() and loads them
@@ -161,7 +162,7 @@ public:
/** Gets a list of all groups in the KeyFile
* @returns A list containing the names of the groups
*/
- Glib::ArrayHandle<Glib::ustring> get_groups() const;
+ std::vector<Glib::ustring> get_groups() const;
_IGNORE(g_key_file_get_groups)
/** Gets a list of all keys from the group @a group_name.
@@ -169,7 +170,7 @@ public:
* @returns A list containing the names of the keys in @a group_name
* @throw Glib::KeyFileError
*/
- Glib::ArrayHandle<Glib::ustring> get_keys(const Glib::ustring& group_name) const;
+ std::vector<Glib::ustring> get_keys(const Glib::ustring& group_name) const;
_IGNORE(g_key_file_get_keys)
_WRAP_METHOD(bool has_group(const Glib::ustring& group_name) const, g_key_file_has_group)
@@ -265,7 +266,7 @@ public:
* @return A list containing the values requested
* @throw Glib::KeyFileError
*/
- Glib::ArrayHandle<Glib::ustring> get_string_list(const Glib::ustring& group_name, const Glib::ustring& key) const;
+ std::vector<Glib::ustring> get_string_list(const Glib::ustring& group_name, const Glib::ustring& key) const;
_IGNORE(g_key_file_get_string_list)
/** Returns the values associated with @a key under @a group_name
@@ -275,7 +276,7 @@ public:
* @return A list containing the values requested
* @throw Glib::KeyFileError
*/
- Glib::ArrayHandle<Glib::ustring> get_locale_string_list(const Glib::ustring& group_name, const Glib::ustring& key) const;
+ std::vector<Glib::ustring> get_locale_string_list(const Glib::ustring& group_name, const Glib::ustring& key) const;
/** Returns the values associated with @a key under @a group_name
* translated into @a locale, if available.
@@ -285,7 +286,7 @@ public:
* @return A list containing the values requested
* @throw Glib::KeyFileError
*/
- Glib::ArrayHandle<Glib::ustring> get_locale_string_list(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ustring& locale) const;
+ std::vector<Glib::ustring> get_locale_string_list(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ustring& locale) const;
_IGNORE(g_key_file_get_locale_string_list)
/** Returns the values associated with @a key under @a group_name
@@ -294,7 +295,7 @@ public:
* @return A list of booleans
* @throw Glib::KeyFileError
*/
- Glib::ArrayHandle<bool> get_boolean_list(const Glib::ustring& group_name, const Glib::ustring& key) const;
+ std::vector<bool> get_boolean_list(const Glib::ustring& group_name, const Glib::ustring& key) const;
_IGNORE(g_key_file_get_boolean_list)
/** Returns the values associated with @a key under @a group_name
@@ -303,7 +304,7 @@ public:
* @return A list of integers
* @throw Glib::KeyFileError
*/
- Glib::ArrayHandle<int> get_integer_list(const Glib::ustring& group_name, const Glib::ustring& key) const;
+ std::vector<int> get_integer_list(const Glib::ustring& group_name, const Glib::ustring& key) const;
_IGNORE(g_key_file_get_integer_list)
/** Returns the values associated with @a key under @a group_name
@@ -312,7 +313,7 @@ public:
* @return A list of doubles
* @throw Glib::KeyFileError
*/
- Glib::ArrayHandle<double> get_double_list(const Glib::ustring& group_name, const Glib::ustring& key) const;
+ std::vector<double> get_double_list(const Glib::ustring& group_name, const Glib::ustring& key) const;
_IGNORE(g_key_file_get_double_list)
/** Get comment from top of file
@@ -346,7 +347,7 @@ public:
* @param key The name of a key
* @param list A list holding objects of type Glib::ustring
*/
- void set_string_list(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ArrayHandle<Glib::ustring>& list);
+ void set_string_list(const Glib::ustring& group_name, const Glib::ustring& key, const std::vector<Glib::ustring>& list);
_IGNORE(g_key_file_set_string_list)
/** Sets a list of string values for the @a key under @a group_name and marks
@@ -357,7 +358,7 @@ public:
* @param locale A locale
* @param list A list holding objects of type Glib::ustring
*/
- void set_locale_string_list(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ustring& locale, const Glib::ArrayHandle<Glib::ustring>& list);
+ void set_locale_string_list(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ustring& locale, const std::vector<Glib::ustring>& list);
_IGNORE(g_key_file_set_locale_string_list)
/** Sets a list of booleans for the @a key under @a group_name.
@@ -366,7 +367,7 @@ public:
* @param key The name of a key
* @param list A list holding object of type bool
*/
- void set_boolean_list(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ArrayHandle<bool>& list);
+ void set_boolean_list(const Glib::ustring& group_name, const Glib::ustring& key, const std::vector<bool>& list);
_IGNORE(g_key_file_set_boolean_list)
/** Sets a list of integers for the @a key under @a group_name.
@@ -375,7 +376,7 @@ public:
* @param key The name of a key
* @param list A list holding object of type int
*/
- void set_integer_list(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ArrayHandle<int>& list);
+ void set_integer_list(const Glib::ustring& group_name, const Glib::ustring& key, const std::vector<int>& list);
_IGNORE(g_key_file_set_integer_list)
/** Sets a list of doubles for the @a key under @a group_name.
@@ -386,7 +387,7 @@ public:
*
* @newin{2,14}
*/
- void set_double_list(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ArrayHandle<double>& list);
+ void set_double_list(const Glib::ustring& group_name, const Glib::ustring& key, const std::vector<double>& list);
_IGNORE(g_key_file_set_double_list)
diff --git a/glib/src/optiongroup.ccg b/glib/src/optiongroup.ccg
index 04f5aed..876ec7c 100644
--- a/glib/src/optiongroup.ccg
+++ b/glib/src/optiongroup.ccg
@@ -22,6 +22,7 @@
#include <glibmm/optioncontext.h>
#include <glibmm/utility.h>
#include <glibmm/exceptionhandler.h>
+#include <glibmm/vectorutils.h>
//#include <glibmm/containers.h>
#include <glib.h> // g_malloc
@@ -505,15 +506,18 @@ void OptionGroup::CppOptionEntry::convert_c_to_cpp()
{
typed_cpp_arg->clear();
+ // TODO: ask someone to test if this compiles on SUN Forte and Tru64 compilers.
+ (*typed_cpp_arg) = Glib::VectorHandler<Glib::ustring>::array_to_vector(*typed_arg, Glib::OWNERSHIP_NONE);
+
//The C array seems to be null-terminated.
- //Glib::StringArrayHandle array_handle(*typed_arg, Glib::OWNERSHIP_NONE);
+ //std::vector<Glib::ustring> vec(*typed_arg, Glib::OWNERSHIP_NONE);
//The SUN Forte compiler complains about this:
// "optiongroup.cc", line 354: Error: Cannot assign Glib::ArrayHandle<Glib::ustring,
// Glib::Container_Helpers::TypeTraits<Glib::ustring>> to std::vector<Glib::ustring> without
// "std::vector<Glib::ustring>::operator=(const std::vector<Glib::ustring>&)";.
//
- //(*typed_cpp_arg) = array_handle;
+ //(*typed_cpp_arg) = vec;
//
//And the Tru64 compiler does not even like us to instantiate the StringArrayHandle:
//
@@ -521,19 +525,19 @@ void OptionGroup::CppOptionEntry::convert_c_to_cpp()
// of a pointer dynamic_cast must be a pointer to a complete class type
// return dynamic_cast<CppType>(Glib::wrap_auto(cobj, false /* take_copy */));
- //for(Glib::StringArrayHandle::iterator iter = array_handle.begin(); iter != array_handle.end(); ++iter)
+ //for(std::vector<Glib::ustring>::iterator iter (vec.begin()), vend (vec.end()); iter != vend; ++iter)
//{
// typed_cpp_arg->push_back(*iter);
//}
//So we do this:
- char** char_array_next = *typed_arg;
- while(char_array_next && *char_array_next)
- {
- typed_cpp_arg->push_back(*char_array_next);
- ++char_array_next;
- }
+ //char** char_array_next = *typed_arg;
+ //while(char_array_next && *char_array_next)
+ //{
+ // typed_cpp_arg->push_back(*char_array_next);
+ // ++char_array_next;
+ //}
}
break;
diff --git a/glib/src/regex.ccg b/glib/src/regex.ccg
index af91d4a..964ae80 100644
--- a/glib/src/regex.ccg
+++ b/glib/src/regex.ccg
@@ -16,6 +16,7 @@
*/
#include <glibmm/utility.h>
+#include <glibmm/vectorutils.h>
namespace Glib
{
@@ -225,10 +226,10 @@ Glib::ustring Regex::replace_literal(const Glib::ustring& string, int start_posi
return retvalue;
}
-Glib::StringArrayHandle Regex::split(const Glib::ustring& string, int start_position, RegexMatchFlags match_options, int max_tokens) const
+std::vector<Glib::ustring> Regex::split(const Glib::ustring& string, int start_position, RegexMatchFlags match_options, int max_tokens) const
{
GError* gerror = 0;
- Glib::StringArrayHandle retvalue = Glib::StringArrayHandle(g_regex_split_full(const_cast<GRegex*>(gobj()), string.c_str(), -1, start_position, ((GRegexMatchFlags)(match_options)), max_tokens, &(gerror)), Glib::OWNERSHIP_DEEP);
+ std::vector<Glib::ustring> retvalue = Glib::VectorHandler<Glib::ustring>::array_to_vector(g_regex_split_full(const_cast<GRegex*>(gobj()), string.c_str(), -1, start_position, ((GRegexMatchFlags)(match_options)), max_tokens, &(gerror)), Glib::OWNERSHIP_DEEP);
if(gerror)
::Glib::Error::throw_exception(gerror);
diff --git a/glib/src/regex.hg b/glib/src/regex.hg
index 1ce730b..8bff63c 100644
--- a/glib/src/regex.hg
+++ b/glib/src/regex.hg
@@ -17,11 +17,12 @@
_DEFS(glibmm,glib)
+#include <vector>
+
#include <glibmmconfig.h>
#include <glibmm/refptr.h>
#include <glibmm/ustring.h>
#include <glibmm/error.h>
-#include <glibmm/arrayhandle.h>
#include <glib.h>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -185,14 +186,14 @@ public:
*/
bool match_all(const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options);
-#m4 _CONVERSION(`gchar**',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)')
+#m4 _CONVERSION(`gchar**',`std::vector<Glib::ustring>',`Glib::VectorHandler<Glib::ustring>::array_to_vector ($3, Glib::OWNERSHIP_DEEP)')
- _WRAP_METHOD(static Glib::StringArrayHandle split_simple(const Glib::ustring& pattern, const Glib::ustring& string, RegexCompileFlags compile_options = static_cast<RegexCompileFlags>(0), RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0)), g_regex_split_simple)
- _WRAP_METHOD(Glib::StringArrayHandle split(const Glib::ustring& string, RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0)), g_regex_split)
+ _WRAP_METHOD(static std::vector<Glib::ustring> split_simple(const Glib::ustring& pattern, const Glib::ustring& string, RegexCompileFlags compile_options = static_cast<RegexCompileFlags>(0), RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0)), g_regex_split_simple)
+ _WRAP_METHOD(std::vector<Glib::ustring> split(const Glib::ustring& string, RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0)), g_regex_split)
- _WRAP_METHOD(Glib::StringArrayHandle split(const gchar* string, gssize string_len, int start_position, RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0), int max_tokens = 0) const, g_regex_split_full, errthrow)
+ _WRAP_METHOD(std::vector<Glib::ustring> split(const gchar* string, gssize string_len, int start_position, RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0), int max_tokens = 0) const, g_regex_split_full, errthrow)
- Glib::StringArrayHandle split(const Glib::ustring& string, int start_position, RegexMatchFlags match_options, int max_tokens) const;
+ std::vector<Glib::ustring> split(const Glib::ustring& string, int start_position, RegexMatchFlags match_options, int max_tokens) const;
_WRAP_METHOD(Glib::ustring replace(const gchar* string, gssize string_len, int start_position, const Glib::ustring& replacement, RegexMatchFlags match_options = static_cast<RegexMatchFlags>(0)), g_regex_replace, errthrow)
Glib::ustring replace(const Glib::ustring& string, int start_position, const Glib::ustring& replacement, RegexMatchFlags match_options);
@@ -265,7 +266,7 @@ public:
_WRAP_METHOD(bool fetch_named_pos(const Glib::ustring& name, int& start_pos, int& end_pos), g_match_info_fetch_named_pos)
- _WRAP_METHOD(Glib::StringArrayHandle fetch_all(), g_match_info_fetch_all)
+ _WRAP_METHOD(std::vector<Glib::ustring> fetch_all(), g_match_info_fetch_all)
protected:
GMatchInfo* gobject_; // The C object.
diff --git a/glib/src/shell.ccg b/glib/src/shell.ccg
index 4e2d51f..213ee5f 100644
--- a/glib/src/shell.ccg
+++ b/glib/src/shell.ccg
@@ -19,14 +19,14 @@
*/
#include <glibmm/utility.h>
-
+#include <glibmm/vectorutils.h>
namespace Glib
{
/**** shell utility functions **********************************************/
-Glib::ArrayHandle<std::string> shell_parse_argv(const std::string& command_line)
+std::vector<std::string> shell_parse_argv(const std::string& command_line)
{
char** argv = 0;
int argc = 0;
@@ -37,7 +37,7 @@ Glib::ArrayHandle<std::string> shell_parse_argv(const std::string& command_line)
if(error)
Glib::Error::throw_exception(error);
- return Glib::ArrayHandle<std::string>(argv, argc, Glib::OWNERSHIP_DEEP);
+ return Glib::VectorHandler<std::string>::array_to_vector(argv, argc, Glib::OWNERSHIP_DEEP);
}
std::string shell_quote(const std::string& unquoted_string)
diff --git a/glib/src/shell.hg b/glib/src/shell.hg
index 232159d..dadef12 100644
--- a/glib/src/shell.hg
+++ b/glib/src/shell.hg
@@ -19,7 +19,8 @@
_DEFS(glibmm,glib)
-#include <glibmm/arrayhandle.h>
+#include <vector>
+
#include <glibmm/error.h>
#include <glib.h>
#include <string>
@@ -45,11 +46,10 @@ _WRAP_GERROR(ShellError, GShellError, G_SHELL_ERROR, NO_GTYPE)
* unsupported shell expansions. If the input does contain such expansions,
* they are passed through literally.
* @param command_line Command line to parse.
- * @return Array of args (The generic ArrayHandle will be implicitly
- * converted to any STL compatible container type).
+ * @return Vector of args.
* @throw Glib::ShellError
*/
-Glib::ArrayHandle<std::string> shell_parse_argv(const std::string& command_line);
+std::vector<std::string> shell_parse_argv(const std::string& command_line);
/** Quotes a string so that the shell (/bin/sh) will interpret the quoted
* string to mean @a unquoted_string. If you pass a filename to the shell,
diff --git a/glib/src/spawn.ccg b/glib/src/spawn.ccg
index b526c39..cad17ed 100644
--- a/glib/src/spawn.ccg
+++ b/glib/src/spawn.ccg
@@ -21,6 +21,7 @@
#include <glib.h>
#include <glibmm/exceptionhandler.h>
#include <glibmm/utility.h>
+#include <glibmm/vectorutils.h>
namespace
@@ -67,8 +68,8 @@ namespace Glib
/**** process spawning functions *******************************************/
void spawn_async_with_pipes(const std::string& working_directory,
- const Glib::ArrayHandle<std::string>& argv,
- const Glib::ArrayHandle<std::string>& envp,
+ const std::vector<std::string>& argv,
+ const std::vector<std::string>& envp,
SpawnFlags flags,
const sigc::slot<void>& child_setup,
Pid* child_pid,
@@ -82,8 +83,8 @@ void spawn_async_with_pipes(const std::string& working_directory,
g_spawn_async_with_pipes(
(working_directory.empty()) ? 0 : working_directory.c_str(),
- const_cast<char**>(argv.data()),
- const_cast<char**>(envp.data()),
+ const_cast<char**>(Glib::VectorHandler<std::string>::vector_to_array (argv).data()),
+ const_cast<char**>(Glib::VectorHandler<std::string>::vector_to_array (envp).data()),
static_cast<GSpawnFlags>(unsigned(flags)),
(setup_slot) ? &child_setup_callback : 0,
(setup_slot) ? &child_setup_ : 0,
@@ -96,7 +97,7 @@ void spawn_async_with_pipes(const std::string& working_directory,
}
void spawn_async_with_pipes(const std::string& working_directory,
- const Glib::ArrayHandle<std::string>& argv,
+ const std::vector<std::string>& argv,
SpawnFlags flags,
const sigc::slot<void>& child_setup,
Pid* child_pid,
@@ -110,7 +111,7 @@ void spawn_async_with_pipes(const std::string& working_directory,
g_spawn_async_with_pipes(
(working_directory.empty()) ? 0 : working_directory.c_str(),
- const_cast<char**>(argv.data()), 0,
+ const_cast<char**>(Glib::VectorHandler<std::string>::vector_to_array (argv).data()), 0,
static_cast<GSpawnFlags>(unsigned(flags)),
(setup_slot) ? &child_setup_callback : 0,
(setup_slot) ? &child_setup_ : 0,
@@ -123,8 +124,8 @@ void spawn_async_with_pipes(const std::string& working_directory,
}
void spawn_async(const std::string& working_directory,
- const Glib::ArrayHandle<std::string>& argv,
- const Glib::ArrayHandle<std::string>& envp,
+ const std::vector<std::string>& argv,
+ const std::vector<std::string>& envp,
SpawnFlags flags,
const sigc::slot<void>& child_setup,
Pid* child_pid)
@@ -135,8 +136,8 @@ void spawn_async(const std::string& working_directory,
g_spawn_async(
(working_directory.empty()) ? 0 : working_directory.c_str(),
- const_cast<char**>(argv.data()),
- const_cast<char**>(envp.data()),
+ const_cast<char**>(Glib::VectorHandler<std::string>::vector_to_array (argv).data()),
+ const_cast<char**>(Glib::VectorHandler<std::string>::vector_to_array (envp).data()),
static_cast<GSpawnFlags>(unsigned(flags)),
(setup_slot) ? &child_setup_callback : 0,
(setup_slot) ? &child_setup_ : 0,
@@ -148,7 +149,7 @@ void spawn_async(const std::string& working_directory,
}
void spawn_async(const std::string& working_directory,
- const Glib::ArrayHandle<std::string>& argv,
+ const std::vector<std::string>& argv,
SpawnFlags flags,
const sigc::slot<void>& child_setup,
Pid* child_pid)
@@ -159,7 +160,7 @@ void spawn_async(const std::string& working_directory,
g_spawn_async(
(working_directory.empty()) ? 0 : working_directory.c_str(),
- const_cast<char**>(argv.data()), 0,
+ const_cast<char**>(Glib::VectorHandler<std::string>::vector_to_array (argv).data()), 0,
static_cast<GSpawnFlags>(unsigned(flags)),
(setup_slot) ? &child_setup_callback : 0,
(setup_slot) ? &child_setup_ : 0,
@@ -171,8 +172,8 @@ void spawn_async(const std::string& working_directory,
}
void spawn_sync(const std::string& working_directory,
- const Glib::ArrayHandle<std::string>& argv,
- const Glib::ArrayHandle<std::string>& envp,
+ const std::vector<std::string>& argv,
+ const std::vector<std::string>& envp,
SpawnFlags flags,
const sigc::slot<void>& child_setup,
std::string* standard_output,
@@ -188,8 +189,8 @@ void spawn_sync(const std::string& working_directory,
g_spawn_sync(
(working_directory.empty()) ? 0 : working_directory.c_str(),
- const_cast<char**>(argv.data()),
- const_cast<char**>(envp.data()),
+ const_cast<char**>(Glib::VectorHandler<std::string>::vector_to_array (argv).data()),
+ const_cast<char**>(Glib::VectorHandler<std::string>::vector_to_array (envp).data()),
static_cast<GSpawnFlags>(unsigned(flags)),
(setup_slot) ? &child_setup_callback : 0,
(setup_slot) ? &child_setup_ : 0,
@@ -206,7 +207,7 @@ void spawn_sync(const std::string& working_directory,
}
void spawn_sync(const std::string& working_directory,
- const Glib::ArrayHandle<std::string>& argv,
+ const std::vector<std::string>& argv,
SpawnFlags flags,
const sigc::slot<void>& child_setup,
std::string* standard_output,
@@ -222,7 +223,7 @@ void spawn_sync(const std::string& working_directory,
g_spawn_sync(
(working_directory.empty()) ? 0 : working_directory.c_str(),
- const_cast<char**>(argv.data()), 0,
+ const_cast<char**>(Glib::VectorHandler<std::string>::vector_to_array (argv).data()), 0,
static_cast<GSpawnFlags>(unsigned(flags)),
(setup_slot) ? &child_setup_callback : 0,
(setup_slot) ? &child_setup_ : 0,
diff --git a/glib/src/spawn.hg b/glib/src/spawn.hg
index 4fadb00..2379e45 100644
--- a/glib/src/spawn.hg
+++ b/glib/src/spawn.hg
@@ -19,8 +19,9 @@
_DEFS(glibmm,glib)
+#include <vector>
+
#include <glibmmconfig.h>
-#include <glibmm/arrayhandle.h>
#include <glibmm/error.h>
#include <sigc++/sigc++.h>
#include <string>
@@ -190,8 +191,8 @@ _WRAP_GERROR(SpawnError, GSpawnError, G_SPAWN_ERROR, NO_GTYPE, s#^2BIG$#TOOBIG#)
* and @a standard_error will not be filled with valid values.
*/
void spawn_async_with_pipes(const std::string& working_directory,
- const Glib::ArrayHandle<std::string>& argv,
- const Glib::ArrayHandle<std::string>& envp,
+ const std::vector<std::string>& argv,
+ const std::vector<std::string>& envp,
SpawnFlags flags = SpawnFlags(0),
const sigc::slot<void>& child_setup = sigc::slot<void>(),
Pid* child_pid = 0,
@@ -217,7 +218,7 @@ void spawn_async_with_pipes(const std::string& working_directory,
* and @a standard_error will not be filled with valid values.
*/
void spawn_async_with_pipes(const std::string& working_directory,
- const Glib::ArrayHandle<std::string>& argv,
+ const std::vector<std::string>& argv,
SpawnFlags flags = SpawnFlags(0),
const sigc::slot<void>& child_setup = sigc::slot<void>(),
Pid* child_pid = 0,
@@ -247,8 +248,8 @@ void spawn_async_with_pipes(const std::string& working_directory,
* to users.
*/
void spawn_async(const std::string& working_directory,
- const Glib::ArrayHandle<std::string>& argv,
- const Glib::ArrayHandle<std::string>& envp,
+ const std::vector<std::string>& argv,
+ const std::vector<std::string>& envp,
SpawnFlags flags = SpawnFlags(0),
const sigc::slot<void>& child_setup = sigc::slot<void>(),
Pid* child_pid = 0);
@@ -268,7 +269,7 @@ void spawn_async(const std::string& working_directory,
* to users.
*/
void spawn_async(const std::string& working_directory,
- const Glib::ArrayHandle<std::string>& argv,
+ const std::vector<std::string>& argv,
SpawnFlags flags = SpawnFlags(0),
const sigc::slot<void>& child_setup = sigc::slot<void>(),
Pid* child_pid = 0);
@@ -306,8 +307,8 @@ void spawn_async(const std::string& working_directory,
* and @a standard_error will not be filled with valid values.
*/
void spawn_sync(const std::string& working_directory,
- const Glib::ArrayHandle<std::string>& argv,
- const Glib::ArrayHandle<std::string>& envp,
+ const std::vector<std::string>& argv,
+ const std::vector<std::string>& envp,
SpawnFlags flags = SpawnFlags(0),
const sigc::slot<void>& child_setup = sigc::slot<void>(),
std::string* standard_output = 0,
@@ -331,7 +332,7 @@ void spawn_sync(const std::string& working_directory,
* and @a standard_error will not be filled with valid values.
*/
void spawn_sync(const std::string& working_directory,
- const Glib::ArrayHandle<std::string>& argv,
+ const std::vector<std::string>& argv,
SpawnFlags flags = SpawnFlags(0),
const sigc::slot<void>& child_setup = sigc::slot<void>(),
std::string* standard_output = 0,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]