65 const char * defaultScheme =
"http"
70 const char * defaultScheme =
"http"
124 const char * defaultScheme = NULL
129 const char * defaultScheme = NULL
130 ) {
return InternalParse((
const char *)str, defaultScheme); }
310 bool emptyDataDeletes =
true
406 const char * defaultScheme
435 virtual bool Parse(
const char * cstr,
PURL & url)
const = 0;
454 bool defhost =
false,
506 #define PURL_LEGACY_SCHEME(schemeName, \
510 defaultToUserIfNoAt, \
511 defaultHostToLocal, \
516 relativeImpliesScheme, \
518 class PURLLegacyScheme_##schemeName : public PURLLegacyScheme \
521 PURLLegacyScheme_##schemeName() \
522 : PURLLegacyScheme(hasUsername, \
525 defaultToUserIfNoAt, \
526 defaultHostToLocal, \
531 relativeImpliesScheme, \
535 PFACTORY_CREATE(PURLSchemeFactory, PURLLegacyScheme_##schemeName, #schemeName, true)
562 #endif // PTLIB_PURL_H
PStringOptions m_queryVars
Definition: url.h:423
Translate the path field for a URL.
Definition: url.h:165
void SetParamVars(const PStringToString ¶mVars, bool merge=false)
Set the parameter (;) field(s) of the URL as a string dictionary.
virtual PBoolean InternalParse(const char *cstr, const char *defaultScheme)
#define PMaxTimeInterval
Definition: timeint.h:31
WORD GetPort() const
Get the port field of the URL.
Definition: url.h:253
virtual void ReadFrom(istream &strm)
Input the contents of the URL from the stream.
bool defaultToUserIfNoAt
Definition: url.h:490
static void SplitQueryVars(const PString &queryStr, PStringToString &queryVars)
Split a string in &= form to a dictionary of names and values.
Definition: url.h:208
const PStringOptions & GetQueryVars() const
Get the Query (?) field of the URL as a string dictionary.
Definition: url.h:325
PFactory< PURLLoader > PURLLoaderFactory
Definition: url.h:550
This class defines an arbitrary time interval to millisecond accuracy.
Definition: timeint.h:51
void SetPathStr(const PString &pathStr)
Set the path field of the URL as a string.
PBoolean IsEmpty() const
Return true if the URL is an empty string.
Definition: url.h:342
Output full URI.
Definition: url.h:134
PCaselessString m_scheme
Definition: url.h:413
PString m_contents
Definition: url.h:424
virtual Comparison Compare(const PObject &obj) const
Compare the two URLs and return their relative rank.
bool hasQuery
Definition: url.h:492
bool hasUsername
Definition: url.h:487
virtual bool Parse(const char *cstr, PURL &url) const =0
const PURLScheme * m_schemeInfo
Definition: url.h:410
void SetHostName(const PString &hostname)
Set the hostname field of the URL.
PURL & operator=(const PURL &other)
TranslationType
Type for translation of strings to URL format,.
Definition: url.h:161
static void OutputVars(ostream &strm, const PStringToString &vars, char sep0= ';', char sep1= ';', char sep2= '=', TranslationType type=ParameterTranslation)
Construct string from a dictionary using separators.
PBoolean Parse(const char *cstr, const char *defaultScheme=NULL)
Parse the URL string into the fields in the object instance.
Definition: url.h:122
bool hasHostPort
Definition: url.h:489
bool LoadResource(PString &data, const LoadParams ¶ms=LoadParams()) const
Get the resource the URL is pointing at.
void ChangePath(const PString &segment, PINDEX idx=P_MAX_INDEX)
Change segment in the path field of the URL.
Translate the parameter variables field for a URL.
Definition: url.h:169
PString LegacyAsString(PURL::UrlFormat fmt, const PURLLegacyScheme *schemeInfo) const
This is a dictionary collection class of PString objects, keyed by another string.
Definition: pstring.h:3151
This class describes a full description for a file on the particular platform.
Definition: filepath.h:61
PString GetHostPort() const
Get the hostname and optional port fields of the URL.
void SetUserName(const PString &username)
Set the username field of the URL.
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:2251
This class is a variation of a string that ignores case.
Definition: pstring.h:2012
PBoolean Parse(const PString &str, const char *defaultScheme=NULL)
Parse the URL string into the fields in the object instance.
Definition: url.h:127
void AppendPath(const PString &segment)
Append segment to the path field of the URL.
PURLLegacyScheme(bool user=false, bool pass=false, bool host=false, bool def=false, bool defhost=false, bool query=false, bool params=false, bool frags=false, bool path=false, bool rel=false, WORD port=0)
Definition: url.h:449
This is an array collection class of PString objects.
Definition: pstring.h:2365
void SetContents(const PString &str)
Set the contents of URL, data left after all elemetns are parsed out.
Translate the quoted parameter variables field for a URL.
Definition: url.h:171
PString m_password
Definition: url.h:415
static void SplitVars(const PString &str, PStringToString &vars, char sep1= ';', char sep2= '=', TranslationType type=ParameterTranslation)
Split a string to a dictionary of names and values.
Translate the query variable field for a URL.
Definition: url.h:167
void SetQueryVar(const PString &key, const PString &data)
Set the Query (?) field of the URL as a string dictionary.
const PStringOptions & GetParamVars() const
Get the parameter (;) field(s) of the URL as a string dictionary.
Definition: url.h:296
virtual PBoolean IsEmpty() const
Determine if the string is empty.
PStringArray m_path
Definition: url.h:420
PBoolean GetPortSupplied() const
Get if explicit port is specified.
Definition: url.h:259
static PString UntranslateString(const PString &str, TranslationType type)
Untranslate a string from a form that was included into a URL into a normal string.
PURL()
Construct a new URL object from the URL string.
void SetPath(const PStringArray &path)
Set the path field of the URL as a string array.
WORD m_port
Definition: url.h:417
virtual PString AsString(PURL::UrlFormat fmt, const PURL &purl) const =0
PCaselessString m_hostname
Definition: url.h:416
PString GetQuery() const
Get the Query (?) field of the URL as a string.
Array of unsigned characters.
Definition: array.h:605
PString GetPathStr() const
Get the path field of the URL as a string.
Specialised version of PStringToString to contain a dictionary of options/attributes.
Definition: pstring.h:3249
bool m_relativePath
port was supplied in string input
Definition: url.h:419
PTimeInterval m_timeout
Definition: url.h:355
const PString & GetPassword() const
Get the password field of the URL.
Definition: url.h:241
const PCaselessString & GetHostName() const
Get the hostname field of the URL.
Definition: url.h:247
bool hasParameters
Definition: url.h:493
virtual PINDEX HashFunction() const
This function yields a hash value required by the PDictionary class.
#define PFACTORY_LOAD(ConcreteType)
Definition: pfactory.h:557
virtual WORD GetDefaultPort() const
Definition: url.h:437
void SetPort(WORD newPort)
Set the port field in the URL. Zero resets to default.
Translate to a string as only path.
Definition: url.h:135
PString m_password
Definition: url.h:358
PStringOptions m_customOptions
Definition: url.h:364
static PString TranslateString(const PString &str, TranslationType type)
Translate a string from general form to one that can be included into a URL.
PFactory< PURLScheme > PURLSchemeFactory
Definition: url.h:440
void SetQuery(const PString &query)
Set the Query (?) field of the URL as a string.
bool PBoolean
Definition: object.h:174
const PStringArray & GetPath() const
Get the path field of the URL as a string array.
Definition: url.h:274
virtual WORD GetDefaultPort() const
Definition: url.h:485
static PCaselessString ExtractScheme(const char *str)
Extract scheme as per RFC2396.
#define P_MAX_INDEX
Definition: object.h:80
PStringOptions m_paramVars
Definition: url.h:421
The character string class.
Definition: pstring.h:108
PString m_urlString
Definition: url.h:411
bool Parse(const char *cstr, PURL &url) const
Definition: url.h:475
PFilePath AsFilePath() const
Get the "file:" URL as a file path.
Translate to a string with no scheme or host, just the relative part.
Definition: url.h:137
PString GetParameters() const
Get the parameter (;) field of the URL.
bool hasPassword
Definition: url.h:488
bool LegacyParse(const char *str, const PURLLegacyScheme *schemeInfo)
Translate to a string with the location (scheme and user/pass/host/port)
Definition: url.h:136
const PCaselessString & GetScheme() const
Get the scheme field of the URL.
Definition: url.h:229
UrlFormat
Print/String output representation formats.
Definition: url.h:133
static const PString & Empty()
Return an empty string.
const PString & GetFragment() const
Get the fragment (#) field of the URL.
Definition: url.h:314
PString m_username
Definition: url.h:357
Class for a factory to create concrete class instances without parameters during construction.
Definition: pfactory.h:396
bool OpenBrowser() const
Open the URL in a browser.
Definition: url.h:393
void SetParamVar(const PString &key, const PString &data, bool emptyDataDeletes=true)
Set the parameter (;) field of the URL as a string dictionary.
PString m_fragment
Definition: url.h:422
PString AsString(PURL::UrlFormat fmt, const PURL &url) const
Definition: url.h:480
bool m_portSupplied
Definition: url.h:418
Translate a username/password field for a URL.
Definition: url.h:163
bool hasFragments
Definition: url.h:494
const PString & GetUserName() const
Get the username field of the URL.
Definition: url.h:235
virtual void PrintOn(ostream &strm) const
Output the contents of the URL to the stream as a string.
bool hasPath
Definition: url.h:495
bool defaultHostToLocal
Definition: url.h:491
PString m_username
Definition: url.h:414
#define PCLASSINFO_WITH_CLONE(cls, par)
Declare all the standard PTLib class information, plus Clone().
Definition: object.h:2167
LoadParams(const PString &requiredContentType=PString::Empty(), const PTimeInterval &timeout=PMaxTimeInterval)
Definition: url.h:346
void SetPassword(const PString &password)
Set the password field of the URL.
PString m_requiredContentType
Definition: url.h:354
bool LoadResource(T &data, const PString &requiredContentType=PString::Empty(), const PTimeInterval &timeout=PMaxTimeInterval) const
Definition: url.h:381
const PString & GetContents() const
Get the contents of URL, data left after all elemetns are parsed out.
Definition: url.h:336
WORD defaultPort
Definition: url.h:497
void SetParameters(const PString ¶meters)
Set the parameter (;) field of the URL.
bool relativeImpliesScheme
Definition: url.h:496
PString AsString(UrlFormat fmt=FullURL) const
Convert the URL object into its string representation.
Ultimate parent class for all objects in the class library.
Definition: object.h:2204
This class describes a Universal Resource Locator.
Definition: url.h:56
PBoolean GetRelativePath() const
Get if path is relative or absolute.
Definition: url.h:265
void SetQueryVars(const PStringToString &queryVars)
Set the Query (?) field(s) of the URL as a string dictionary.
bool SetScheme(const PString &scheme)
Set the scheme field of the URL.
virtual bool Load(PString &str, const PURL &url, const PURL::LoadParams ¶ms) const =0
void CopyContents(const PURL &other)