From: Christian P. <cp...@us...> - 2004-12-23 04:32:28
|
Update of /cvsroot/pclasses/pclasses2/src/IO In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14702/src/IO Added Files: IODevice.cpp IOError.cpp Makefile.am Log Message: Moved IODevice, IOError into P::IO namespace. Moved Char, String, TextStream into P::Unicode namespace. --- NEW FILE: Makefile.am --- INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include $(all_includes) METASOURCES = AUTO lib_LTLIBRARIES = libpclasses_io.la libpclasses_io_la_SOURCES = IOError.cpp IODevice.cpp libpclasses_io_la_LIBADD = $(top_builddir)/src/libpclasses.la $(top_builddir)/src/Unicode/libpclasses_unicode.la --- NEW FILE: IOError.cpp --- /*************************************************************************** * Copyright (C) 2004 by Christian Prochnow * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 of the * * License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "pclasses/IO/IOError.h" namespace P { namespace IO { IOError::IOError(long errorNo, const char* what, const SourceInfo& si) throw() : RuntimeError(what, si), _errorNo(errorNo) { } IOError::IOError(const IOError& err) throw() : RuntimeError(err), _errorNo(err._errorNo) { } IOError::~IOError() throw() { } long IOError::errorNo() const throw() { return _errorNo; } Unicode::String IOError::text() const throw() { //@todo return the real system error text return Unicode::String(); } } // !namespace IO } // !namespace P --- NEW FILE: IODevice.cpp --- /*************************************************************************** * Copyright (C) 2004 by Christian Prochnow * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 of the * * License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "pclasses/IO/IODevice.h" namespace P { namespace IO { IODevice::IODevice() throw() : _valid(false), _access(None), _eof(true) { } IODevice::IODevice(const IODevice& dev) throw() : _valid(dev._valid), _access(dev._access), _eof(dev._eof) { } IODevice::~IODevice() throw() { } IODevice::AccessMode IODevice::access() const throw() { return _access; } size_t IODevice::peek(char* buffer, size_t count) throw(IOError) { return 0; } bool IODevice::isSeekable() const throw() { return false; } offset_t IODevice::seek(offset_t offset, SeekMode mode) throw(IOError) { throw IOError(0, "Could not seek on device", P_SOURCEINFO); } offset_t IODevice::getPos() throw(IOError) { return seek(0, SeekCurrent); } void IODevice::commit() const throw(IOError) { } offset_t IODevice::size() const throw(IOError) { return 0; } bool IODevice::valid() const throw() { return _valid; } bool IODevice::eof() const throw() { return _eof; } void IODevice::setValid(bool v) throw() { _valid = v; } void IODevice::setAccess(AccessMode mode) throw() { _access = mode; } void IODevice::setEof(bool eof) throw() { _eof = eof; } void IODevice::addListener(IOListener& l) { } void IODevice::updateListener(IOListener& l) { } void IODevice::removeListener(IOListener& l) { } IODevice& IODevice::operator=(const IODevice& dev) throw() { _valid = dev._valid; _access = dev._access; _eof = dev._eof; } IOListener::IOListener(IODevice& dev, int eventMask) throw() : _dev(&dev), _eventMask(eventMask) { dev.addListener(*this); } IOListener::~IOListener() throw() { if(_dev) _dev->removeListener(*this); } IODevice& IOListener::device() const throw() { return *_dev; } void IOListener::setDevice(IODevice& dev) throw() { if(_dev) _dev->removeListener(*this); _dev = &dev; _dev->addListener(*this); } int IOListener::eventMask() const throw() { return _eventMask; } void IOListener::setEventMask(int eventMask) throw() { _eventMask = eventMask; } } // !namespace IO } // !namespace P |