63 const char * defaultScheme =
"http" 68 const char * defaultScheme =
"http" 122 const char * defaultScheme = NULL
127 const char * defaultScheme = NULL
128 ) {
return InternalParse((
const char *)str, defaultScheme); }
293 bool emptyDataDeletes =
true 360 const char * defaultScheme
387 virtual PString GetName()
const = 0;
407 bool defhost =
false,
419 , defaultToUserIfNoAt (def)
420 , defaultHostToLocal (defhost)
422 , hasParameters (params)
423 , hasFragments (frags)
425 , relativeImpliesScheme (rel)
452 #define PURL_LEGACY_SCHEME(schemeName, user, pass, host, def, defhost, query, params, frags, path, rel, port) \ 453 class PURLLegacyScheme_##schemeName : public PURLLegacyScheme \ 456 PURLLegacyScheme_##schemeName() \ 457 : PURLLegacyScheme(#schemeName, user, pass, host, def, defhost, query, params, frags, path, rel, port) \ 460 static PURLSchemeFactory::Worker<PURLLegacyScheme_##schemeName> schemeName##Factory(#schemeName, true); \ 471 virtual bool Load(
const PURL & url,
PString & str,
const PString & requiredContentType) = 0;
480 #endif // PTLIB_PURL_H Translate the path field for a URL.
Definition: url.h:163
virtual PBoolean InternalParse(const char *cstr, const char *defaultScheme)
virtual void ReadFrom(istream &strm)
Input the contents of the URL from the stream.
bool defaultToUserIfNoAt
Definition: url.h:442
PStringOptions paramVars
Definition: url.h:373
static void SplitQueryVars(const PString &queryStr, PStringToString &queryVars)
Split a string in &= form to a dictionary of names and values.
Definition: url.h:206
virtual PBoolean IsEmpty() const
Determine if the string is empty.
PFactory< PURLLoader > PURLLoaderFactory
Definition: url.h:475
PBoolean LegacyParse(const PString &url, const PURLLegacyScheme *schemeInfo)
void SetPathStr(const PString &pathStr)
Set the path field of the URL as a string.
Translate to a string as a full URL.
Definition: url.h:133
#define PCLASSINFO(cls, par)
Declare all the standard PTLib class information.
Definition: object.h:1049
PURLLegacyScheme(const char *s, 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:401
PString m_contents
Definition: url.h:376
bool hasQuery
Definition: url.h:444
bool hasUsername
Definition: url.h:439
virtual PINDEX HashFunction() const
This function yields a hash value required by the PDictionary class.
const PStringOptions & GetQueryVars() const
Get the Query (?) field of the URL as a string dictionary.
Definition: url.h:308
void SetHostName(const PString &hostname)
Set the hostname field of the URL.
PString scheme
Definition: url.h:438
PURL & operator=(const PURL &other)
TranslationType
Type for translation of strings to URL format,.
Definition: url.h:159
PBoolean Parse(const char *cstr, const char *defaultScheme=NULL)
Parse the URL string into the fields in the object instance.
Definition: url.h:120
PString username
Definition: url.h:366
bool hasHostPort
Definition: url.h:441
Translate the parameter variables field for a URL.
Definition: url.h:167
This is a dictionary collection class of PString objects, keyed by another string.
Definition: pstring.h:2784
This class describes a full description for a file on the particular platform.
Definition: filepath.h:65
void SetUserName(const PString &username)
Set the username field of the URL.
virtual Comparison Compare(const PObject &obj) const
Compare the two URLs and return their relative rank.
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:1184
PString fragment
Definition: url.h:374
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 PString &url, PURL &purl) const
Definition: url.h:429
This class is a variation of a string that ignores case.
Definition: pstring.h:1708
void SetParamVars(const PStringToString ¶mVars)
Set the parameter (;) field(s) of the URL as a string dictionary.
PBoolean Parse(const PString &str, const char *defaultScheme=NULL)
Parse the URL string into the fields in the object instance.
Definition: url.h:125
void AppendPath(const PString &segment)
Append segment to the path field of the URL.
const PStringOptions & GetParamVars() const
Get the parameter (;) field(s) of the URL as a string dictionary.
Definition: url.h:282
This is an array collection class of PString objects.
Definition: pstring.h:2024
void SetContents(const PString &str)
Set the contents of URL, data left after all elemetns are parsed out.
bool LoadResource(PString &data, const PString &requiredContentType=PString::Empty()) const
Get the resource the URL is pointing at.
const PString & GetFragment() const
Get the fragment (#) field of the URL.
Definition: url.h:297
PBoolean GetRelativePath() const
Get if path is relative or absolute.
Definition: url.h:257
Translate the quoted parameter variables field for a URL.
Definition: url.h:169
PString GetParameters() const
Get the parameter (;) field of the URL.
PString password
Definition: url.h:367
PString GetName() const
Definition: url.h:435
Translate the query variable field for a URL.
Definition: url.h:165
void SetQueryVar(const PString &key, const PString &data)
Set the Query (?) field of the URL as a string dictionary.
PBoolean IsEmpty() const
Return true if the URL is an empty string.
Definition: url.h:325
PBoolean GetPortSupplied() const
Get if explicit port is specified.
Definition: url.h:254
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.
BOOL PBoolean
Definition: object.h:102
const PString & GetUserName() const
Get the username field of the URL.
Definition: url.h:230
Translate to a string with scheme and host/port.
Definition: url.h:139
Array of unsigned characters.
Definition: array.h:670
const PCaselessString & GetHostName() const
Get the hostname field of the URL.
Definition: url.h:242
Specialised version of PStringToString to contain a dictionary of options/attributes.
Definition: pstring.h:2845
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.
bool hasParameters
Definition: url.h:445
void SetScheme(const PString &scheme)
Set the scheme field of the URL.
void SetPort(WORD newPort)
Set the port field in the URL.
Translate to a string as only path.
Definition: url.h:135
static PString TranslateString(const PString &str, TranslationType type)
Translate a string from general form to one that can be included into a URL.
PFilePath AsFilePath() const
Get the "file:" URL as a file path.
PFactory< PURLScheme > PURLSchemeFactory
Definition: url.h:392
void SetQuery(const PString &query)
Set the Query (?) field of the URL as a string.
PCaselessString scheme
Definition: url.h:365
bool OpenBrowser() const
Open the URL in a browser.
Definition: url.h:347
const PString & GetContents() const
Get the contents of URL, data left after all elemetns are parsed out.
Definition: url.h:319
PBoolean portSupplied
Definition: url.h:370
WORD GetPort() const
Get the port field of the URL.
Definition: url.h:248
PString urlString
Definition: url.h:363
The character string class.
Definition: pstring.h:108
PCaselessString hostname
Definition: url.h:368
static PString Empty()
Return an empty string.
PString AsString(PURL::UrlFormat fmt, const PURL &purl) const
Definition: url.h:432
bool hasPassword
Definition: url.h:440
const PCaselessString & GetScheme() const
Get the scheme field of the URL.
Definition: url.h:224
UrlFormat
Print/String output representation formats.
Definition: url.h:131
Template class for generic factories of an abstract class.
Definition: pfactory.h:144
void SetParamVar(const PString &key, const PString &data, bool emptyDataDeletes=true)
Set the parameter (;) field of the URL as a string dictionary.
PString GetQuery() const
Get the Query (?) field of the URL as a string.
PStringOptions queryVars
Definition: url.h:375
Translate a username/password field for a URL.
Definition: url.h:161
bool hasFragments
Definition: url.h:446
virtual void PrintOn(ostream &strm) const
Output the contents of the URL to the stream as a string.
bool hasPath
Definition: url.h:447
bool defaultHostToLocal
Definition: url.h:443
PString GetPathStr() const
Get the path field of the URL as a string.
void SetPassword(const PString &password)
Set the password field of the URL.
const PString & GetPassword() const
Get the password field of the URL.
Definition: url.h:236
PBoolean relativePath
port was supplied in string input
Definition: url.h:371
WORD defaultPort
Definition: url.h:449
void SetParameters(const PString ¶meters)
Set the parameter (;) field of the URL.
bool relativeImpliesScheme
Definition: url.h:448
const PStringArray & GetPath() const
Get the path field of the URL as a string array.
Definition: url.h:266
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
PString LegacyAsString(PURL::UrlFormat fmt, const PURLLegacyScheme *schemeInfo) const
This class describes a Universal Resource Locator.
Definition: url.h:54
PString AsString(UrlFormat fmt=FullURL) const
Convert the URL object into its string representation.
Translate to a string with no scheme or host.
Definition: url.h:137
void SetQueryVars(const PStringToString &queryVars)
Set the Query (?) field(s) of the URL as a string dictionary.
WORD port
Definition: url.h:369
PStringArray path
Definition: url.h:372
void CopyContents(const PURL &other)