#ifndef WebDOMString_h
#define WebDOMString_h
#include <WebDOMCString.h>
#include <wtf/Forward.h>
class WebDOMStringPrivate;
class WebDOMString {
public:
~WebDOMString() { reset(); }
WebDOMString() : m_private(0) { }
WebDOMString(const WebUChar* data, size_t len) : m_private(0)
{
assign(data, len);
}
WebDOMString(const WebDOMString& s) : m_private(0) { assign(s); }
WebDOMString& operator=(const WebDOMString& s)
{
assign(s);
return *this;
}
void reset();
void assign(const WebDOMString&);
void assign(const WebUChar* data, size_t len);
size_t length() const;
const WebUChar* data() const;
bool isEmpty() const { return !length(); }
bool isNull() const { return !m_private; }
WebDOMCString utf8() const;
static WebDOMString fromUTF8(const char* data, size_t length);
static WebDOMString fromUTF8(const char* data);
template <int N> WebDOMString(const char (&data)[N])
: m_private(0)
{
assign(fromUTF8(data, N - 1));
}
template <int N> WebDOMString& operator=(const char (&data)[N])
{
assign(fromUTF8(data, N - 1));
return *this;
}
WebDOMString(const WTF::String&);
WebDOMString& operator=(const WTF::String&);
operator WTF::String() const;
WebDOMString(const WTF::AtomicString&);
WebDOMString& operator=(const WTF::AtomicString&);
operator WTF::AtomicString() const;
bool equals(const char* string) const;
private:
void assign(WebDOMStringPrivate*);
WebDOMStringPrivate* m_private;
};
#endif