summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Burgmeier <armin@openismus.com>2008-10-20 14:36:25 +0000
committerMurray Cumming <murrayc@src.gnome.org>2008-10-20 14:36:25 +0000
commitf82859407c13113e9cb6f544126994810f7cdc72 (patch)
tree84c724c3449716bba022150904e28065d54399a2
parent8336fd07c644f9ebf026040ebbffe7f283134803 (diff)
downloadglibmm-f82859407c13113e9cb6f544126994810f7cdc72.tar.gz
Fixed the const char* specialization for Stringify<> by making the string_
2008-10-16 Armin Burgmeier <armin@openismus.com> * glib/glibmm/ustring.h: Fixed the const char* specialization for Stringify<> by making the string_ member a const Glib::ustring instead of a const Glib::ustring&. Also enabled the char[N] specialization for string literals. * tests/glibmm_ustring_compose/main.cc: Enabled the test for the specialization for string literals. Bug #506410 (Szilárd Pfeiffer) svn path=/trunk/; revision=741
-rw-r--r--ChangeLog11
-rw-r--r--glib/glibmm/ustring.h17
-rw-r--r--tests/glibmm_ustring_compose/main.cc2
3 files changed, 19 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 63a77f15..d3814d1f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-10-16 Armin Burgmeier <armin@openismus.com>
+
+ * glib/glibmm/ustring.h: Fixed the const char* specialization for
+ Stringify<> by making the string_ member a const Glib::ustring instead
+ of a const Glib::ustring&. Also enabled the char[N] specialization for
+ string literals.
+
+ * tests/glibmm_ustring_compose/main.cc: Enabled the test for the
+ specialization for string literals.
+ Bug #506410 (Szilárd Pfeiffer)
+
2008-10-15 José Alburquerque <jaalburqu@svn.gnome.org>
* tools/extra_defs_gen/generate_extra_defs.cc: Modify signal and props
diff --git a/glib/glibmm/ustring.h b/glib/glibmm/ustring.h
index e35dc70f..cb20655a 100644
--- a/glib/glibmm/ustring.h
+++ b/glib/glibmm/ustring.h
@@ -1272,7 +1272,7 @@ template <>
class ustring::Stringify<const char*>
{
private:
- const ustring& string_;
+ const ustring string_;
// noncopyable
Stringify(const ustring::Stringify<const char*>&);
@@ -1283,26 +1283,23 @@ public:
inline const ustring* ptr() const { return &string_; }
};
-/* TODO: I can't seem to specify a template specialization for Stringify with a string literal. murrayc.
-
- * A template specialization for Stringify<char[N]> (for string literals),
+/** A template specialization for Stringify<char[N]> (for string literals),
* because the regular template has ambiguous constructor overloads for char*.
-
+ */
template <std::size_t N>
-class ustring::Stringify<const char[N]>
+class ustring::Stringify<char[N]>
{
private:
- const ustring& string_;
+ const ustring string_;
// noncopyable
- Stringify(const ustring::Stringify<const char[N]>&);
- Stringify<ustring>& operator=(const ustring::Stringify<const char[N]>&);
+ Stringify(const ustring::Stringify<char[N]>&);
+ Stringify<ustring>& operator=(const ustring::Stringify<char[N]>&);
public:
explicit inline Stringify(const char arg[N]) : string_(arg) {}
inline const ustring* ptr() const { return &string_; }
};
-*/
template <class T1>
inline // static
diff --git a/tests/glibmm_ustring_compose/main.cc b/tests/glibmm_ustring_compose/main.cc
index 5902b405..0fbc9b7d 100644
--- a/tests/glibmm_ustring_compose/main.cc
+++ b/tests/glibmm_ustring_compose/main.cc
@@ -8,7 +8,7 @@ int main(int, char**)
const char *constant_string = "constant string";
std::cout << Glib::ustring::compose("Compose strings: %1", constant_string) << std::endl;
- //TODO: Make this work. See ustring.h: std::cout << Glib::ustring::compose("Compose strings: %1 and %2", constant_string, "string_literal") << std::endl;
+ std::cout << Glib::ustring::compose("Compose strings: %1 and %2", constant_string, "string_literal") << std::endl;
std::cout << Glib::ustring::compose("Compose strings: %1 and %2", 123, 123.4567) << std::endl;