InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
URI Class Reference

#include <URI.h>

Public Types

enum  Component {
  kScheme = 0, kAuthority, kPath, kQuery,
  kFragment
}
 
typedef object_type data_type
 

Public Member Functions

 URI ()
 
 URI (const std::string &uri)
 
 URI (const WideString &uri)
 
 URI (const URI &uri)
 
virtual ~URI ()
 
URIoperator= (const URI &rhs)
 
bool operator== (const URI &rhs) const
 
bool operator!= (const URI &rhs) const
 
bool operator< (const URI &rhs) const
 
bool SetURI (const std::string &uri)
 
std::string GetURI () const
 
bool SetURIW (const WideString &uri)
 
WideString GetURIW () const
 
void ClearURI ()
 
bool VerifyURI (Component *badComponent=nil) const
 
bool HasComponent (Component component) const
 
void SetComponent (Component component, const WideString &value)
 
WideString GetComponent (Component component) const
 
void RemoveComponent (Component component)
 
void ReadWrite (IPMStream *s)
 

Detailed Description

InDesign class used to construct and parse a well formed Uniform Resource Identifier (URI). The class supports the generic URI syntax that consists of a hierarchical sequence of components referred to as the scheme, authority, path, query, and fragment. The scheme and path components are required, though the path may be empty (no characters).

When the authority component is present, the path must either be empty or begin with a slash ("/") character. When authority is not present, the path cannot begin with two slash characters ("//"). The current implementation does not distinguish an authority based on a registered name or server address, the optional port and user information. It is left up to the user to extract the aforementioned sub-components from the authority.

For more information on the syntax of a URI, see: {http://www.gbiv.com/protocols/uri/rfc/rfc3986.html}

Member Enumeration Documentation

Identifiers that denote a URI component. \ The identifiers are used to get, set and remove components from the URI.
Enumerator
kScheme 

URI's scheme component.

kAuthority 

URI's authority component.

kPath 

URI's path component.

kQuery 

URI's query component.

kFragment 

URI's fragment component.

Constructor & Destructor Documentation

URI::URI ()

Default constructor. Constructs an empty URI object.

URI::URI (const std::string & uri)

Constructor. Constructs an URI object from the given URI string.

Parameters
uri[IN] URI encoded string.
URI::URI (const WideStringuri)

Constructor. Constructs an URI object from the given URI WideString.

Parameters
uri[IN] URI encoded WideString.
URI::URI (const URIuri)

Copy constructor. Constructs an URI object that is a copy of the given URI.

Parameters
name[IN] URI object to copy.
virtual URI::~URI ()
virtual

Destructor. Destroys the URI object.

Member Function Documentation

void URI::ClearURI ()

Clears the URI.

WideString URI::GetComponent (Component component) const

Returns the value of the specified URI component.

Parameters
component[IN] URI component to get.
Returns
URI component's value. \ The returned string is not in URI encoding, and does not include the URI delimiter specific to the component. \ If an empty string is returned, call HasComponent() to determine if the component value is empty or not set.
std::string URI::GetURI () const

Gets the URI as a string.

Returns
URI as a URI encoded string. \ An empty string if the URI scheme and path are not set.
WideString URI::GetURIW () const

Gets the URI as a WideString.

Returns
URI as a URI encoded WideString. \ An empty string if the URI scheme and path are not set.
bool URI::HasComponent (Component component) const

Determines whether the URI contains the specified component.

Parameters
component[IN] URI component to check for.
Returns
kTrue if the URI contains the component; else kFalse.
bool URI::operator!= (const URIrhs) const

Non-equality operator. Test whether this URI is not equal to the given URI.

Parameters
rhs[IN] URI to test for non-equality against this URI.
Returns
True if this URI is not equal to the given URI, else false.
bool URI::operator< (const URIrhs) const

Less than operator. Test whether this URI is less than the given URI.

Parameters
rhs[IN] URI to test against this URI.
Returns
True if this URI is less than the given URI, else false.
URI& URI::operator= (const URIrhs)

Assignment operator. Assigns the given URI to this URI.

Parameters
rhs[IN] URI to assign to this URI.
Returns
Reference to this URI.
bool URI::operator== (const URIrhs) const

Equality operator. Test whether this URI is equal to the given URI.

Parameters
rhs[IN] URI to test for equality against this URI.
Returns
True if this URI is equal to the given URI, else false.
void URI::ReadWrite (IPMStreams)

Persistence-related method for saving or restoring the state of an URI object instance.

Parameters
iPMStream[IN] Stream to read the instance data from or write the instance data to.
void URI::RemoveComponent (Component component)

Removes the specified component from the URI.

Parameters
component[IN] URI component to remove.
void URI::SetComponent (Component component,
const WideStringvalue 
)

Sets the value of the specified URI component.

Parameters
component[IN] URI component to set.
value[IN] String containing the value to set specified URI component to. \ The string should not be in URI encoding, nor include the URI delimiter specific to the component.
bool URI::SetURI (const std::string & uri)

Sets the URI from a string.

Parameters
uri[IN] URI encoded string.
Returns
True if the string contained a valid URI, else false.
bool URI::SetURIW (const WideStringuri)

Sets the URI from a WideString.

Parameters
uri[IN] URI encoded WideString.
Returns
True if the string contained a valid URI, else false.
bool URI::VerifyURI (ComponentbadComponent = nil) const

Verifies that the URI conforms to the URI specification.

Parameters
badComponent[OUT] Optional argument; if not nil, set to the first non-conforming component found in the URI.
Returns
True if the URI conforms to the URI specification, else false.