From: Christian P. <cp...@us...> - 2004-12-30 17:07:10
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29275/src/System Modified Files: File.posix.cpp Log Message: Reordered ctor/open() args. Removed std::string ctor/open() method. Added default args for ctor and open(). Index: File.posix.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/File.posix.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- File.posix.cpp 24 Dec 2004 17:15:51 -0000 1.6 +++ File.posix.cpp 30 Dec 2004 17:07:00 -0000 1.7 @@ -91,21 +91,12 @@ _handle = (unsigned long)handle; } -File::File(const Unicode::String& name, OpenMode omode, AccessMode amode, - ShareMode smode) throw(IO::IOError) -: _handle((unsigned long)-1) -{ - open(name,omode,amode,smode); -} - -#ifdef PCLASSES_WITH_STL -File::File(const std::string& name, OpenMode omode, AccessMode amode, +File::File(const Unicode::String& name, AccessMode amode, OpenMode omode, ShareMode smode) throw(IO::IOError) : _handle((unsigned long)-1) { - open(name,omode,amode,smode); + open(name,amode,omode,smode); } -#endif File::~File() throw() { @@ -115,37 +106,14 @@ } } -void File::open(const Unicode::String& name, OpenMode omode, AccessMode amode, - ShareMode smode) throw(LogicError, IO::IOError) -{ - if(!valid()) - { - /*@fixme - int flags = OpenMode2Flags(omode) | AccessMode2Flags(amode); - int handle = ::open(name.utf8(), flags); - if(handle == -1) - throw IO::IOError(errno, "Could not open file", P_SOURCEINFO); - - _handle = (unsigned long)handle; - IODevice::setAccess(amode); - IODevice::setValid(true); - IODevice::setEof(false);*/ - - return; - } - - throw LogicError("File is already open", P_SOURCEINFO); -} - -#ifdef PCLASSES_WITH_STL -void File::open(const std::string& name, OpenMode omode, AccessMode amode, +void File::open(const Unicode::String& name, AccessMode amode, OpenMode omode, ShareMode smode) throw(LogicError, IO::IOError) { if(!valid()) { int flags = OpenMode2Flags(omode) | AccessMode2Flags(amode); - int handle = ::open(name.c_str(), flags); + int handle = ::open(name.utf8().c_str(), flags, 0644); if(handle == -1) throw IO::IOError(errno, "Could not open file", P_SOURCEINFO); @@ -159,7 +127,6 @@ throw LogicError("File is already open", P_SOURCEINFO); } -#endif void File::close() throw(LogicError, IO::IOError) { |