|
hgl 0.5.25
A compiler/interpreter suite for developing images
|
Class to access files locally and remote. More...
#include "uri.h"
Inherits std::istream.
Public Types | |
| typedef std::set< std::string > | PROTOCOLS |
| Set of supported protocols. | |
Public Member Functions | |
| URI (const char *const uri) throw (HGL::Exception::IOException) | |
Constructor More... | |
| URI (const char *const uri, const char *const mode) throw (HGL::Exception::IOException) | |
Constructor More... | |
| std::string | getProtocol () const |
| Gets the protocol. More... | |
| __off_t | getSize () const throw (HGL::Exception::IOException) |
| Gets the size in bytes of the file. More... | |
| std::string | getURI () const |
| Gets the URI. More... | |
| bool | isStdin () const |
Checks if this URI is attached to standard input. More... | |
| operator FILE * () const throw (HGL::Exception::IOException) | |
Gets the FILE file descriptor of the file. More... | |
| void | operator>> (std::string &s) const throw (HGL::Exception::IOException) |
Reads the entire file into a std::string. More... | |
| throw (HGL::Exception::IOException) | |
Constructor More... | |
Static Public Member Functions | |
| static const PROTOCOLS | getProtocols () |
| Gets a set of all supported protocols. More... | |
| static bool | isRemote (const std::string &uri) |
| Checks if the URI is a remote URI. More... | |
| static void | prefetch (const std::string &uri, const char *const mode) |
| Tries to prefetch a remote URL in background. More... | |
| static void | pushSearchPath (const std::string &searchPath, bool front=false) |
| Pushes a path to the directories to prepend if the file is not found. More... | |
Static Public Attributes | |
| static URI | STDIN |
an URI which points to stdin | |
Class to access files locally and remote.
This class handles the access of local files as well as remote files and from the standard input.
Since version 0.5.18 it implements std::istream and therefore can be used as input stream as well.
| URI::URI | ( | const char *const | uri | ) | |
| throw | ( | HGL::Exception::IOException | |||
| ) | |||||
| URI::URI | ( | const char *const | uri, |
| const char *const | mode | ||
| ) | |||
| throw | ( | HGL::Exception::IOException | |
| ) | |||
Constructor
| uri | URI to open |
| mode | open mode, i.e. "r" or "rb" |
| std::string URI::getProtocol | ( | ) | const |
|
static |
Gets a set of all supported protocols.
| __off_t URI::getSize | ( | ) | const | |
| throw | ( | HGL::Exception::IOException | ||
| ) | ||||
| std::string URI::getURI | ( | ) | const |
|
static |
| bool URI::isStdin | ( | ) | const |
Checks if this URI is attached to standard input.
true if attached to standard input, false otherwise | URI::operator FILE * | ( | ) | const | |
| throw | ( | HGL::Exception::IOException | ||
| ) | ||||
Gets the FILE file descriptor of the file.
FILE file descriptor | void URI::operator>> | ( | std::string & | s | ) | const |
| throw | ( | HGL::Exception::IOException | |||
| ) | |||||
Reads the entire file into a std::string.
| s | the std::string to read the entire file in |
|
static |
Tries to prefetch a remote URL in background.
If the file could be prefetches successfully, subsequent access to it won't be downloaded again, but the locally downloaded copy is accessed.
| uri | the URI to prefetch |
| mode | open mode, i.e. "r" or "rb" |
|
static |
Pushes a path to the directories to prepend if the file is not found.
| searchPath | the path to push to the serach patch list |
| front | if true, the path gets prepended as first search element |
| HGL::Common::URI::throw | ( | HGL::Exception::IOException | ) |
Constructor
| uri | URI to open |
| mode | open mode, i.e. "r" or "rb" |
1.8.5