/** * librdf_iterator_get_object - Get the current object from the iterator * @iterator: the &librdf_iterator object * * Return value: The next element or NULL if the iterator has finished. **/ void* librdf_iterator_get_object(librdf_iterator* iterator) { if(iterator->is_finished) return NULL; return librdf_iterator_update_current_element(iterator); }
/** * librdf_iterator_end - Test if the iterator has finished * @iterator: the &librdf_iterator object * * Return value: non 0 if the iterator has finished **/ int librdf_iterator_end(librdf_iterator* iterator) { if(!iterator || iterator->is_finished) return 1; librdf_iterator_update_current_element(iterator); return iterator->is_finished; }
/** * librdf_iterator_get_value - Get the value of the current object on the iterator * @iterator: the &librdf_iterator object * * Return value: The context or NULL if the iterator has finished. **/ void* librdf_iterator_get_value(librdf_iterator* iterator) { if(iterator->is_finished) return NULL; if(!librdf_iterator_update_current_element(iterator)) return NULL; return iterator->get_method(iterator->context, LIBRDF_ITERATOR_GET_METHOD_GET_VALUE); }
/** * librdf_iterator_get_context: * @iterator: the #librdf_iterator object * * Get the context of the current object on the iterator. * * This method returns a SHARED pointer to the current context node object * which should be copied by the caller to preserve it if the iterator * is moved on librdf_iterator_next or if it should last after the * iterator is closed. * * Return value: The context (can be NULL) or NULL if the iterator has finished. **/ void* librdf_iterator_get_context(librdf_iterator* iterator) { if(iterator->is_finished) return NULL; /* Update current element only if we are not already in the middle of the element update process. Allows inspection of context in iterator map callbacks. */ if(!iterator->is_updating && !librdf_iterator_update_current_element(iterator)) return NULL; return iterator->get_method(iterator->context, LIBRDF_ITERATOR_GET_METHOD_GET_CONTEXT); }
/** * librdf_iterator_next - Move to the next iterator element * @iterator: the &librdf_iterator object * * Return value: non 0 if the iterator has finished **/ int librdf_iterator_next(librdf_iterator* iterator) { if(!iterator || iterator->is_finished) return 1; if(iterator->next_method(iterator->context)) { iterator->is_finished=1; return 1; } iterator->is_updated=0; librdf_iterator_update_current_element(iterator); return iterator->is_finished; }