query: update query subsys to use Message

This commit is contained in:
Dirk-Jan C. Binnema
2022-04-28 22:58:15 +03:00
parent 95710edff4
commit 459f6db476
4 changed files with 62 additions and 48 deletions

View File

@ -28,6 +28,7 @@
#include <limits>
#include <ostream>
#include <cmath>
#include <memory>
#include <unistd.h>
#include <fcntl.h>
@ -303,9 +304,7 @@ public:
}
/**
* get the corresponding Message for this iter; this instance is owned
* by @this, and becomes invalid when iterating to the next, or @this is
* destroyed.; it's a 'floating' reference.
* get the corresponding Message for this iter
*
* @return a Message or Nothing
*/
@ -320,6 +319,19 @@ public:
Nothing);
}
/**
* get the corresponding Message for this iter a heap-allocated ptr;
*
* @return a unique ptr to a Message or P{}
*/
std::unique_ptr<Message> unique_message_ptr() const {
return xapian_try(
[&]()->std::unique_ptr<Message> {
return std::make_unique<Message>(Message(document()));
}, nullptr);
}
private:
Xapian::MSetIterator mset_it_;
QueryMatches& query_matches_;