conexus/except_open.h

00001 /***************************************************************************
00002 *   Copyright (C) 2001 by Rick L. Vinyard, Jr.                            *
00003 *   rvinyard@cs.nmsu.edu                                                  *
00004 *                                                                         *
00005 *   This program is free software; you can redistribute it and/or modify  *
00006 *   it under the terms of the GNU Lesser General Public License as        *
00007 *   published by the Free Software Foundation version 2.1.                *
00008 *                                                                         *
00009 *   This program is distributed in the hope that it will be useful,       *
00010 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012 *   GNU General Public License for more details.                          *
00013 *                                                                         *
00014 *   You should have received a copy of the GNU Lesser General Public      *
00015 *   License along with this library; if not, write to the                 *
00016 *   Free Software Foundation, Inc.,                                       *
00017 *   51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA              *
00018 ***************************************************************************/
00019 #ifndef CONEXUSEXCEPT_OPEN_H
00020 #define CONEXUSEXCEPT_OPEN_H
00021 
00022 #include <conexus/except.h>
00023 
00024 namespace Conexus
00025 {
00026 
00032   class open_exception: public conexus_exception
00033   {
00034     public:
00035       open_exception( int e = 0 ) : conexus_exception( ::strerror(e), e, "open" )
00036       { }
00037       open_exception( const std::string s, int e = 0 ) : conexus_exception( ::strerror(e), e, "open" )
00038       { }
00039   }
00040   ;
00041 
00042   namespace exception
00043   {
00044 
00045 
00046     namespace open
00047     {
00048 
00055       class protocol_not_supported: public open_exception
00056       {
00057         public:
00058           protocol_not_supported() : open_exception( "The protocol type or the specified protocol is not supported within this domain.", EPROTONOSUPPORT )
00059           { }
00060       }
00061       ;
00062 
00068       class af_not_supported: public open_exception
00069       {
00070         public:
00071           af_not_supported() : open_exception( "The implementation does not support the specified address family.", EAFNOSUPPORT )
00072           { }
00073       }
00074       ;
00075 
00081       class system_file: public open_exception
00082       {
00083         public:
00084           system_file() : open_exception( "The system limit on the total number of open files has been reached.", ENFILE )
00085           { }
00086       }
00087       ;
00088 
00094       class process_file: public open_exception
00095       {
00096         public:
00097           process_file() : open_exception( "The process already has the maximum number of files open.", EMFILE )
00098           { }
00099       }
00100       ;
00101 
00107       class access: public open_exception
00108       {
00109         public:
00110           access() : open_exception( "Permission to access the file or create a socket of the specified type and/or protocol is denied.", EACCES )
00111           { }
00112       }
00113       ;
00114 
00121       class no_memory: public open_exception
00122       {
00123         public:
00124           no_memory() : open_exception( "Insufficient memory is available. The socket cannot be created until sufficient resources are freed.", ENOBUFS )
00125           { }
00126       }
00127       ;
00128 
00134       class invalid_protocol: public open_exception
00135       {
00136         public:
00137           invalid_protocol() : open_exception( "Unknown protocol, or protocol family not available.", EINVAL )
00138           { }
00139       }
00140       ;
00141 
00147       class exists: public open_exception
00148       {
00149         public:
00150           exists() : open_exception( "File already exists and O_CREAT and O_EXCL were used.", EEXIST )
00151           { }
00152       }
00153       ;
00154 
00160       class fault: public open_exception
00161       {
00162         public:
00163           fault() : open_exception( "File path points outside your accessible address space.", EFAULT )
00164           { }
00165       }
00166       ;
00167 
00174       class is_directory: public open_exception
00175       {
00176         public:
00177           is_directory() : open_exception( "Pathname refers to a directory and the access requested involved writing (that is, O_WRONLY or O_RDWR is set).", EISDIR )
00178           { }
00179       }
00180       ;
00181 
00188       class loop: public open_exception
00189       {
00190         public:
00191           loop() : open_exception( "Too many symbolic links were encountered in resolving pathname, or O_NOFOLLOW was specified but pathname was a symbolic link.", ELOOP )
00192           { }
00193       }
00194       ;
00195 
00201       class name_too_long: public open_exception
00202       {
00203         public:
00204           name_too_long() : open_exception( "Pathname was too long.", ENAMETOOLONG )
00205           { }
00206       }
00207       ;
00208 
00216       class no_device: public open_exception
00217       {
00218         public:
00219           no_device() : open_exception( "pathname refers to a device special file and no corresponding device exists.", ENODEV )
00220           { }
00221       }
00222       ;
00223 
00231       class no_exist: public open_exception
00232       {
00233         public:
00234           no_exist() : open_exception( "O_CREAT  is  not  set and the named file does not exist.  Or, a directory component in pathname does not exist or is a dangling symbolic link.", ENOENT )
00235           { }
00236       }
00237       ;
00238 
00245       class no_space: public open_exception
00246       {
00247         public:
00248           no_space() : open_exception( "pathname was to be created but the device containing pathname has no room for the new file.", ENOSPC )
00249           { }
00250       }
00251       ;
00252 
00260       class not_directory: public open_exception
00261       {
00262         public:
00263           not_directory() : open_exception( "A component used as a directory in pathname is not, in fact, a directory, or O_DIRECTORY was specified and pathname was  not  a directory.", ENOTDIR )
00264           { }
00265       }
00266       ;
00267 
00275       class no_io: public open_exception
00276       {
00277         public:
00278           no_io() : open_exception( "O_NONBLOCK  | O_WRONLY is set, the named file is a FIFO and no process has the file open for reading.  Or, the file is a device special file and no corresponding device exists.", ENXIO )
00279           { }
00280       }
00281       ;
00282 
00289       class file_too_large: public open_exception
00290       {
00291         public:
00292           file_too_large() : open_exception( "pathname refers to a regular file, too large to be opened; see O_LARGEFILE above.", EOVERFLOW )
00293           { }
00294       }
00295       ;
00296 
00304       class no_permission: public open_exception
00305       {
00306         public:
00307           no_permission() : open_exception( "The O_NOATIME flag was specified, but the effective user ID of the caller did not match the owner of the file  and  the  caller was not privileged (CAP_FOWNER).", EPERM )
00308           { }
00309       }
00310       ;
00311 
00318       class read_only: public open_exception
00319       {
00320         public:
00321           read_only() : open_exception( "pathname refers to a file on a read-only filesystem and write access was requested.", EROFS )
00322           { }
00323       }
00324       ;
00325 
00332       class executable_busy: public open_exception
00333       {
00334         public:
00335           executable_busy() : open_exception( "pathname refers to an executable image which is currently being executed and write access was requested.", ETXTBSY )
00336           { }
00337       }
00338       ;
00339 
00346       class would_block: public open_exception
00347       {
00348         public:
00349           would_block() : open_exception( "The O_NONBLOCK flag was specified, and an incompatible lease was held on the file.", EWOULDBLOCK )
00350           { }
00351       }
00352       ;
00353 
00359       class no_device_set: public open_exception
00360       {
00361         public:
00362           no_device_set() : open_exception( "open requested and device not available or not set.", -1 )
00363           { }
00364       }
00365       ;
00366 
00372       class no_filename: public open_exception
00373       {
00374         public:
00375           no_filename() : open_exception( "open requested on file, but filename not set or file not found.", -1 )
00376           { }
00377       }
00378       ;
00379 
00385       class no_rd_wr_rdwr: public open_exception
00386       {
00387         public:
00388           no_rd_wr_rdwr() : open_exception( "open requires read, write or read/write mode, but none was given", -1 )
00389           { }
00390       }
00391       ;
00392 
00393     }
00394 
00395 
00396   }
00397 }
00398 
00399 #endif // CONEXUSCREATE_ERROR_H

Generated on Tue Mar 13 19:54:43 2007 by  doxygen 1.5.1