Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(840)

Unified Diff: Source/wtf/text/AtomicString.cpp

Issue 84713002: Add number() static methods to AtomicString class (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Pass NaN as default argument Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/wtf/text/AtomicString.h ('k') | Source/wtf/text/AtomicStringTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/text/AtomicString.cpp
diff --git a/Source/wtf/text/AtomicString.cpp b/Source/wtf/text/AtomicString.cpp
index c753e3686d165b08e45f666982ad537ef9c5afb8..1a2f1e2b06b3ead89270860432bdfea8e4035148 100644
--- a/Source/wtf/text/AtomicString.cpp
+++ b/Source/wtf/text/AtomicString.cpp
@@ -26,6 +26,8 @@
#include "StringHash.h"
#include "wtf/HashSet.h"
#include "wtf/WTFThreadData.h"
+#include "wtf/dtoa.h"
+#include "wtf/text/IntegerToStringConversion.h"
#include "wtf/unicode/UTF8.h"
namespace WTF {
@@ -487,6 +489,42 @@ AtomicString AtomicString::fromUTF8Internal(const char* charactersStart, const c
return atomicString;
}
+AtomicString AtomicString::number(int number)
+{
+ return numberToStringSigned<AtomicString>(number);
+}
+
+AtomicString AtomicString::number(unsigned number)
+{
+ return numberToStringUnsigned<AtomicString>(number);
+}
+
+AtomicString AtomicString::number(long number)
+{
+ return numberToStringSigned<AtomicString>(number);
+}
+
+AtomicString AtomicString::number(unsigned long number)
+{
+ return numberToStringUnsigned<AtomicString>(number);
+}
+
+AtomicString AtomicString::number(long long number)
+{
+ return numberToStringSigned<AtomicString>(number);
+}
+
+AtomicString AtomicString::number(unsigned long long number)
+{
+ return numberToStringUnsigned<AtomicString>(number);
+}
+
+AtomicString AtomicString::number(double number, unsigned precision, TrailingZerosTruncatingPolicy trailingZerosTruncatingPolicy)
+{
+ NumberToStringBuffer buffer;
+ return AtomicString(numberToFixedPrecisionString(number, precision, buffer, trailingZerosTruncatingPolicy == TruncateTrailingZeros));
+}
+
#ifndef NDEBUG
void AtomicString::show() const
{
« no previous file with comments | « Source/wtf/text/AtomicString.h ('k') | Source/wtf/text/AtomicStringTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698