Support large opds result listings without an OOM
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include <Print.h>
|
||||
#include <expat.h>
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -73,24 +74,13 @@ class OpdsParser final : public Print {
|
||||
|
||||
operator bool() { return !error(); }
|
||||
|
||||
/**
|
||||
* Get the parsed entries (both navigation and book entries).
|
||||
* @return Vector of OpdsEntry entries
|
||||
*/
|
||||
const std::vector<OpdsEntry>& getEntries() const& { return entries; }
|
||||
std::vector<OpdsEntry> getEntries() && { return std::move(entries); }
|
||||
|
||||
/**
|
||||
* Get only book entries (legacy compatibility).
|
||||
* @return Vector of book entries
|
||||
*/
|
||||
std::vector<OpdsEntry> getBooks() const;
|
||||
|
||||
/**
|
||||
* Clear all parsed entries.
|
||||
*/
|
||||
void clear();
|
||||
|
||||
std::function<void(OpdsEntry)> onEntryParsed;
|
||||
|
||||
private:
|
||||
// Expat callbacks
|
||||
static void XMLCALL startElement(void* userData, const XML_Char* name, const XML_Char** atts);
|
||||
@@ -105,7 +95,6 @@ class OpdsParser final : public Print {
|
||||
static const char* findAttribute(const XML_Char** atts, const char* name);
|
||||
|
||||
XML_Parser parser = nullptr;
|
||||
std::vector<OpdsEntry> entries;
|
||||
OpdsEntry currentEntry;
|
||||
std::string currentText;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user