UriTranslator¶
-
class
kanzi::connect
::
UriTranslator
¶ A class that allows to translate pre-formatted URIs that follow special syntax to local and file server URIs that can be used to retrieve data.
Public Functions
-
UriTranslator
()¶
-
virtual
~UriTranslator
()¶ Destructor.
-
void
clearHostAddress
(const string &name)¶ Remove host.
Host is no longer used when translating URIs.
- Parameters
name – Name of the host to remove.
-
void
setHostAddress
(const string &name, const string &ip)¶ Set host address that can be used when uris are translated.
- Parameters
name – Name of the host.
ip – IP address of the host.
-
string
translate
(const string &uri, bool encode)¶ Translates uri to local or file server uri.
- Parameters
uri – URI to translate.
encode – To encode URI (remove spaces, and so on) set to True. To keep intact, set to False.
- Returns
Translated URI, or original if there is no need to translate.
Public Static Functions
-
static bool
needsTranslation
(const string &uri, bool &needsEncoding)¶ Check if given string is URI that needs an address translation to be usable.
- Parameters
uri – string to check
- Returns
True if UriTranslator::translate should be called on the given string to turn it into usable URI
-
static void
upcaseHostName
(string &uri)¶ Ensures the symbolic hostname, for example <server>, is uppercase in the URI.
- Parameters
uri – the uri to be processed.
-