#ifndef KURL_h
#define KURL_h
#include "DeprecatedString.h"
#include <wtf/Platform.h>
#if PLATFORM(CF)
typedef const struct __CFURL * CFURLRef;
#endif
#if PLATFORM(MAC)
#ifdef __OBJC__
@class NSURL;
#else
class NSURL;
#endif
#endif
namespace WebCore {
class KURL;
class String;
class TextEncoding;
bool operator==(const KURL&, const KURL&);
inline bool operator!=(const KURL &a, const KURL &b) { return !(a == b); }
bool equalIgnoringRef(const KURL&, const KURL&);
class KURL {
public:
KURL();
KURL(const char*);
KURL(const KURL&, const DeprecatedString&);
KURL(const KURL&, const DeprecatedString&, const TextEncoding&);
KURL(const DeprecatedString&);
#if PLATFORM(MAC)
KURL(NSURL*);
#endif
#if PLATFORM(CF)
KURL(CFURLRef);
#endif
bool isEmpty() const { return urlString.isEmpty(); }
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 lastPathComponent() 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 PLATFORM(CF)
CFURLRef createCFURL() const;
#endif
#if PLATFORM(MAC)
NSURL *getNSURL() const;
#endif
bool isLocalFile() const;
static DeprecatedString decode_string(const DeprecatedString&);
static DeprecatedString decode_string(const DeprecatedString&, const TextEncoding&);
static DeprecatedString encode_string(const DeprecatedString&);
friend bool operator==(const KURL &, const KURL &);
#ifndef NDEBUG
void print() const;
#endif
private:
bool isHierarchical() const;
void init(const KURL&, const DeprecatedString&, const TextEncoding&);
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 // KURL_h