[WTF] Turn tryMakeString(), makeString() into variadic templates
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Aug 2015 06:27:12 +0000 (06:27 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Aug 2015 06:27:12 +0000 (06:27 +0000)
commit3a5e742ee12764c4d94ae1c8b9ed09ac668f6a64
tree297f904559e744cf42d743b628811d4e1a71def3
parent9639779e6c8b35159d9979e065263830238a0878
[WTF] Turn tryMakeString(), makeString() into variadic templates
https://bugs.webkit.org/show_bug.cgi?id=147142

Reviewed by Sam Weinig.

Built upon the original work by Anders Carlsson, Mark Rowe and Sam Weinig.

Implement tryMakeString() and makeString() as variadic templates, replacing
the argument count-based overloads.

tryMakeString() now constructs a stack-based tuple of necessary StringTypeAdapter
objects and utilizes the StringAdapterTuple struct template to operate on that
tuple, recursively calling the necessary operations on each element in the tuple.
This effectively mimics the process of previous tryMakeString() implementation,
but makes it scalable to a tuple of elements that are to be concatenated.

StringAppend class template now stores two StringTypeAdapter objects for the
two passed-in string objects, packed in a tuple, calling
StringAdapterTuple<>::createString() directly when concatenating the two objects
into one String.

* wtf/text/StringConcatenate.h:
(WTF::StringTypeAdapter<char>::length):
(WTF::StringTypeAdapter<char>::is8Bit):
(WTF::StringAdapterTuple::sumWithOverflow):
(WTF::StringAdapterTuple::is8Bit):
(WTF::StringAdapterTuple::writeTo):
(WTF::StringAdapterTuple::createString):
(WTF::tryMakeString):
(WTF::makeString):
(WTF::sumWithOverflow): Deleted.
* wtf/text/StringOperators.h:
(WTF::StringAppend::StringAppend):
(WTF::StringAppend::operator String):
(WTF::StringAppend::is8Bit):
(WTF::StringAppend::writeTo):
(WTF::StringAppend::length):
(WTF::StringAppend::string1):
(WTF::StringAppend::string2):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@187815 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/wtf/text/StringConcatenate.h
Source/WTF/wtf/text/StringOperators.h