chxavurlrep.h
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:3k
- /*============================================================================*
- *
- * (c) 1995-2002 RealNetworks, Inc. Patents pending. All rights reserved.
- *
- *============================================================================*/
-
- // -*-c++-*-
- #ifndef _UTIL_URLRep_H
- #define _UTIL_URLRep_H
- #include "hxstring.h"
- #include "chxavvector.h"
- #include "chxavescapedstring.h"
- #include "char_stack.h"
- class CharStack;
- class CHXAvURLRep {
- public:
- CHXAvURLRep(const CHXString& url_string="");
- CHXAvURLRep(const CHXString& protocol, const CHXString& host,
- int port=0,
- const CHXString& path="",
- const CHXString& query="");
- CHXAvURLRep(const CHXString& protocol, const CHXString& host,
- int port,
- const CHXAvEscapedString& path,
- const CHXAvEscapedString& query);
- ~CHXAvURLRep();
- int operator==(const CHXAvURLRep&) const;
- int operator!=(const CHXAvURLRep&) const;
- const CHXString& String() const;
- const CHXString& Protocol() const;
- const CHXString& Host() const;
- int Port() const;
- const CHXString& Path() const;
- const CHXAvEscapedString& EscapedPath() const;
- const CHXString& Query() const;
- const CHXAvEscapedString& EscapedQuery() const;
- const CHXAvEscapedString& EscapedFragment() const;
- bool ApplyRelativeURL(const CHXAvURLRep& url); //implemented in apply_url.cpp
- bool IsAbsoluteURL() const;
-
- bool HasNetPath() const;
- bool HasAbsolutePath() const;
- bool HasQuery() const;
- bool HasFragment() const;
- bool Valid() const; // is the URL valid
- bool ValidProtocol() const; // is the protocol string valid
- bool ValidHostname() const; // is the hostname valid
- private:
- static bool ParseURL(const CHXString& url,
- CHXString& protocol, CHXString& host,
- int& port, CHXAvEscapedString& path,
- CHXAvEscapedString& query,
- CHXAvEscapedString& fragment,
- bool& hasNetPath,
- bool& hasAbsPath,
- bool& hasQuery,
- bool& hasFragment);
- static void BuildURL(CHXString& url,
- const CHXString& protocol, const CHXString& host,
- int port, const CHXAvEscapedString& path,
- const CHXAvEscapedString& query,
- const CHXAvEscapedString& fragment,
- bool hasNetPath,
- bool hasAbsPath,
- bool hasQuery,
- bool hasFragment);
- static void CollectChars(const char*& pu, const char* pExtraDelim,
- CharStack& token);
- CHXString m_String; // url string
- CHXString m_Protocol; // protocol
- CHXString m_Host; // host name
- int m_Port; // port
- CHXAvEscapedString m_Path; // path
- CHXAvEscapedString m_Query; // query
- CHXAvEscapedString m_Fragment; // fragment
- bool m_parseSuccess; // Did the url string that was passed in parse
- // ok?
- bool m_hasNetPath; // Does the URL contain a net path?
- bool m_hasAbsPath; // Does the URL contain an absolute path?
- bool m_hasQuery; // Does the URL contain a query string?
- bool m_hasFragment; // Does the URL contain a fragment string?
- };
- #endif // _UTIL_URLRep_H