#ifndef WebDOMCString_h
#define WebDOMCString_h
#include <WebDOMObject.h>
#include <wtf/Forward.h>
#include <stddef.h> // For size_t
#if defined(WIN32)
typedef wchar_t WebUChar;
#else
typedef unsigned short WebUChar;
#endif
class WebDOMCStringPrivate;
class WebDOMString;
class WebDOMCString {
public:
~WebDOMCString() { reset(); }
WebDOMCString() : m_private(0) { }
WebDOMCString(const char* data, size_t len) : m_private(0)
{
assign(data, len);
}
WebDOMCString(const WebDOMCString& s) : m_private(0) { assign(s); }
WebDOMCString& operator=(const WebDOMCString& s)
{
assign(s);
return *this;
}
void reset();
void assign(const WebDOMCString&);
void assign(const char* data, size_t len);
size_t length() const;
const char* data() const;
bool isEmpty() const { return !length(); }
bool isNull() const { return !m_private; }
WebDOMString utf16() const;
static WebDOMCString fromUTF16(const WebUChar* data, size_t length);
static WebDOMCString fromUTF16(const WebUChar* data);
WebDOMCString(const WTF::CString&);
WebDOMCString& operator=(const WTF::CString&);
operator WTF::CString() const;
private:
void assign(WebDOMCStringPrivate*);
WebDOMCStringPrivate* m_private;
};
#endif