summaryrefslogtreecommitdiffstats
path: root/url/gurl.h
diff options
context:
space:
mode:
Diffstat (limited to 'url/gurl.h')
-rw-r--r--url/gurl.h64
1 files changed, 33 insertions, 31 deletions
diff --git a/url/gurl.h b/url/gurl.h
index ef4b585..0b8cf30 100644
--- a/url/gurl.h
+++ b/url/gurl.h
@@ -11,6 +11,7 @@
#include "base/string16.h"
#include "url/url_canon.h"
#include "url/url_canon_stdstring.h"
+#include "url/url_export.h"
#include "url/url_parse.h"
class GURL {
@@ -19,11 +20,11 @@ class GURL {
typedef url_canon::StdStringReplacements<string16> ReplacementsW;
// Creates an empty, invalid URL.
- GURL();
+ URL_EXPORT GURL();
// Copy construction is relatively inexpensive, with most of the time going
// to reallocating the string. It does not re-parse.
- GURL(const GURL& other);
+ URL_EXPORT GURL(const GURL& other);
// The narrow version requires the input be UTF-8. Invalid UTF-8 input will
// result in an invalid URL.
@@ -32,20 +33,20 @@ class GURL {
// encode the query parameters. It is probably sufficient for the narrow
// version to assume the query parameter encoding should be the same as the
// input encoding.
- explicit GURL(const std::string& url_string
- /*, output_param_encoding*/);
- explicit GURL(const string16& url_string
- /*, output_param_encoding*/);
+ URL_EXPORT explicit GURL(const std::string& url_string
+ /*, output_param_encoding*/);
+ URL_EXPORT explicit GURL(const string16& url_string
+ /*, output_param_encoding*/);
// Constructor for URLs that have already been parsed and canonicalized. This
// is used for conversions from KURL, for example. The caller must supply all
// information associated with the URL, which must be correct and consistent.
- GURL(const char* canonical_spec, size_t canonical_spec_len,
- const url_parse::Parsed& parsed, bool is_valid);
+ URL_EXPORT GURL(const char* canonical_spec, size_t canonical_spec_len,
+ const url_parse::Parsed& parsed, bool is_valid);
- ~GURL();
+ URL_EXPORT ~GURL();
- GURL& operator=(const GURL& other);
+ URL_EXPORT GURL& operator=(const GURL& other);
// Returns true when this object represents a valid parsed URL. When not
// valid, other functions will still succeed, but you will not get canonical
@@ -77,7 +78,7 @@ class GURL {
// Used invalid_spec() below to get the unusable spec of an invalid URL. This
// separation is designed to prevent errors that may cause security problems
// that could result from the mistaken use of an invalid URL.
- const std::string& spec() const;
+ URL_EXPORT const std::string& spec() const;
// Returns the potentially invalid spec for a the URL. This spec MUST NOT be
// modified or sent over the network. It is designed to be displayed in error
@@ -129,8 +130,8 @@ class GURL {
//
// It is an error to resolve a URL relative to an invalid URL. The result
// will be the empty URL.
- GURL Resolve(const std::string& relative) const;
- GURL Resolve(const string16& relative) const;
+ URL_EXPORT GURL Resolve(const std::string& relative) const;
+ URL_EXPORT GURL Resolve(const string16& relative) const;
// Like Resolve() above but takes a character set encoder which will be used
// for any query text specified in the input. The charset converter parameter
@@ -139,10 +140,10 @@ class GURL {
// TODO(brettw): These should be replaced with versions that take something
// more friendly than a raw CharsetConverter (maybe like an ICU character set
// name).
- GURL ResolveWithCharsetConverter(
+ URL_EXPORT GURL ResolveWithCharsetConverter(
const std::string& relative,
url_canon::CharsetConverter* charset_converter) const;
- GURL ResolveWithCharsetConverter(
+ URL_EXPORT GURL ResolveWithCharsetConverter(
const string16& relative,
url_canon::CharsetConverter* charset_converter) const;
@@ -157,9 +158,9 @@ class GURL {
//
// Note that we use the more general url_canon::Replacements type to give
// callers extra flexibility rather than our override.
- GURL ReplaceComponents(
+ URL_EXPORT GURL ReplaceComponents(
const url_canon::Replacements<char>& replacements) const;
- GURL ReplaceComponents(
+ URL_EXPORT GURL ReplaceComponents(
const url_canon::Replacements<char16>& replacements) const;
// A helper function that is equivalent to replacing the path with a slash
@@ -171,7 +172,7 @@ class GURL {
//
// It is an error to get an empty path on an invalid URL. The result
// will be the empty URL.
- GURL GetWithEmptyPath() const;
+ URL_EXPORT GURL GetWithEmptyPath() const;
// A helper function to return a GURL containing just the scheme, host,
// and port from a URL. Equivalent to clearing any username and password,
@@ -182,19 +183,19 @@ class GURL {
//
// It is an error to get the origin of an invalid URL. The result
// will be the empty URL.
- GURL GetOrigin() const;
+ URL_EXPORT GURL GetOrigin() const;
// Returns true if the scheme for the current URL is a known "standard"
// scheme. Standard schemes have an authority and a path section. This
// includes file: and filesystem:, which some callers may want to filter out
// explicitly by calling SchemeIsFile[System].
- bool IsStandard() const;
+ URL_EXPORT bool IsStandard() const;
// Returns true if the given parameter (should be lower-case ASCII to match
// the canonicalized scheme) is the scheme for this URL. This call is more
// efficient than getting the scheme and comparing it because no copies or
// object constructions are done.
- bool SchemeIs(const char* lower_ascii_scheme) const;
+ URL_EXPORT bool SchemeIs(const char* lower_ascii_scheme) const;
// We often need to know if this is a file URL. File URLs are "standard", but
// are often treated separately by some programs.
@@ -216,7 +217,7 @@ class GURL {
// Returns true if the hostname is an IP address. Note: this function isn't
// as cheap as a simple getter because it re-parses the hostname to verify.
// This currently identifies only IPv4 addresses (bug 822685).
- bool HostIsIPAddress() const;
+ URL_EXPORT bool HostIsIPAddress() const;
// Getters for various components of the URL. The returned string will be
// empty if the component is empty or is not present.
@@ -282,24 +283,24 @@ class GURL {
// Returns a parsed version of the port. Can also be any of the special
// values defined in Parsed for ExtractPort.
- int IntPort() const;
+ URL_EXPORT int IntPort() const;
// Returns the port number of the url, or the default port number.
// If the scheme has no concept of port (or unknown default) returns
// PORT_UNSPECIFIED.
- int EffectiveIntPort() const;
+ URL_EXPORT int EffectiveIntPort() const;
// Extracts the filename portion of the path and returns it. The filename
// is everything after the last slash in the path. This may be empty.
- std::string ExtractFileName() const;
+ URL_EXPORT std::string ExtractFileName() const;
// Returns the path that should be sent to the server. This is the path,
// parameter, and query portions of the URL. It is guaranteed to be ASCII.
- std::string PathForRequest() const;
+ URL_EXPORT std::string PathForRequest() const;
// Returns the host, excluding the square brackets surrounding IPv6 address
// literals. This can be useful for passing to getaddrinfo().
- std::string HostNoBrackets() const;
+ URL_EXPORT std::string HostNoBrackets() const;
// Returns true if this URL's host matches or is in the same domain as
// the given input string. For example if this URL was "www.google.com",
@@ -311,7 +312,8 @@ class GURL {
//
// If function DomainIs has parameter domain_len, which means the parameter
// lower_ascii_domain does not gurantee to terminate with NULL character.
- bool DomainIs(const char* lower_ascii_domain, int domain_len) const;
+ URL_EXPORT bool DomainIs(const char* lower_ascii_domain,
+ int domain_len) const;
// If function DomainIs only has parameter lower_ascii_domain, which means
// domain string should be terminate with NULL character.
@@ -322,12 +324,12 @@ class GURL {
// Swaps the contents of this GURL object with the argument without doing
// any memory allocations.
- void Swap(GURL* other);
+ URL_EXPORT void Swap(GURL* other);
// Returns a reference to a singleton empty GURL. This object is for callers
// who return references but don't have anything to return in some cases.
// This function may be called from any thread.
- static const GURL& EmptyGURL();
+ URL_EXPORT static const GURL& EmptyGURL();
// Returns the inner URL of a nested URL [currently only non-null for
// filesystem: URLs].
@@ -361,6 +363,6 @@ class GURL {
};
// Stream operator so GURL can be used in assertion statements.
-std::ostream& operator<<(std::ostream& out, const GURL& url);
+URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url);
#endif // URL_GURL_H_