mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-31 14:01:59 +00:00
Add new method Objects::swap
This commit is contained in:
parent
83fc18af09
commit
9e03dc54cc
@ -391,7 +391,7 @@ class QPDF
|
|||||||
void replaceObject(int objid, int generation, QPDFObjectHandle);
|
void replaceObject(int objid, int generation, QPDFObjectHandle);
|
||||||
|
|
||||||
// Swap two objects given by ID. Prior to qpdf 10.2.1, existing QPDFObjectHandle instances that
|
// Swap two objects given by ID. Prior to qpdf 10.2.1, existing QPDFObjectHandle instances that
|
||||||
// reference them objects not notice the swap, but this was fixed in 10.2.1.
|
// reference the objects did not notice the swap, but this was fixed in 10.2.1.
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
void swapObjects(QPDFObjGen const& og1, QPDFObjGen const& og2);
|
void swapObjects(QPDFObjGen const& og1, QPDFObjGen const& og2);
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
|
@ -882,7 +882,13 @@ QPDF::copyStreamData(QPDFObjectHandle result, QPDFObjectHandle foreign)
|
|||||||
void
|
void
|
||||||
QPDF::swapObjects(int objid1, int generation1, int objid2, int generation2)
|
QPDF::swapObjects(int objid1, int generation1, int objid2, int generation2)
|
||||||
{
|
{
|
||||||
swapObjects(QPDFObjGen(objid1, generation1), QPDFObjGen(objid2, generation2));
|
m->objects.swap(QPDFObjGen(objid1, generation1), QPDFObjGen(objid2, generation2));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
QPDF::swapObjects(QPDFObjGen const& og1, QPDFObjGen const& og2)
|
||||||
|
{
|
||||||
|
m->objects.swap(og1, og2);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long long
|
unsigned long long
|
||||||
|
@ -1779,12 +1779,12 @@ Objects::erase(QPDFObjGen og)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
QPDF::swapObjects(QPDFObjGen const& og1, QPDFObjGen const& og2)
|
Objects::swap(QPDFObjGen og1, QPDFObjGen og2)
|
||||||
{
|
{
|
||||||
// Force objects to be read from the input source if needed, then swap them in the cache.
|
// Force objects to be read from the input source if needed, then swap them in the cache.
|
||||||
m->objects.resolve(og1);
|
resolve(og1);
|
||||||
m->objects.resolve(og2);
|
resolve(og2);
|
||||||
m->objects.obj_cache[og1].object->swapWith(m->objects.obj_cache[og2].object);
|
obj_cache[og1].object->swapWith(obj_cache[og2].object);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
|
@ -445,6 +445,8 @@ class QPDF::Objects
|
|||||||
|
|
||||||
void replace(QPDFObjGen og, QPDFObjectHandle oh);
|
void replace(QPDFObjGen og, QPDFObjectHandle oh);
|
||||||
|
|
||||||
|
void swap(QPDFObjGen og1, QPDFObjGen og2);
|
||||||
|
|
||||||
std::map<QPDFObjGen, Entry> obj_cache;
|
std::map<QPDFObjGen, Entry> obj_cache;
|
||||||
|
|
||||||
QPDFObjectHandle readObjectInStream(std::shared_ptr<InputSource>& input, int obj);
|
QPDFObjectHandle readObjectInStream(std::shared_ptr<InputSource>& input, int obj);
|
||||||
|
Loading…
Reference in New Issue
Block a user