diff options
author | Murray Cumming <murrayc@murrayc.com> | 2005-01-18 15:03:26 +0000 |
---|---|---|
committer | Murray Cumming <murrayc@src.gnome.org> | 2005-01-18 15:03:26 +0000 |
commit | c190e5dd9871efa86ba0b0c88697ede57477a884 (patch) | |
tree | 1ce56a0b8d28654099521f0d0d66e92c2d2bf3c0 /glib/src/optiongroup.ccg | |
parent | 1c1c0be2773d40fbb2cb0ed4504b3c8823f5bf39 (diff) | |
download | glibmm-c190e5dd9871efa86ba0b0c88697ede57477a884.tar.gz |
CppOptionEntry::convert_c_to_cpp(): Copy the strings to the vector in a
2005-01-18 Murray Cumming <murrayc@murrayc.com>
* glibmm/src/optiongrup.[hg|ccg]: CppOptionEntry::convert_c_to_cpp():
Copy the strings to the vector in a loop, instead of using the
ArrayHandle constructor, because that does not seem to work with the
SUN Forte compiler.
Diffstat (limited to 'glib/src/optiongroup.ccg')
-rw-r--r-- | glib/src/optiongroup.ccg | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/glib/src/optiongroup.ccg b/glib/src/optiongroup.ccg index 0a4e3e5c..db26b8e4 100644 --- a/glib/src/optiongroup.ccg +++ b/glib/src/optiongroup.ccg @@ -338,7 +338,7 @@ void OptionGroup::CppOptionEntry::convert_c_to_cpp() *((int*)cpparg_) = *((int*)carg_); break; } - case G_OPTION_ARG_STRING_ARRAY: + case G_OPTION_ARG_STRING_ARRAY: { char*** typed_arg = (char***)carg_; vecustrings* typed_cpp_arg = (vecustrings*)cpparg_; @@ -346,7 +346,20 @@ void OptionGroup::CppOptionEntry::convert_c_to_cpp() { //The C array seems to be null-terminated. Glib::StringArrayHandle array_handle(*typed_arg, Glib::OWNERSHIP_NONE); - (*typed_cpp_arg) = array_handle; + + //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; + + //So we do this: + typed_cpp_arg->clear(); + for(Glib::StringArrayHandle::iterator iter = array_handle.begin(); iter != array_handle.end(); ++iter) + { + typed_cpp_arg->push_back(*iter); + } } break; @@ -359,7 +372,16 @@ void OptionGroup::CppOptionEntry::convert_c_to_cpp() { //The C array seems to be null-terminated. Glib::ArrayHandle<std::string> array_handle(*typed_arg, Glib::OWNERSHIP_NONE); - (*typed_cpp_arg) = array_handle; + + //The SUN Forte compiler complains about this: + //(*typed_cpp_arg) = array_handle; + + //So we do this: + typed_cpp_arg->clear(); + for(Glib::ArrayHandle<std::string>::iterator iter = array_handle.begin(); iter != array_handle.end(); ++iter) + { + typed_cpp_arg->push_back(*iter); + } } break; |