#include <mcs.hh>
This class is capable (through CURL) to provide access to files both on local or remote file systems.
Definition at line 7811 of file mcs.hh.
Public Member Functions | |
void | Close () |
Terminates a file retrieval. | |
void | Download (string url, string fn) |
int | OpenAsFD (string url) |
Obtain a file descriptor to read the file passed as parameter. | |
const char * | OpenAsFifo (string url) |
Create a FIFO on file system to read from the specified file. | |
int | Read (char *buf, int maxlen) |
Read from the resource. | |
string | url () |
URLReader () | |
Constructor. | |
virtual | ~URLReader () |
Destructor. | |
Static Public Member Functions | |
static bool | chkLocal (string &url) |
Protected Member Functions | |
void | flush () |
virtual unsigned int | Write (void *ptr, unsigned int size, unsigned int nmemb) |
Writes a chunk of data into the pipe. | |
Private Member Functions | |
void | thread_fetch () |
Static Private Member Functions | |
static size_t | cb_write (void *ptr, size_t size, size_t nmemb, void *This) |
static int | thread_run (void *p) |
Private Attributes | |
bool | local |
If the URL refer to a resource on local filesystem. | |
string | lurl |
URL requested. | |
ThreadFunc * | thr |
Static Private Attributes | |
static bool | fl_curl_global_init = false |
True if curl_global_init has been called (must be called once). |
mcs::URLReader::URLReader | ( | ) |
mcs::URLReader::~URLReader | ( | ) | [virtual] |
void mcs::URLReader::Close | ( | ) |
Terminates a file retrieval.
This method closes the open file descriptor (if any) and terminates an open connection. Note that this method must be called once for each OpenAsFD() or OpenAsFile() call.
This method will raise an exception if an error occurred during file retrieval.
Definition at line 285 of file Readers.cc.
int mcs::URLReader::OpenAsFD | ( | string | url | ) |
Obtain a file descriptor to read the file passed as parameter.
Definition at line 237 of file Readers.cc.
const char * mcs::URLReader::OpenAsFifo | ( | string | url | ) |
Create a FIFO on file system to read from the specified file.
Definition at line 250 of file Readers.cc.
int mcs::URLReader::Read | ( | char * | buf, | |
int | maxlen | |||
) |
unsigned int mcs::URLReader::Write | ( | void * | ptr, | |
unsigned int | size, | |||
unsigned int | nmemb | |||
) | [protected, virtual] |
Writes a chunk of data into the pipe.
This method is called each time a new chunk of data is ready to be written in the write side of the pipe. This method can be ovverriden to implement custom filtering.
Definition at line 402 of file Readers.cc.
bool mcs::URLReader::fl_curl_global_init = false [static, private] |
bool mcs::URLReader::local [private] |
string mcs::URLReader::lurl [private] |
![]() |
MCS (My Customizable Server) ver. 0.3.3-alpha3
|