📄 file.hpp
字号:
//// This file is part of the "More for C++" library//// Copyright (c) 1999-2003 by Thorsten Goertz (thorsten@morefor.org)//// The "More for C++" library is free software; you can redistribute it and/or// modify it under the terms of the license that comes with this package.//// Read "license.txt" for more details.//// THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED// WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES// OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.////////////////////////////////////////////////////////////////////////////////#ifndef MORE_OS_FILE_HPP#define MORE_OS_FILE_HPP////////////////////////////////////////////////////////////////////////////////#include <more/pointer.hpp>#include <more/string.hpp>#include <more/io/ioexception.hpp>#include <more/io/streams.hpp>////////////////////////////////////////////////////////////////////////////////namespace more{ namespace os { class Directory { public: class Entry { public: virtual String getName( ) throw( more::io::IOException ) = 0; virtual String getFullName( ) throw( more::io::IOException ) = 0; virtual String getExtension( ) throw( more::io::IOException ) = 0; virtual p<Entry> getParent( ) throw( more::io::IOException ) = 0; virtual bool isDirectory( ) throw( more::io::IOException ) = 0; virtual bool isReadOnly( ) throw( more::io::IOException ) = 0; virtual size_t getSize( ) throw( more::io::IOException ) = 0; protected: virtual ~Entry( ); }; static p<Directory> getCurrentDirectory( ); static p<Directory> create( const p<Directory>& pParent, const String& sName ); static p<Directory> create( const p<Entry>& pDescriptor ); static p<Directory> create( const String& sFullName ); virtual bool exists( ) throw( more::io::IOException ) = 0; virtual p<Entry> getDescriptor( ) throw( more::io::IOException ) = 0; virtual p<Directory> getParent( ) throw( more::io::IOException ) = 0; virtual p<Entry> getFirstEntry( ) throw( more::io::IOException ) = 0; virtual p<Entry> getNextEntry( ) throw( more::io::IOException ) = 0; protected: virtual ~Directory( ); }; //////////////////////////////////////////////////////////////////////// class File { public: enum AccessMode { WRITE_CREATE, WRITE_APPEND, READ_WRITE, READ_ONLY }; static p<File> create( const p<Directory>& pParent, const String& sName ); static p<File> create( const p<Directory::Entry>& pDescriptor ); static p<File> create( const String& sFullName ); virtual bool exists( ) throw( more::io::IOException ) = 0; virtual p<Directory::Entry> getDescriptor( ) throw( more::io::IOException ) = 0; virtual p<Directory> getParent( ) throw( more::io::IOException ) = 0; virtual void open( AccessMode ) throw( more::io::IOException ) = 0; virtual void close( ) throw( more::io::IOException ) = 0; virtual p<more::io::InputStream> getInputStream( ) throw( more::io::IOException ) = 0; virtual p<more::io::OutputStream> getOutputStream( ) throw( more::io::IOException ) = 0; protected: virtual ~File( ); }; }}////////////////////////////////////////////////////////////////////////////////#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -