Add removeObject() method to parser
This commit is contained in:
parent
c5ce75b9ee
commit
6060d12344
|
@ -81,6 +81,11 @@ namespace uPDFParser
|
|||
*/
|
||||
void addObject(Object* object) { _objects.push_back(object); }
|
||||
|
||||
/**
|
||||
* @brief Remove an object from list and crefTable
|
||||
*/
|
||||
void removeObject(Object* object);
|
||||
|
||||
/**
|
||||
* @brief Return trailer object
|
||||
*/
|
||||
|
@ -88,7 +93,7 @@ namespace uPDFParser
|
|||
|
||||
/**
|
||||
* @brief Return xref table. This table is read and updated only once after parse
|
||||
* Further add/delete will make it incoherent
|
||||
* It's not used for write operation
|
||||
*/
|
||||
const std::vector<XRefValue>& xrefTable() {return _xrefTable;}
|
||||
|
||||
|
|
|
@ -847,6 +847,21 @@ namespace uPDFParser
|
|||
}
|
||||
}
|
||||
|
||||
void Parser::removeObject(Object* object)
|
||||
{
|
||||
std::vector<Object*>::iterator it;
|
||||
|
||||
for(it = _objects.begin(); it != _objects.end(); it++)
|
||||
{
|
||||
if (**it == *object)
|
||||
{
|
||||
delete *it;
|
||||
_objects.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Parser::writeBuffer(int fd, const char* buffer, int size)
|
||||
{
|
||||
int ret;
|
||||
|
|
Loading…
Reference in New Issue
Block a user