sprint 1-alpha
sprint/io/xstream/tools.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 *   sprint::xstream
00003 *
00004 *   Copyright (C) 2005-2011  Paolo Medici <www.pmx.it>
00005 *
00006 *  This library is free software; you can redistribute it and/or
00007 *  modify it under the terms of the GNU Lesser General Public
00008 *  License as published by the Free Software Foundation; either
00009 *  version 2.1 of the License, or (at your option) any later version.
00010 *
00011 *  This library is distributed in the hope that it will be useful,
00012 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 *  Lesser General Public License for more details.
00015 *
00016 *  You should have received a copy of the GNU Lesser General Public
00017 *  License along with this library; if not, write to the Free Software
00018 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00019 *
00020 *******************************************************************************/
00021 #ifndef _XSTREAM_TOOLS_H
00022 #define _XSTREAM_TOOLS_H
00023 
00027 namespace sprint {
00028   namespace io {
00029 
00031     struct url_t {
00032            const char *proto;
00033            const char *username;
00034            const char *password;
00035            const char *path;
00036            const char *name;
00037            const char *options;
00038            };
00039            
00041          typedef xstream * (* xProtocolCallback)(const url_t & url, void *param);
00042          typedef xstream * (* xExtensionCallback)(xstream *parent, void *param);
00043 
00045      void register_protocol(const char *proto, xProtocolCallback proc, void *param);
00046      
00048          void register_extension(const char *extension, xExtensionCallback proc, void *param);
00049 
00052         xfolder * open_folder_from_url(const url_t & url);
00053         xfolder * open_folder_from_url(const char * url);
00054 
00057         xstream * open_stream_from_url(const url_t & url);
00058         xstream * open_stream_from_url(const char * url);       
00059         
00060 /* TODO: spostarli in un altro file **/
00061 
00064         unsigned int copy(xstream * src, xstream * dst);
00065         
00067         bool readline(xstream * src, std::string & str, char eol);
00069         bool readline(xstream * src, char *buf, int buf_size, char eol);
00070 
00071   }
00072 }
00073 
00074 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines