![]() |
The Simons
|
00001 00002 // 00003 // SCL : Simons Component Library 00004 // 00006 // 00007 // Filename: OutOfRange.h 00008 // Contents: OutOfRange class, signalling invalid access 00009 // Author: Anthony J H Simons 00010 // Revised: 30 November 2005 00011 00012 // This software is distributed free in the hope that others will 00013 // find it useful. However, it comes WITHOUT ANY WARRANTY. No 00014 // liability can be accepted for software failure, merchantability 00015 // or fitness for a particular purpose. You can redistribute this 00016 // software in its original form, or in a modified form, provided 00017 // that this disclaimer is retained in the file banner. 00018 00019 #ifndef SCL_OUT_OF_RANGE 00020 #define SCL_OUT_OF_RANGE 00021 00022 #include "MethodError.h" // Include my superclass type 00023 #include "OutOfRangeID.h" // Include my pointer type 00024 00025 #include "StringID.h" // Depend on the pointer type 00026 00036 00037 class OutOfRange : public MethodError { 00038 protected: 00039 Integer failedIndex; 00040 OutOfRange(const OutOfRange&); 00041 public: 00042 OutOfRange(); 00043 virtual ~OutOfRange(); 00044 OutOfRange(ObjectID, StringID, Integer); 00045 virtual ObjectID clone() const; 00046 Integer index() const; 00047 }; 00048 00050 00053 inline Integer OutOfRange::index() const { return failedIndex; } 00054 00055 00057 00060 inline OutOfRangeID::OutOfRangeID() {} 00061 00063 inline OutOfRangeID::~OutOfRangeID() {} 00064 00068 inline OutOfRangeID::OutOfRangeID(const Null* null) : 00069 MethodErrorID(null) {} 00070 00074 inline OutOfRangeID::OutOfRangeID(const OutOfRange* exception) : 00075 MethodErrorID(exception) {} 00076 00080 inline OutOfRangeID::OutOfRangeID(const OutOfRangeID& pointer) : 00081 MethodErrorID(pointer) {} 00082 00086 inline OutOfRangeID& OutOfRangeID::operator=(const OutOfRange* exception) { 00087 assign(exception); 00088 return *this; 00089 } 00090 00095 inline OutOfRangeID& OutOfRangeID::operator=(const OutOfRangeID& pointer) { 00096 assign(pointer); 00097 return *this; 00098 } 00099 00100 00101 #endif 00102