| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef TextStream_h | 26 #ifndef TextStream_h |
| 27 #define TextStream_h | 27 #define TextStream_h |
| 28 | 28 |
| 29 #include "platform/PlatformExport.h" | 29 #include "platform/PlatformExport.h" |
| 30 #include "wtf/Forward.h" | 30 #include "wtf/Forward.h" |
| 31 #include "wtf/Vector.h" |
| 31 #include "wtf/text/StringBuilder.h" | 32 #include "wtf/text/StringBuilder.h" |
| 32 #include "wtf/unicode/Unicode.h" | 33 #include "wtf/unicode/Unicode.h" |
| 33 | 34 |
| 34 namespace WebCore { | 35 namespace WebCore { |
| 35 | 36 |
| 37 class IntPoint; |
| 38 class IntRect; |
| 39 class LayoutPoint; |
| 40 class FloatPoint; |
| 41 class FloatRect; |
| 42 class FloatSize; |
| 43 |
| 36 class PLATFORM_EXPORT TextStream { | 44 class PLATFORM_EXPORT TextStream { |
| 37 public: | 45 public: |
| 38 struct FormatNumberRespectingIntegers { | 46 struct FormatNumberRespectingIntegers { |
| 39 FormatNumberRespectingIntegers(double number) : value(number) { } | 47 FormatNumberRespectingIntegers(double number) : value(number) { } |
| 40 double value; | 48 double value; |
| 41 }; | 49 }; |
| 42 | 50 |
| 43 TextStream& operator<<(bool); | 51 TextStream& operator<<(bool); |
| 44 TextStream& operator<<(int); | 52 TextStream& operator<<(int); |
| 45 TextStream& operator<<(unsigned); | 53 TextStream& operator<<(unsigned); |
| 46 TextStream& operator<<(long); | 54 TextStream& operator<<(long); |
| 47 TextStream& operator<<(unsigned long); | 55 TextStream& operator<<(unsigned long); |
| 48 TextStream& operator<<(long long); | 56 TextStream& operator<<(long long); |
| 49 TextStream& operator<<(unsigned long long); | 57 TextStream& operator<<(unsigned long long); |
| 50 TextStream& operator<<(float); | 58 TextStream& operator<<(float); |
| 51 TextStream& operator<<(double); | 59 TextStream& operator<<(double); |
| 52 TextStream& operator<<(const char*); | 60 TextStream& operator<<(const char*); |
| 53 TextStream& operator<<(const void*); | 61 TextStream& operator<<(const void*); |
| 54 TextStream& operator<<(const String&); | 62 TextStream& operator<<(const String&); |
| 55 TextStream& operator<<(const FormatNumberRespectingIntegers&); | 63 TextStream& operator<<(const FormatNumberRespectingIntegers&); |
| 56 | 64 |
| 57 String release(); | 65 String release(); |
| 58 | 66 |
| 59 private: | 67 private: |
| 60 StringBuilder m_text; | 68 StringBuilder m_text; |
| 61 }; | 69 }; |
| 62 | 70 |
| 71 PLATFORM_EXPORT TextStream& operator<<(TextStream&, const IntPoint&); |
| 72 PLATFORM_EXPORT TextStream& operator<<(TextStream&, const IntRect&); |
| 73 PLATFORM_EXPORT TextStream& operator<<(TextStream&, const FloatPoint&); |
| 74 PLATFORM_EXPORT TextStream& operator<<(TextStream&, const FloatSize&); |
| 75 PLATFORM_EXPORT TextStream& operator<<(TextStream&, const FloatRect&); |
| 76 |
| 77 PLATFORM_EXPORT void writeIndent(TextStream&, int indent); |
| 78 |
| 79 template<typename Item> |
| 80 TextStream& operator<<(TextStream& ts, const Vector<Item>& vector) |
| 81 { |
| 82 ts << "["; |
| 83 |
| 84 unsigned size = vector.size(); |
| 85 for (unsigned i = 0; i < size; ++i) { |
| 86 ts << vector[i]; |
| 87 if (i < size - 1) |
| 88 ts << ", "; |
| 89 } |
| 90 |
| 91 ts << "]"; |
| 92 return ts; |
| 93 } |
| 94 |
| 63 } | 95 } |
| 64 | 96 |
| 65 #endif | 97 #endif |
| OLD | NEW |