#ifndef TextStream_h
#define TextStream_h
#include "platform/PlatformExport.h"
#include "wtf/Forward.h"
#include "wtf/Vector.h"
#include "wtf/text/StringBuilder.h"
#include "wtf/unicode/Unicode.h"
namespace WebCore {
class IntPoint;
class IntRect;
class LayoutPoint;
class FloatPoint;
class FloatRect;
class FloatSize;
class PLATFORM_EXPORT TextStream {
public:
struct FormatNumberRespectingIntegers {
FormatNumberRespectingIntegers(double number) : value(number) { }
double value;
};
TextStream& operator<<(bool);
TextStream& operator<<(int);
TextStream& operator<<(unsigned);
TextStream& operator<<(long);
TextStream& operator<<(unsigned long);
TextStream& operator<<(long long);
TextStream& operator<<(unsigned long long);
TextStream& operator<<(float);
TextStream& operator<<(double);
TextStream& operator<<(const char*);
TextStream& operator<<(const void*);
TextStream& operator<<(const String&);
TextStream& operator<<(const FormatNumberRespectingIntegers&);
String release();
private:
StringBuilder m_text;
};
PLATFORM_EXPORT TextStream& operator<<(TextStream&, const IntPoint&);
PLATFORM_EXPORT TextStream& operator<<(TextStream&, const IntRect&);
PLATFORM_EXPORT TextStream& operator<<(TextStream&, const FloatPoint&);
PLATFORM_EXPORT TextStream& operator<<(TextStream&, const FloatSize&);
PLATFORM_EXPORT TextStream& operator<<(TextStream&, const FloatRect&);
PLATFORM_EXPORT void writeIndent(TextStream&, int indent);
template<typename Item>
TextStream& operator<<(TextStream& ts, const Vector<Item>& vector)
{
ts << "[";
unsigned size = vector.size();
for (unsigned i = 0; i < size; ++i) {
ts << vector[i];
if (i < size - 1)
ts << ", ";
}
ts << "]";
return ts;
}
}
#endif