> The XQuery Processor
00001 /* 00002 * Copyright 2006-2008 The FLWOR Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #ifndef ZORBA_ITERATOR_API_H 00017 #define ZORBA_ITERATOR_API_H 00018 00019 #include <zorba/config.h> 00020 #include <zorba/api_shared_types.h> 00021 #include <zorba/item_sequence.h> 00022 00023 namespace zorba { 00024 00025 /** \brief Interface for an Iterator over an instance of the XML Data Model. 00026 * 00027 * Note: This class is reference counted. When writing multi-threaded clients, 00028 * it is the responibility of the client code to synchronize assignments to the 00029 * SmartPtr holding this object. 00030 */ 00031 class ZORBA_EXTERN_DECL Iterator : public ItemSequence, public SmartObject 00032 { 00033 public: 00034 /** \brief Destructor 00035 */ 00036 virtual ~Iterator() {} 00037 00038 /** \brief Start iterating 00039 * 00040 * This function needs to be called before calling next. 00041 * @throw ZorbaException if an error occurs. 00042 */ 00043 virtual void 00044 open() = 0; 00045 00046 /** \brief Get the next Item of the sequence. 00047 * @param aItem the next Item of the result sequence if true is returned by the function. 00048 * @return true if the sequence is not exhausted, false otherwise. 00049 * @throw ZorbaException if an error occurs during query execution or the Iterator has 00050 * not been opened. 00051 */ 00052 virtual bool 00053 next(Item& aItem) = 0; 00054 00055 /** \brief Stop iterating. 00056 * 00057 * In order to call Iterator::next, open has to been called. 00058 */ 00059 virtual void 00060 close() = 0; 00061 00062 }; 00063 00064 } /* namespace zorba */ 00065 #endif