#ifndef KURL_H_
#define KURL_H_
#include "TextEncoding.h"
#if __APPLE__
#ifdef __OBJC__
@class NSData;
@class NSURL;
#else
class NSData;
class NSURL;
#endif
#endif
namespace WebCore {
class KURL;
class String;
bool operator==(const KURL&, const KURL&);
bool equalIgnoringRef(const KURL&, const KURL&);
class KURL {
public:
KURL();
KURL(const char*);
KURL(const KURL&, const DeprecatedString&, const TextEncoding& encoding = TextEncoding(UTF8Encoding));
KURL(const DeprecatedString&);
#if __APPLE__
KURL(NSURL*);
#endif
bool isEmpty() const { return urlString.isEmpty(); }
bool isMalformed() const { return !m_isValid; }
bool isValid() const { return m_isValid; }
bool hasPath() const;
DeprecatedString url() const { return urlString; }
DeprecatedString protocol() const;
DeprecatedString host() const;
unsigned short int port() const;
DeprecatedString user() const;
DeprecatedString pass() const;
DeprecatedString path() const;
DeprecatedString query() const;
DeprecatedString ref() const;
bool hasRef() const;
DeprecatedString encodedHtmlRef() const { return ref(); }
void setProtocol(const DeprecatedString &);
void setHost(const DeprecatedString &);
void setPort(unsigned short int);
void setHostAndPort(const DeprecatedString&);
void setUser(const DeprecatedString &);
void setPass(const DeprecatedString &);
void setPath(const DeprecatedString &);
void setQuery(const DeprecatedString &);
void setRef(const DeprecatedString &);
DeprecatedString prettyURL() const;
#if __APPLE__
CFURLRef createCFURL() const;
NSURL *getNSURL() const;
#endif
bool isLocalFile() const;
static DeprecatedString decode_string(const DeprecatedString &, const TextEncoding& encoding = TextEncoding(UTF8Encoding));
static DeprecatedString encode_string(const DeprecatedString &);
friend bool operator==(const KURL &, const KURL &);
private:
bool isHierarchical() const;
void parse(const char *url, const DeprecatedString *originalString);
DeprecatedString urlString;
bool m_isValid;
int schemeEndPos;
int userStartPos;
int userEndPos;
int passwordEndPos;
int hostEndPos;
int portEndPos;
int pathEndPos;
int queryEndPos;
int fragmentEndPos;
friend bool equalIgnoringRef(const KURL& a, const KURL& b);
};
}
#endif