sprint 1-alpha
Classes | Typedefs | Enumerations | Functions
sprint::io Namespace Reference

the sprint::io namespace, which contains API to read and write from various device More...

Classes

class  bzip2
 bzip2 stream file More...
class  gzip
 gzip file library More...
class  mem
class  null
 an IO who does nothing More...
class  serial
 a serial (es RS232) communication object More...
class  stdiofile
class  tar
class  xadapter
struct  url_t
 This struct contain any information able to open a xstream. More...
class  xfolder
 A single device. More...
class  gzipf
class  xsocket
class  xstream
 a virtual IO class More...
struct  right
class  xtar
 single tar file instance More...
class  xtarf
 Scrive un TAR facendo buffering e legge (solo sequenziale) attraverso un xs::xstream (unimplemented yet) More...
class  xzip

Typedefs

typedef detail::file< false > file_handle
 a file handle (can be copied and destroy not close the handle)
typedef detail::file< true > file
 a file (cannot be copied and destroy close the handle)
typedef mem< true > dynamic_buffer
 dynamic buffer (buffer is responsible of release memory)
typedef mem< false > const_buffer
 const buffer (user is responsible of release memory)
typedef int file_size_t
 32 bit file size: put here a 64 bit integer to switch to 64 bit version
typedef xstream *(* xProtocolCallback )(const url_t &url, void *param)
typedef xstream *(* xExtensionCallback )(xstream *parent, void *param)
typedef xadapter< bzip2xbzip2
typedef xadapter
< sprint::io::file
xfile
typedef xadapter< ftpxftp
typedef xadapter< gzipxgzip
 a xstream wrapper for sprint::io::gzip
typedef xadapter< http > xhttp
typedef xadapter
< sprint::io::mem< true > > 
xmem
typedef xadapter
< sprint::io::mem< false > > 
xconst_mem
typedef xadapter< nullxnull
typedef xadapter
< sprint::io::serial
xserial
typedef xadapter< stdiofilexstdiofile
typedef void * zipFile

Enumerations

enum  flag_t {
  def = 0, read = 1, write = 2, readwrite = 3,
  append = 4, create = 8
}
 Implement - Indipendent.
enum  state_t { unimplemented = 2, eof = -1, good = 0, error = 1 }
 return on state
enum  seek_t { start = 0, cur = 1, end = 2 }
 return on state
enum  caps_t { can_read = 1 << 0, can_write = 1 << 1, can_seek = 1 << 2, can_size = 1 << 3 }
 stream capabilities More...
enum  StreamProto { tcp, udp }
 xsocket protocol selector

Functions

BOOL Win32_Serial_Write (HANDLE hComm, const char *lpBuf, DWORD dwToWrite)
 win32 helper function to write on a serial in thread safe mode
DWORD Win32_Serial_Read (HANDLE hComm, char *buffer, DWORD buffer_lenght)
 win32 helper function to read from a serial in thread safe mode
void register_protocol (const char *proto, xProtocolCallback proc, void *param)
 Register a xstream factory protocol based associated with proto.
void register_extension (const char *extension, xExtensionCallback proc, void *param)
 Register a xstream factory extension based associated with extension.
xfolderopen_folder_from_url (const url_t &url)
xfolderopen_folder_from_url (const char *url)
xstreamopen_stream_from_url (const url_t &url)
xstreamopen_stream_from_url (const char *url)
unsigned int copy (xstream *src, xstream *dst)
bool readline (xstream *src, std::string &str, char eol)
bool readline (xstream *src, char *buf, int buf_size, char eol)
xstreamoperator<< (xstream &out, const const_buffer &c)
 put a buffer on stream
xstreamoperator<< (xstream &out, char c)
 put a single character on the stream
xstreamoperator<< (xstream &out, const char *str)
 put a string on the stream
xstreamoperator<< (xstream &out, const std::string &str)
 put a string on the stream
xstreamfill (xstream &out, int len, char c)
xstreamoperator<< (xstream &out, const right &r)

Detailed Description

the sprint::io namespace, which contains API to read and write from various device


Typedef Documentation

an xstream that works an user buffer

a virtual IO that use native and unbuffered file

Open a (native) file for write:

     sprint::io::xfile out("out.png", sprint::io::write);

an xstream capable of store data in memory instead on hard device using a dynamic buffer

typedef xstream*(* sprint::io::xProtocolCallback)(const url_t &url, void *param)

TODO: spostarli in un altro file

a virtual IO for a serial device

     sprint::io::xserial serial_line("COM1");
typedef void* sprint::io::zipFile

reserved


Enumeration Type Documentation

stream capabilities

Enumerator:
can_read 

Stream can read data.

can_write 

Stream can write data.

can_seek 

Stream can random access data.

can_size 

Stream can give the file size.


Function Documentation

unsigned int sprint::io::copy ( xstream *  src,
xstream *  dst 
)

copy all data from stream src to the stream dst

Returns:
number of bytes copied
xfolder* sprint::io::open_folder_from_url ( const url_t &  url)

create a xfolder from a url

Parameters:
urlis not a resource but a folder
xstream* sprint::io::open_stream_from_url ( const url_t &  url)

create an xstream from a url

Parameters:
urlhave to be a resource
bool sprint::io::readline ( xstream *  src,
char *  buf,
int  buf_size,
char  eol 
)

load a line from src in buf until eol

bool sprint::io::readline ( xstream *  src,
std::string &  str,
char  eol 
)

load a line from src in str until eol

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines