| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef String16_h | 5 #ifndef String16_h |
| 6 #define String16_h | 6 #define String16_h |
| 7 | 7 |
| 8 //#include "Collections.h" | 8 //#include "Collections.h" |
| 9 //#include "Platform.h" | 9 //#include "Platform.h" |
| 10 #include "{{export_macro_include}}" | 10 #include "{{config.class_export.header}}" |
| 11 | 11 |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 namespace protocol { | 15 namespace protocol { |
| 16 | 16 |
| 17 namespace internal { | 17 namespace internal { |
| 18 {{export_macro}} void intToStr(int, char*, size_t); | 18 {{config.class_export.macro}} void intToStr(int, char*, size_t); |
| 19 {{export_macro}} void doubleToStr(double, char*, size_t); | 19 {{config.class_export.macro}} void doubleToStr(double, char*, size_t); |
| 20 {{export_macro}} void doubleToStr3(double, char*, size_t); | 20 {{config.class_export.macro}} void doubleToStr3(double, char*, size_t); |
| 21 {{export_macro}} void doubleToStr6(double, char*, size_t); | 21 {{config.class_export.macro}} void doubleToStr6(double, char*, size_t); |
| 22 {{export_macro}} double strToDouble(const char*, bool*); | 22 {{config.class_export.macro}} double strToDouble(const char*, bool*); |
| 23 {{export_macro}} int strToInt(const char*, bool*); | 23 {{config.class_export.macro}} int strToInt(const char*, bool*); |
| 24 } // namespace internal | 24 } // namespace internal |
| 25 | 25 |
| 26 template <typename T, typename C> | 26 template <typename T, typename C> |
| 27 class {{export_macro}} String16Base { | 27 class {{config.class_export.macro}} String16Base { |
| 28 public: | 28 public: |
| 29 static bool isASCII(C c) | 29 static bool isASCII(C c) |
| 30 { | 30 { |
| 31 return !(c & ~0x7F); | 31 return !(c & ~0x7F); |
| 32 } | 32 } |
| 33 | 33 |
| 34 static bool isSpaceOrNewLine(C c) | 34 static bool isSpaceOrNewLine(C c) |
| 35 { | 35 { |
| 36 return isASCII(c) && c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9)); | 36 return isASCII(c) && c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9)); |
| 37 } | 37 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 if (characters[i] != prefix[j]) | 145 if (characters[i] != prefix[j]) |
| 146 return false; | 146 return false; |
| 147 } | 147 } |
| 148 return true; | 148 return true; |
| 149 } | 149 } |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 } // namespace protocol | 152 } // namespace protocol |
| 153 } // namespace blink | 153 } // namespace blink |
| 154 | 154 |
| 155 #include "{{string16_impl_h_include}}" | 155 #include "{{config.lib.string16_header}}" |
| 156 | 156 |
| 157 namespace blink { | 157 namespace blink { |
| 158 namespace protocol { | 158 namespace protocol { |
| 159 | 159 |
| 160 class {{export_macro}} String16Builder { | 160 class {{config.class_export.macro}} String16Builder { |
| 161 public: | 161 public: |
| 162 String16Builder(); | 162 String16Builder(); |
| 163 void append(const String16&); | 163 void append(const String16&); |
| 164 void append(UChar); | 164 void append(UChar); |
| 165 void append(char); | 165 void append(char); |
| 166 void append(const UChar*, size_t); | 166 void append(const UChar*, size_t); |
| 167 void append(const char*, size_t); | 167 void append(const char*, size_t); |
| 168 String16 toString(); | 168 String16 toString(); |
| 169 void reserveCapacity(size_t); | 169 void reserveCapacity(size_t); |
| 170 | 170 |
| 171 private: | 171 private: |
| 172 std::vector<UChar> m_buffer; | 172 std::vector<UChar> m_buffer; |
| 173 }; | 173 }; |
| 174 | 174 |
| 175 } // namespace protocol | 175 } // namespace protocol |
| 176 } // namespace blink | 176 } // namespace blink |
| 177 | 177 |
| 178 using String16 = blink::protocol::String16; | 178 using String16 = blink::protocol::String16; |
| 179 using String16Builder = blink::protocol::String16Builder; | 179 using String16Builder = blink::protocol::String16Builder; |
| 180 | 180 |
| 181 #endif // !defined(String16_h) | 181 #endif // !defined(String16_h) |
| OLD | NEW |