| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 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 12 matching lines...) Expand all Loading... |
| 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 PrintStream_h | 26 #ifndef PrintStream_h |
| 27 #define PrintStream_h | 27 #define PrintStream_h |
| 28 | 28 |
| 29 #include <stdarg.h> | 29 #include <stdarg.h> |
| 30 #include "wtf/FastAllocBase.h" | 30 #include "wtf/FastAllocBase.h" |
| 31 #include "wtf/Noncopyable.h" | 31 #include "wtf/Noncopyable.h" |
| 32 #include "wtf/StdLibExtras.h" | 32 #include "wtf/StdLibExtras.h" |
| 33 #include "wtf/WTFExport.h" |
| 33 | 34 |
| 34 namespace WTF { | 35 namespace WTF { |
| 35 | 36 |
| 36 class CString; | 37 class CString; |
| 37 class String; | 38 class String; |
| 38 | 39 |
| 39 class PrintStream { | 40 class WTF_EXPORT PrintStream { |
| 40 WTF_MAKE_FAST_ALLOCATED; WTF_MAKE_NONCOPYABLE(PrintStream); | 41 WTF_MAKE_FAST_ALLOCATED; WTF_MAKE_NONCOPYABLE(PrintStream); |
| 41 public: | 42 public: |
| 42 PrintStream(); | 43 PrintStream(); |
| 43 virtual ~PrintStream(); | 44 virtual ~PrintStream(); |
| 44 | 45 |
| 45 void printf(const char* format, ...) WTF_ATTRIBUTE_PRINTF(2, 3); | 46 void printf(const char* format, ...) WTF_ATTRIBUTE_PRINTF(2, 3); |
| 46 virtual void vprintf(const char* format, va_list) WTF_ATTRIBUTE_PRINTF(2, 0)
= 0; | 47 virtual void vprintf(const char* format, va_list) WTF_ATTRIBUTE_PRINTF(2, 0)
= 0; |
| 47 | 48 |
| 48 // Typically a no-op for many subclasses of PrintStream, this is a hint that | 49 // Typically a no-op for many subclasses of PrintStream, this is a hint that |
| 49 // the implementation should flush its buffers if it had not done so already
. | 50 // the implementation should flush its buffers if it had not done so already
. |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 print(value7); | 200 print(value7); |
| 200 print(value8); | 201 print(value8); |
| 201 print(value9); | 202 print(value9); |
| 202 print(value10); | 203 print(value10); |
| 203 print(value11); | 204 print(value11); |
| 204 print(value12); | 205 print(value12); |
| 205 print(value13); | 206 print(value13); |
| 206 } | 207 } |
| 207 }; | 208 }; |
| 208 | 209 |
| 209 void printInternal(PrintStream&, const char*); | 210 WTF_EXPORT void printInternal(PrintStream&, const char*); |
| 210 void printInternal(PrintStream&, const CString&); | 211 WTF_EXPORT void printInternal(PrintStream&, const CString&); |
| 211 void printInternal(PrintStream&, const String&); | 212 WTF_EXPORT void printInternal(PrintStream&, const String&); |
| 212 inline void printInternal(PrintStream& out, char* value) { printInternal(out, st
atic_cast<const char*>(value)); } | 213 inline void printInternal(PrintStream& out, char* value) { printInternal(out, st
atic_cast<const char*>(value)); } |
| 213 inline void printInternal(PrintStream& out, CString& value) { printInternal(out,
static_cast<const CString&>(value)); } | 214 inline void printInternal(PrintStream& out, CString& value) { printInternal(out,
static_cast<const CString&>(value)); } |
| 214 inline void printInternal(PrintStream& out, String& value) { printInternal(out,
static_cast<const String&>(value)); } | 215 inline void printInternal(PrintStream& out, String& value) { printInternal(out,
static_cast<const String&>(value)); } |
| 215 void printInternal(PrintStream&, bool); | 216 WTF_EXPORT void printInternal(PrintStream&, bool); |
| 216 void printInternal(PrintStream&, int); | 217 WTF_EXPORT void printInternal(PrintStream&, int); |
| 217 void printInternal(PrintStream&, unsigned); | 218 WTF_EXPORT void printInternal(PrintStream&, unsigned); |
| 218 void printInternal(PrintStream&, long); | 219 WTF_EXPORT void printInternal(PrintStream&, long); |
| 219 void printInternal(PrintStream&, unsigned long); | 220 WTF_EXPORT void printInternal(PrintStream&, unsigned long); |
| 220 void printInternal(PrintStream&, long long); | 221 WTF_EXPORT void printInternal(PrintStream&, long long); |
| 221 void printInternal(PrintStream&, unsigned long long); | 222 WTF_EXPORT void printInternal(PrintStream&, unsigned long long); |
| 222 void printInternal(PrintStream&, float); | 223 WTF_EXPORT void printInternal(PrintStream&, float); |
| 223 void printInternal(PrintStream&, double); | 224 WTF_EXPORT void printInternal(PrintStream&, double); |
| 224 | 225 |
| 225 template<typename T> | 226 template<typename T> |
| 226 void printInternal(PrintStream& out, const T& value) | 227 void printInternal(PrintStream& out, const T& value) |
| 227 { | 228 { |
| 228 value.dump(out); | 229 value.dump(out); |
| 229 } | 230 } |
| 230 | 231 |
| 231 #define MAKE_PRINT_ADAPTOR(Name, Type, function) \ | 232 #define MAKE_PRINT_ADAPTOR(Name, Type, function) \ |
| 232 class Name { \ | 233 class Name { \ |
| 233 public: \ | 234 public: \ |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 | 293 |
| 293 } // namespace WTF | 294 } // namespace WTF |
| 294 | 295 |
| 295 using WTF::CharacterDump; | 296 using WTF::CharacterDump; |
| 296 using WTF::PointerDump; | 297 using WTF::PointerDump; |
| 297 using WTF::PrintStream; | 298 using WTF::PrintStream; |
| 298 using WTF::pointerDump; | 299 using WTF::pointerDump; |
| 299 | 300 |
| 300 #endif // PrintStream_h | 301 #endif // PrintStream_h |
| 301 | 302 |
| OLD | NEW |