[opengtl-commits] [370] add a function to convert a double to a string

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 370
Author:   cyrille
Date:     2008-09-07 09:37:50 +0200 (Sun, 07 Sep 2008)

Log Message:
-----------
add a function to convert a double to a string

Modified Paths:
--------------
    trunk/OpenGTL/OpenGTL/GTLCore/String.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/String.h


Modified: trunk/OpenGTL/OpenGTL/GTLCore/String.cpp
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/String.cpp	2008-09-03 23:34:05 UTC (rev 369)
+++ trunk/OpenGTL/OpenGTL/GTLCore/String.cpp	2008-09-07 07:37:50 UTC (rev 370)
@@ -89,6 +89,16 @@
   return str;
 }
 
+String String::number(double f)
+{
+  std::stringstream ss;
+  String str;
+  ss << f;
+  ss >> str;
+  return str;
+}
+
+
 int String::toInt() const
 {
   return atoi( c_str() );

Modified: trunk/OpenGTL/OpenGTL/GTLCore/String.h
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/String.h	2008-09-03 23:34:05 UTC (rev 369)
+++ trunk/OpenGTL/OpenGTL/GTLCore/String.h	2008-09-07 07:37:50 UTC (rev 370)
@@ -122,6 +122,10 @@
        * @return a \ref String containing the number
        */
       static String number(float );
+      /**
+       * @return a \ref String containing the number
+       */
+      static String number(double );
   };
   
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/