mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-02 22:50:20 +00:00
Tweak Handlers::json_handlers
Use std::vector instead of list and move shared pointers
This commit is contained in:
parent
b85a590bc5
commit
dca5927ba0
@ -59,7 +59,7 @@ namespace
|
|||||||
|
|
||||||
void beginUnderOverlay(JSON const& j);
|
void beginUnderOverlay(JSON const& j);
|
||||||
|
|
||||||
std::list<std::shared_ptr<JSONHandler>> json_handlers;
|
std::vector<std::shared_ptr<JSONHandler>> json_handlers;
|
||||||
bool partial;
|
bool partial;
|
||||||
JSONHandler* jh{nullptr}; // points to last of json_handlers
|
JSONHandler* jh{nullptr}; // points to last of json_handlers
|
||||||
std::shared_ptr<QPDFJob::Config> c_main;
|
std::shared_ptr<QPDFJob::Config> c_main;
|
||||||
@ -100,7 +100,7 @@ Handlers::bindJSON(void (Handlers::*f)(JSON))
|
|||||||
void
|
void
|
||||||
Handlers::initHandlers()
|
Handlers::initHandlers()
|
||||||
{
|
{
|
||||||
this->json_handlers.push_back(std::make_shared<JSONHandler>());
|
this->json_handlers.emplace_back(std::make_shared<JSONHandler>());
|
||||||
this->jh = this->json_handlers.back().get();
|
this->jh = this->json_handlers.back().get();
|
||||||
jh->addDictHandlers(
|
jh->addDictHandlers(
|
||||||
[](std::string const&, JSON) {},
|
[](std::string const&, JSON) {},
|
||||||
@ -184,8 +184,9 @@ Handlers::pushKey(std::string const& key)
|
|||||||
{
|
{
|
||||||
auto new_jh = std::make_shared<JSONHandler>();
|
auto new_jh = std::make_shared<JSONHandler>();
|
||||||
this->jh->addDictKeyHandler(key, new_jh);
|
this->jh->addDictKeyHandler(key, new_jh);
|
||||||
this->json_handlers.push_back(new_jh);
|
|
||||||
this->jh = new_jh.get();
|
this->jh = new_jh.get();
|
||||||
|
this->json_handlers.emplace_back(std::move(new_jh));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -205,8 +206,9 @@ Handlers::beginArray(json_handler_t start_fn, bare_handler_t end_fn)
|
|||||||
[end_fn](std::string const&) { end_fn(); },
|
[end_fn](std::string const&) { end_fn(); },
|
||||||
item_jh);
|
item_jh);
|
||||||
jh->addFallbackHandler(item_jh);
|
jh->addFallbackHandler(item_jh);
|
||||||
this->json_handlers.push_back(item_jh);
|
|
||||||
this->jh = item_jh.get();
|
this->jh = item_jh.get();
|
||||||
|
this->json_handlers.emplace_back(std::move(item_jh));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user