![]() |
The Simons
|
00001 00002 // 00003 // SCL : Simons Component Library 00004 // 00006 // 00007 // Filename: NoElements.h 00008 // Contents: NoElements 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_NO_ELEMENTS 00020 #define SCL_NO_ELEMENTS 00021 00022 #include "MethodError.h" // Include my superclass type 00023 #include "NoElementsID.h" // Include my pointer type 00024 00025 #include "StringID.h" // Depend on the pointer type 00026 00038 00039 class NoElements : public MethodError { 00040 protected: 00041 ObjectID defaultElement; 00042 NoElements(const NoElements&); 00043 public: 00044 NoElements(); 00045 virtual ~NoElements(); 00046 NoElements(ObjectID, StringID); 00047 NoElements(ObjectID, StringID, ObjectID); 00048 virtual ObjectID clone() const; 00049 ObjectID element() const; 00050 }; 00051 00053 00056 inline ObjectID NoElements::element() const { return defaultElement; } 00057 00058 00060 00063 inline NoElementsID::NoElementsID() {} 00064 00066 inline NoElementsID::~NoElementsID() {} 00067 00071 inline NoElementsID::NoElementsID(const Null* null) : 00072 MethodErrorID(null) {} 00073 00077 inline NoElementsID::NoElementsID(const NoElements* exception) : 00078 MethodErrorID(exception) {} 00079 00083 inline NoElementsID::NoElementsID(const NoElementsID& pointer) : 00084 MethodErrorID(pointer) {} 00085 00089 inline NoElementsID& NoElementsID::operator=(const NoElements* exception) { 00090 assign(exception); 00091 return *this; 00092 } 00093 00098 inline NoElementsID& NoElementsID::operator=(const NoElementsID& pointer) { 00099 assign(pointer); 00100 return *this; 00101 } 00102 00103 00104 #endif 00105