| Index: third_party/WebKit/Source/wtf/text/StringOperators.h
|
| diff --git a/third_party/WebKit/Source/wtf/text/StringOperators.h b/third_party/WebKit/Source/wtf/text/StringOperators.h
|
| index 9100cdaad788a75289554b3585206854c3a3b70e..b4a9b7d96e5149d419017a144478c6c6e3724363 100644
|
| --- a/third_party/WebKit/Source/wtf/text/StringOperators.h
|
| +++ b/third_party/WebKit/Source/wtf/text/StringOperators.h
|
| @@ -27,147 +27,143 @@
|
|
|
| namespace WTF {
|
|
|
| -template<typename StringType1, typename StringType2>
|
| +template <typename StringType1, typename StringType2>
|
| class StringAppend final {
|
| - STACK_ALLOCATED();
|
| -public:
|
| - StringAppend(StringType1 string1, StringType2 string2);
|
| + STACK_ALLOCATED();
|
|
|
| - operator String() const;
|
| + public:
|
| + StringAppend(StringType1 string1, StringType2 string2);
|
|
|
| - operator AtomicString() const;
|
| + operator String() const;
|
|
|
| - bool is8Bit();
|
| + operator AtomicString() const;
|
|
|
| - void writeTo(LChar* destination);
|
| + bool is8Bit();
|
|
|
| - void writeTo(UChar* destination);
|
| + void writeTo(LChar* destination);
|
|
|
| - unsigned length();
|
| + void writeTo(UChar* destination);
|
|
|
| -private:
|
| - StringType1 m_string1;
|
| - StringType2 m_string2;
|
| + unsigned length();
|
| +
|
| + private:
|
| + StringType1 m_string1;
|
| + StringType2 m_string2;
|
| };
|
|
|
| -template<typename StringType1, typename StringType2>
|
| -StringAppend<StringType1, StringType2>::StringAppend(StringType1 string1, StringType2 string2)
|
| - : m_string1(string1)
|
| - , m_string2(string2)
|
| -{
|
| -}
|
| +template <typename StringType1, typename StringType2>
|
| +StringAppend<StringType1, StringType2>::StringAppend(StringType1 string1,
|
| + StringType2 string2)
|
| + : m_string1(string1), m_string2(string2) {}
|
|
|
| -template<typename StringType1, typename StringType2>
|
| -StringAppend<StringType1, StringType2>::operator String() const
|
| -{
|
| - return String(makeString(m_string1, m_string2));
|
| +template <typename StringType1, typename StringType2>
|
| +StringAppend<StringType1, StringType2>::operator String() const {
|
| + return String(makeString(m_string1, m_string2));
|
| }
|
|
|
| -template<typename StringType1, typename StringType2>
|
| -StringAppend<StringType1, StringType2>::operator AtomicString() const
|
| -{
|
| - return AtomicString(makeString(m_string1, m_string2));
|
| +template <typename StringType1, typename StringType2>
|
| +StringAppend<StringType1, StringType2>::operator AtomicString() const {
|
| + return AtomicString(makeString(m_string1, m_string2));
|
| }
|
|
|
| -template<typename StringType1, typename StringType2>
|
| -bool StringAppend<StringType1, StringType2>::is8Bit()
|
| -{
|
| - StringTypeAdapter<StringType1> adapter1(m_string1);
|
| - StringTypeAdapter<StringType2> adapter2(m_string2);
|
| - return adapter1.is8Bit() && adapter2.is8Bit();
|
| +template <typename StringType1, typename StringType2>
|
| +bool StringAppend<StringType1, StringType2>::is8Bit() {
|
| + StringTypeAdapter<StringType1> adapter1(m_string1);
|
| + StringTypeAdapter<StringType2> adapter2(m_string2);
|
| + return adapter1.is8Bit() && adapter2.is8Bit();
|
| }
|
|
|
| -template<typename StringType1, typename StringType2>
|
| -void StringAppend<StringType1, StringType2>::writeTo(LChar* destination)
|
| -{
|
| - ASSERT(is8Bit());
|
| - StringTypeAdapter<StringType1> adapter1(m_string1);
|
| - StringTypeAdapter<StringType2> adapter2(m_string2);
|
| - adapter1.writeTo(destination);
|
| - adapter2.writeTo(destination + adapter1.length());
|
| +template <typename StringType1, typename StringType2>
|
| +void StringAppend<StringType1, StringType2>::writeTo(LChar* destination) {
|
| + ASSERT(is8Bit());
|
| + StringTypeAdapter<StringType1> adapter1(m_string1);
|
| + StringTypeAdapter<StringType2> adapter2(m_string2);
|
| + adapter1.writeTo(destination);
|
| + adapter2.writeTo(destination + adapter1.length());
|
| }
|
|
|
| -template<typename StringType1, typename StringType2>
|
| -void StringAppend<StringType1, StringType2>::writeTo(UChar* destination)
|
| -{
|
| - StringTypeAdapter<StringType1> adapter1(m_string1);
|
| - StringTypeAdapter<StringType2> adapter2(m_string2);
|
| - adapter1.writeTo(destination);
|
| - adapter2.writeTo(destination + adapter1.length());
|
| +template <typename StringType1, typename StringType2>
|
| +void StringAppend<StringType1, StringType2>::writeTo(UChar* destination) {
|
| + StringTypeAdapter<StringType1> adapter1(m_string1);
|
| + StringTypeAdapter<StringType2> adapter2(m_string2);
|
| + adapter1.writeTo(destination);
|
| + adapter2.writeTo(destination + adapter1.length());
|
| }
|
|
|
| -template<typename StringType1, typename StringType2>
|
| -unsigned StringAppend<StringType1, StringType2>::length()
|
| -{
|
| - StringTypeAdapter<StringType1> adapter1(m_string1);
|
| - StringTypeAdapter<StringType2> adapter2(m_string2);
|
| - return adapter1.length() + adapter2.length();
|
| +template <typename StringType1, typename StringType2>
|
| +unsigned StringAppend<StringType1, StringType2>::length() {
|
| + StringTypeAdapter<StringType1> adapter1(m_string1);
|
| + StringTypeAdapter<StringType2> adapter2(m_string2);
|
| + return adapter1.length() + adapter2.length();
|
| }
|
|
|
| -template<typename StringType1, typename StringType2>
|
| +template <typename StringType1, typename StringType2>
|
| class StringTypeAdapter<StringAppend<StringType1, StringType2>> {
|
| - STACK_ALLOCATED();
|
| -public:
|
| - StringTypeAdapter<StringAppend<StringType1, StringType2>>(StringAppend<StringType1, StringType2>& buffer)
|
| - : m_buffer(buffer)
|
| - {
|
| - }
|
| + STACK_ALLOCATED();
|
| +
|
| + public:
|
| + StringTypeAdapter<StringAppend<StringType1, StringType2>>(
|
| + StringAppend<StringType1, StringType2>& buffer)
|
| + : m_buffer(buffer) {}
|
|
|
| - unsigned length() { return m_buffer.length(); }
|
| + unsigned length() { return m_buffer.length(); }
|
|
|
| - bool is8Bit() { return m_buffer.is8Bit(); }
|
| + bool is8Bit() { return m_buffer.is8Bit(); }
|
|
|
| - void writeTo(LChar* destination) { m_buffer.writeTo(destination); }
|
| - void writeTo(UChar* destination) { m_buffer.writeTo(destination); }
|
| + void writeTo(LChar* destination) { m_buffer.writeTo(destination); }
|
| + void writeTo(UChar* destination) { m_buffer.writeTo(destination); }
|
|
|
| -private:
|
| - StringAppend<StringType1, StringType2>& m_buffer;
|
| + private:
|
| + StringAppend<StringType1, StringType2>& m_buffer;
|
| };
|
|
|
| -inline StringAppend<const char*, String> operator+(const char* string1, const String& string2)
|
| -{
|
| - return StringAppend<const char*, String>(string1, string2);
|
| +inline StringAppend<const char*, String> operator+(const char* string1,
|
| + const String& string2) {
|
| + return StringAppend<const char*, String>(string1, string2);
|
| }
|
|
|
| -inline StringAppend<const char*, AtomicString> operator+(const char* string1, const AtomicString& string2)
|
| -{
|
| - return StringAppend<const char*, AtomicString>(string1, string2);
|
| +inline StringAppend<const char*, AtomicString> operator+(
|
| + const char* string1,
|
| + const AtomicString& string2) {
|
| + return StringAppend<const char*, AtomicString>(string1, string2);
|
| }
|
|
|
| -template<typename U, typename V>
|
| -inline StringAppend<const char*, StringAppend<U, V>> operator+(const char* string1, const StringAppend<U, V>& string2)
|
| -{
|
| - return StringAppend<const char*, StringAppend<U, V>>(string1, string2);
|
| +template <typename U, typename V>
|
| +inline StringAppend<const char*, StringAppend<U, V>> operator+(
|
| + const char* string1,
|
| + const StringAppend<U, V>& string2) {
|
| + return StringAppend<const char*, StringAppend<U, V>>(string1, string2);
|
| }
|
|
|
| -inline StringAppend<const UChar*, String> operator+(const UChar* string1, const String& string2)
|
| -{
|
| - return StringAppend<const UChar*, String>(string1, string2);
|
| +inline StringAppend<const UChar*, String> operator+(const UChar* string1,
|
| + const String& string2) {
|
| + return StringAppend<const UChar*, String>(string1, string2);
|
| }
|
|
|
| -inline StringAppend<const UChar*, AtomicString> operator+(const UChar* string1, const AtomicString& string2)
|
| -{
|
| - return StringAppend<const UChar*, AtomicString>(string1, string2);
|
| +inline StringAppend<const UChar*, AtomicString> operator+(
|
| + const UChar* string1,
|
| + const AtomicString& string2) {
|
| + return StringAppend<const UChar*, AtomicString>(string1, string2);
|
| }
|
|
|
| -template<typename U, typename V>
|
| -inline StringAppend<const UChar*, StringAppend<U, V>> operator+(const UChar* string1, const StringAppend<U, V>& string2)
|
| -{
|
| - return StringAppend<const UChar*, StringAppend<U, V>>(string1, string2);
|
| +template <typename U, typename V>
|
| +inline StringAppend<const UChar*, StringAppend<U, V>> operator+(
|
| + const UChar* string1,
|
| + const StringAppend<U, V>& string2) {
|
| + return StringAppend<const UChar*, StringAppend<U, V>>(string1, string2);
|
| }
|
|
|
| -template<typename T>
|
| -StringAppend<String, T> operator+(const String& string1, T string2)
|
| -{
|
| - return StringAppend<String, T>(string1, string2);
|
| +template <typename T>
|
| +StringAppend<String, T> operator+(const String& string1, T string2) {
|
| + return StringAppend<String, T>(string1, string2);
|
| }
|
|
|
| -template<typename U, typename V, typename W>
|
| -StringAppend<StringAppend<U, V>, W> operator+(const StringAppend<U, V>& string1, W string2)
|
| -{
|
| - return StringAppend<StringAppend<U, V>, W>(string1, string2);
|
| +template <typename U, typename V, typename W>
|
| +StringAppend<StringAppend<U, V>, W> operator+(const StringAppend<U, V>& string1,
|
| + W string2) {
|
| + return StringAppend<StringAppend<U, V>, W>(string1, string2);
|
| }
|
|
|
| -} // namespace WTF
|
| +} // namespace WTF
|
|
|
| -#endif // StringOperators_h
|
| +#endif // StringOperators_h
|
|
|