00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "eyedb_p.h"
00026
00027 namespace eyedb {
00028
00029
00030 ClassIterator::ClassIterator(const Class *cls, Bool subclass)
00031 {
00032 init(cls, subclass);
00033 }
00034
00035 ClassIterator::ClassIterator(const ClassPtr &cls_ptr, Bool subclass)
00036 {
00037 init(cls_ptr.getClass(), subclass);
00038 }
00039
00040 void ClassIterator::init(const Class *cls, Bool subclass)
00041 {
00042 q = new Iterator(const_cast<Class*>(cls), subclass);
00043 status = q->getStatus();
00044 if (status) {
00045 delete q;
00046 q = 0;
00047
00048
00049 }
00050 }
00051
00052 Bool ClassIterator::next(Oid &oid)
00053 {
00054 if (status)
00055 throw *status;
00056 Bool found;
00057 status = q->scanNext(found, oid);
00058 if (status)
00059 throw *status;
00060 return found;
00061 }
00062
00063 Bool ClassIterator::next(ObjectPtr &o_ptr, const RecMode *rcm)
00064 {
00065 Object *o = 0;
00066 Bool b = next(o, rcm);
00067 o_ptr = o;
00068 return b;
00069 }
00070
00071 Bool ClassIterator::next(Object *&o, const RecMode *rcm)
00072 {
00073 if (status)
00074 throw *status;
00075 Bool found;
00076 o = 0;
00077 status = q->scanNext(found, o, rcm);
00078 if (status)
00079 throw *status;
00080 return found;
00081 }
00082
00083 Bool ClassIterator::next(Value &v)
00084 {
00085 if (status)
00086 throw *status;
00087 Bool found;
00088 status = q->scanNext(found, v);
00089 if (status) throw *status;
00090 return found;
00091 }
00092
00093
00094 ClassIterator::~ClassIterator()
00095 {
00096 delete q;
00097 }
00098
00099 }