- new (&filenames->iterator) Xapian::TermIterator ();
- new (&filenames->end) Xapian::TermIterator ();
-
- talloc_set_destructor (filenames, _notmuch_filenames_destructor);
-
- filenames->iterator = notmuch->xapian_db->allterms_begin (prefix);
- filenames->end = notmuch->xapian_db->allterms_end (prefix);
-
- filenames->prefix_len = strlen (prefix);
-
- filenames->filename = NULL;
-
- return filenames;
-}
-
-notmuch_bool_t
-notmuch_filenames_has_more (notmuch_filenames_t *filenames)
-{
- return (filenames->iterator != filenames->end);
-}
-
-const char *
-notmuch_filenames_get (notmuch_filenames_t *filenames)
-{
- if (filenames->filename == NULL) {
- std::string term = *filenames->iterator;
-
- filenames->filename = talloc_strdup (filenames,
- term.c_str () +
- filenames->prefix_len);
- }
-
- return filenames->filename;
-}
-
-void
-notmuch_filenames_advance (notmuch_filenames_t *filenames)
-{
- if (filenames->filename) {
- talloc_free (filenames->filename);
- filenames->filename = NULL;
- }
-
- if (filenames->iterator != filenames->end)
- filenames->iterator++;
-}
-
-void
-notmuch_filenames_destroy (notmuch_filenames_t *filenames)
-{
- talloc_free (filenames);