Changeset 1163:030601407a72


Ignore:
Timestamp:
02/22/09 15:14:50 (3 years ago)
Author:
niam
Branch:
libdodo
Message:

io::string moved to io::memory(issue #5)

Location:
trunk
Files:
5 edited
5 moved

Legend:

Unmodified
Added
Removed
  • trunk/Makefile.in

    r1161 r1163  
    5959        ioNetworkServer.o \ 
    6060        ioNetworkClient.o \ 
    61         ioString.o \ 
     61        ioMemory.o \ 
    6262        rpcValue.o \ 
    6363        rpcMethod.o \ 
  • trunk/configure

    r1140 r1163  
    1075710757## 
    1075810758 
    10759 ac_config_files="$ac_config_files Makefile bin/dodo-config tests/Makefile tests/image_test/Makefile tests/cgifast_test/Makefile tests/cgi_test/Makefile tests/dbmysql_test/Makefile tests/dbpostgresql_test/Makefile tests/dbsqlite_test/Makefile tests/db_test/Makefile tests/iononblocked_ionetwork_test/Makefile tests/iononblocked_ionetworkssl_test/Makefile tests/iostdio_test/Makefile tests/iofile_toolsfilesystem_test/Makefile tests/iostring_test/Makefile tests/iopipe_iofilefifo_pcthreadcollection_test/Makefile tests/ionetwork_pcthreads_test/Makefile tests/ionetworkclient_test/Makefile tests/ionetworkserver_test/Makefile tests/ionetworksslserver_test/Makefile tests/ionetworksslclient_test/Makefile tests/ionetworkhttp_test/Makefile tests/pcthreadcollection_test/Makefile tests/pcprocesscollection_test/Makefile tests/pcjobcollection_test/Makefile tests/toolsnetwork_test/Makefile tests/toolsos_test/Makefile tests/toolstime_test/Makefile tests/toolsmisc_test/Makefile tests/toolscode_test/Makefile tests/toolslogger_test/Makefile tests/toolslibrary_test/Makefile tests/toolsregexp_test/Makefile tests/xexec_test/Makefile tests/rpcxmlhttpclient_test/Makefile tests/rpcxmlcgiserver_test/Makefile tests/rpcjsonhttpclient_test/Makefile tests/rpcjsoncgiserver_test/Makefile tests/dataformatjson_test/Makefile tests/dataformatxml_test/Makefile" 
     10759ac_config_files="$ac_config_files Makefile bin/dodo-config tests/Makefile tests/image_test/Makefile tests/cgifast_test/Makefile tests/cgi_test/Makefile tests/dbmysql_test/Makefile tests/dbpostgresql_test/Makefile tests/dbsqlite_test/Makefile tests/db_test/Makefile tests/iononblocked_ionetwork_test/Makefile tests/iononblocked_ionetworkssl_test/Makefile tests/iostdio_test/Makefile tests/iofile_toolsfilesystem_test/Makefile tests/iomemory_test/Makefile tests/iopipe_iofilefifo_pcthreadcollection_test/Makefile tests/ionetwork_pcthreads_test/Makefile tests/ionetworkclient_test/Makefile tests/ionetworkserver_test/Makefile tests/ionetworksslserver_test/Makefile tests/ionetworksslclient_test/Makefile tests/ionetworkhttp_test/Makefile tests/pcthreadcollection_test/Makefile tests/pcprocesscollection_test/Makefile tests/pcjobcollection_test/Makefile tests/toolsnetwork_test/Makefile tests/toolsos_test/Makefile tests/toolstime_test/Makefile tests/toolsmisc_test/Makefile tests/toolscode_test/Makefile tests/toolslogger_test/Makefile tests/toolslibrary_test/Makefile tests/toolsregexp_test/Makefile tests/xexec_test/Makefile tests/rpcxmlhttpclient_test/Makefile tests/rpcxmlcgiserver_test/Makefile tests/rpcjsonhttpclient_test/Makefile tests/rpcjsoncgiserver_test/Makefile tests/dataformatjson_test/Makefile tests/dataformatxml_test/Makefile" 
    1076010760 
    1076110761 
     
    1138311383    "tests/iostdio_test/Makefile") CONFIG_FILES="$CONFIG_FILES tests/iostdio_test/Makefile" ;; 
    1138411384    "tests/iofile_toolsfilesystem_test/Makefile") CONFIG_FILES="$CONFIG_FILES tests/iofile_toolsfilesystem_test/Makefile" ;; 
    11385     "tests/iostring_test/Makefile") CONFIG_FILES="$CONFIG_FILES tests/iostring_test/Makefile" ;; 
     11385    "tests/iomemory_test/Makefile") CONFIG_FILES="$CONFIG_FILES tests/iomemory_test/Makefile" ;; 
    1138611386    "tests/iopipe_iofilefifo_pcthreadcollection_test/Makefile") CONFIG_FILES="$CONFIG_FILES tests/iopipe_iofilefifo_pcthreadcollection_test/Makefile" ;; 
    1138711387    "tests/ionetwork_pcthreads_test/Makefile") CONFIG_FILES="$CONFIG_FILES tests/ionetwork_pcthreads_test/Makefile" ;; 
  • trunk/configure.in

    r1161 r1163  
    769769                                tests/iostdio_test/Makefile 
    770770                                tests/iofile_toolsfilesystem_test/Makefile 
    771                                 tests/iostring_test/Makefile 
     771                                tests/iomemory_test/Makefile 
    772772                                tests/iopipe_iofilefifo_pcthreadcollection_test/Makefile 
    773773                                tests/ionetwork_pcthreads_test/Makefile 
  • trunk/include/libdodo/exceptionBasic.h

    r1160 r1163  
    113113                        ERRMODULE_IOPIPE, 
    114114                        ERRMODULE_IOSTDIO, 
    115                         ERRMODULE_IOSTRING, 
     115                        ERRMODULE_IOMEMORY, 
    116116                        ERRMODULE_IONETWORKCONNECTION, 
    117117                        ERRMODULE_IONETWORKCLIENT, 
  • trunk/include/libdodo/ioMemory.h

    r1160 r1163  
    11/*************************************************************************** 
    2  *            ioString.h 
     2 *            ioMemory.h 
    33 * 
    44 *  Tue Oct 8 08:19:57 2005 
     
    2828 */ 
    2929 
    30 #ifndef _IOSTRING_H_ 
    31 #define _IOSTRING_H_ 1 
     30#ifndef _IOMEMORY_H_ 
     31#define _IOMEMORY_H_ 1 
    3232 
    3333#include <libdodo/directives.h> 
     
    3939#include <libdodo/types.h> 
    4040#include <libdodo/ioChannel.h> 
    41 #include <libdodo/ioStringEx.h> 
     41#include <libdodo/ioMemoryEx.h> 
    4242 
    4343namespace dodo 
     
    4646        { 
    4747                /** 
    48                  * @class string 
    49                  * @brief provides string I/O manipulations 
     48                 * @class memory 
     49                 * @brief provides memory I/O manipulations 
    5050                 * @note if blockOffset is false then read/write position is amount of bytes from the beginning, if true then: 
    5151                 * writeStream, writeStream write only to the end of the file(append) 
    5252                 * write offset for write, write is calculated as pos*outSize 
    5353                 * read offset for read, read is calculated as pos*inSize 
    54                  * read offset for readStream, readStream is calculated as pos*'# of \n - terminated strings' 
     54                 * read offset for readStream, readStream is calculated as pos*'# of \n - terminated memorys' 
    5555                 */ 
    56                 class string : virtual public channel 
     56                class memory : virtual public channel 
    5757                { 
    5858                  public: 
     
    6161                         * constructor 
    6262                         */ 
    63                         string(); 
     63                        memory(); 
    6464 
    6565                        /** 
     
    6767                         * @note xexec object is not copied 
    6868                         */ 
    69                         string(const string &fd); 
     69                        memory(const memory &fd); 
    7070 
    7171                        /** 
     
    7373                         * @note xexec object is not copied 
    7474                         */ 
    75                         string(const dodoString &data); 
     75                        memory(const dodoString &data); 
    7676 
    7777                        /** 
    7878                         * destructor 
    7979                         */ 
    80                         virtual ~string(); 
     80                        virtual ~memory(); 
    8181 
    8282                        /** 
     
    8585                         * @note xexec object is not copied 
    8686                         */ 
    87                         virtual void clone(const string &fd); 
     87                        virtual void clone(const memory &fd); 
    8888 
    8989                        /** 
     
    102102 
    103103                        /** 
    104                          * @return string 
     104                         * @return memory 
    105105                         */ 
    106106                        operator const dodoString &(); 
    107107 
    108108                        /** 
    109                          * @return string 
     109                         * @return memory 
    110110                         */ 
    111111                        operator const char*(); 
     
    131131 
    132132                        /** 
    133                          * read from stream - '\0' or '\n' - terminated string 
     133                         * read from stream - '\0' or '\n' - terminated memory 
    134134                         * @param data defines buffer that will be filled 
    135135                         * @note not more then inSize(including '\0') 
    136                          * if blockOffset is true read offset is calculated as pos*'# of \n - terminated strings' otherwise offset it taken pos bytes from the beginning 
     136                         * if blockOffset is true read offset is calculated as pos*'# of \n - terminated memorys' otherwise offset it taken pos bytes from the beginning 
    137137                         */ 
    138138                        virtual unsigned long _readStream(char * const data); 
     
    145145 
    146146                        /** 
    147                          * write to stream - '\0' - terminated string 
     147                         * write to stream - '\0' - terminated memory 
    148148                         * @param data defines data that will be written 
    149149                         * @note write only to the end of the file(append) 
  • trunk/include/libdodo/ioMemoryEx.h

    r1160 r1163  
    11/*************************************************************************** 
    2  *            ioStringEx.h 
     2 *            ioMemoryEx.h 
    33 * 
    44 *  Mon Feb 21 03:03:47 2005 
     
    2828 */ 
    2929 
    30 #ifndef _IOSTRINGEX_H_ 
    31 #define _IOSTRINGEX_H_ 1 
     30#ifndef _IOMEMORYEX_H_ 
     31#define _IOMEMORYEX_H_ 1 
    3232 
    3333#include <libdodo/directives.h> 
     
    4242                 * libdodo defined errors 
    4343                 */ 
    44                 enum stringExR 
     44                enum memoryExR 
    4545                { 
    46                         STRINGEX_CANTBEUSEDWITHIOEVENT, 
    47                         STRINGEX_OUTOFBOUNDS, 
     46                        MEMORYEX_CANTBEUSEDWITHIOEVENT, 
     47                        MEMORYEX_OUTOFBOUNDS, 
    4848                }; 
    4949 
     
    5151                 * explanations for libdodo defined errors 
    5252                 */ 
    53 #define IOSTRINGEX_CANTBEUSEDWITHIOEVENT_STR                  "io::string can not be used with io::event." 
    54 #define IOSTRINGEX_OUTOFBOUNDS_STR                  "Access data out of bounds." 
     53#define IOMEMORYEX_CANTBEUSEDWITHIOEVENT_STR        "io::memory can not be used with io::event." 
     54#define IOMEMORYEX_OUTOFBOUNDS_STR                  "Access data out of bounds." 
    5555 
    5656                /** 
    5757                 * IDs of functions where exception might be thrown 
    5858                 */ 
    59                 enum stringFunctionsID 
     59                enum memoryFunctionsID 
    6060                { 
    61                         STRINGEX__READ, 
    62                         STRINGEX_GETINDESCRIPTOR, 
    63                         STRINGEX_GETOUTDESCRIPTOR, 
     61                        MEMORYEX__READ, 
     62                        MEMORYEX_GETINDESCRIPTOR, 
     63                        MEMORYEX_GETOUTDESCRIPTOR, 
    6464                }; 
    6565        }; 
  • trunk/include/libdodo/xexec.h

    r1160 r1163  
    5858                XEXEC_OBJECT_IOFILEFIFO, 
    5959                XEXEC_OBJECT_IOPIPE, 
    60                 XEXEC_OBJECT_IOSTRING, 
     60                XEXEC_OBJECT_IOMEMORY, 
    6161                XEXEC_OBJECT_IONETWORKCLIENT, 
    6262                XEXEC_OBJECT_IONETWORKSERVER, 
  • trunk/src/ioMemory.cc

    r1162 r1163  
    11/*************************************************************************** 
    2  *            ioString.cc 
     2 *            ioMemory.cc 
    33 * 
    44 *  Wed Oct 8 01:44:18 2005 
     
    2828 */ 
    2929 
    30 #include <libdodo/ioString.h> 
     30#include <libdodo/ioMemory.h> 
    3131 
    3232using namespace dodo::io; 
    3333 
    34 string::string() : pos(0), 
     34memory::memory() : pos(0), 
    3535                                   blockOffset(false), 
    3636                                   append(false) 
     
    3838#ifndef IO_WO_XEXEC 
    3939 
    40         collectedData.setExecObject(XEXEC_OBJECT_IOSTRING); 
     40        collectedData.setExecObject(XEXEC_OBJECT_IOMEMORY); 
    4141 
    4242#endif 
     
    4545//------------------------------------------------------------------- 
    4646 
    47 string::string(const string &fd) : pos(fd.pos), 
     47memory::memory(const memory &fd) : pos(fd.pos), 
    4848                                                                   blockOffset(fd.blockOffset), 
    4949                                                                   append(fd.append), 
     
    6262//------------------------------------------------------------------- 
    6363 
    64 string::string(const dodoString &data) : pos(0), 
     64memory::memory(const dodoString &data) : pos(0), 
    6565                                                                                 blockOffset(false), 
    6666                                                                                 append(false), 
     
    7676//------------------------------------------------------------------- 
    7777 
    78 string::~string() 
     78memory::~memory() 
    7979{ 
    8080} 
     
    8383 
    8484int 
    85 string::getInDescriptor() const 
    86 { 
    87         throw exception::basic(exception::ERRMODULE_IOSTRING, STRINGEX_GETINDESCRIPTOR, exception::ERRNO_LIBDODO, STRINGEX_CANTBEUSEDWITHIOEVENT, IOSTRINGEX_CANTBEUSEDWITHIOEVENT_STR, __LINE__, __FILE__); 
     85memory::getInDescriptor() const 
     86{ 
     87        throw exception::basic(exception::ERRMODULE_IOMEMORY, MEMORYEX_GETINDESCRIPTOR, exception::ERRNO_LIBDODO, MEMORYEX_CANTBEUSEDWITHIOEVENT, IOMEMORYEX_CANTBEUSEDWITHIOEVENT_STR, __LINE__, __FILE__); 
    8888 
    8989        return -1; 
     
    9393 
    9494int 
    95 string::getOutDescriptor() const 
    96 { 
    97         throw exception::basic(exception::ERRMODULE_IOSTRING, STRINGEX_GETOUTDESCRIPTOR, exception::ERRNO_LIBDODO, STRINGEX_CANTBEUSEDWITHIOEVENT, IOSTRINGEX_CANTBEUSEDWITHIOEVENT_STR, __LINE__, __FILE__); 
     95memory::getOutDescriptor() const 
     96{ 
     97        throw exception::basic(exception::ERRMODULE_IOMEMORY, MEMORYEX_GETOUTDESCRIPTOR, exception::ERRNO_LIBDODO, MEMORYEX_CANTBEUSEDWITHIOEVENT, IOMEMORYEX_CANTBEUSEDWITHIOEVENT_STR, __LINE__, __FILE__); 
    9898 
    9999        return -1; 
     
    103103 
    104104void 
    105 string::flush() 
    106 { 
    107 } 
    108  
    109 //------------------------------------------------------------------- 
    110  
    111 string::operator const dodoString 
     105memory::flush() 
     106{ 
     107} 
     108 
     109//------------------------------------------------------------------- 
     110 
     111memory::operator const dodoString 
    112112& () 
    113113{ 
     
    117117//------------------------------------------------------------------- 
    118118 
    119 string::operator const char 
     119memory::operator const char 
    120120*() 
    121121{ 
     
    126126 
    127127void 
    128 string::clone(const string &fd) 
     128memory::clone(const memory &fd) 
    129129{ 
    130130        pc::sync::protector pg(keeper); 
     
    142142 
    143143void 
    144 string::_read(char * const a_data) 
     144memory::_read(char * const a_data) 
    145145{ 
    146146        unsigned long pos = blockOffset ? this->pos * inSize : this->pos; 
     
    148148        if ((pos + inSize) > buffer.size()) 
    149149        { 
    150                 throw exception::basic(exception::ERRMODULE_IOSTRING, STRINGEX__READ, exception::ERRNO_LIBDODO, STRINGEX_OUTOFBOUNDS, IOSTRINGEX_OUTOFBOUNDS_STR, __LINE__, __FILE__); 
     150                throw exception::basic(exception::ERRMODULE_IOMEMORY, MEMORYEX__READ, exception::ERRNO_LIBDODO, MEMORYEX_OUTOFBOUNDS, IOMEMORYEX_OUTOFBOUNDS_STR, __LINE__, __FILE__); 
    151151        } 
    152152 
     
    159159 
    160160void 
    161 string::_write(const char *const a_data) 
     161memory::_write(const char *const a_data) 
    162162{ 
    163163        if (append) 
     
    182182 
    183183void 
    184 string::erase() 
     184memory::erase() 
    185185{ 
    186186        pc::sync::protector pg(keeper); 
     
    200200 
    201201unsigned long 
    202 string::_readStream(char * const a_data) 
     202memory::_readStream(char * const a_data) 
    203203{ 
    204204        unsigned long readSize = inSize + 1; 
     
    263263 
    264264void 
    265 string::_writeStream(const char *const a_data) 
     265memory::_writeStream(const char *const a_data) 
    266266{ 
    267267        unsigned long _outSize = outSize; 
  • trunk/tests/iomemory_test/test.cc

    r1146 r1163  
    66 
    77#include <libdodo/exceptionBasic.h> 
    8 #include <libdodo/ioString.h> 
     8#include <libdodo/ioMemory.h> 
    99#include <libdodo/toolsCode.h> 
    1010 
     
    2121        try 
    2222        { 
    23                 io::string io; 
     23                io::memory io; 
    2424                io.blockOffset = true; 
    2525 
     
    2929                io.writeStream("!12345890$!!@\n"); 
    3030 
    31                 io::string io2 = io; 
     31                io::memory io2 = io; 
    3232 
    3333                io2.pos = 1; 
Note: See TracChangeset for help on using the changeset viewer.