glibmm r741 - in trunk: . glib/glibmm tests/glibmm_ustring_compose



Author: murrayc
Date: Mon Oct 20 14:36:25 2008
New Revision: 741
URL: http://svn.gnome.org/viewvc/glibmm?rev=741&view=rev

Log:
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)

Modified:
   trunk/ChangeLog
   trunk/glib/glibmm/ustring.h
   trunk/tests/glibmm_ustring_compose/main.cc

Modified: trunk/glib/glibmm/ustring.h
==============================================================================
--- trunk/glib/glibmm/ustring.h	(original)
+++ trunk/glib/glibmm/ustring.h	Mon Oct 20 14:36:25 2008
@@ -1272,7 +1272,7 @@
 class ustring::Stringify<const char*>
 {
 private:
-  const ustring& string_;
+  const ustring string_;
 
   // noncopyable
   Stringify(const ustring::Stringify<const char*>&);
@@ -1283,26 +1283,23 @@
   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

Modified: trunk/tests/glibmm_ustring_compose/main.cc
==============================================================================
--- trunk/tests/glibmm_ustring_compose/main.cc	(original)
+++ trunk/tests/glibmm_ustring_compose/main.cc	Mon Oct 20 14:36:25 2008
@@ -8,7 +8,7 @@
 
   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;
 



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