Foxit PDF SDK
|
Public Types | |
enum | Type { e_Dests = 1, e_JavaScript = 2, e_EmbeddedFiles = 3 } |
Enumeration for name tree type. More... | |
Public Member Functions | |
PDFNameTree (const PDFDoc &document, Type type) | |
Constructor, with parameters. More... | |
PDFNameTree () | |
Constructor. | |
PDFNameTree (const PDFNameTree &other) | |
Constructor, with another PDF name tree object. More... | |
~PDFNameTree () | |
Destructor. | |
bool | Add (const WString &name, objects::PDFObject *pdf_object) |
Add a new key name with a PDF object as its value. More... | |
int | GetCount () |
Get the count of elements in current name tree. More... | |
WString | GetName (int index) |
Get a key name in the name tree, by index. More... | |
objects::PDFObject * | GetObj (const WString &name) |
Get the value (as PDF object) of a specified key name. More... | |
Type | GetType () |
Get the type of current name tree. More... | |
bool | HasName (const WString &name) |
Check if the specified key name exists in current name tree. More... | |
bool | IsEmpty () const |
Check whether current object is empty or not. More... | |
bool | operator!= (const PDFNameTree &other) const |
Not equal operator. More... | |
PDFNameTree & | operator= (const PDFNameTree &other) |
Assign operator. More... | |
bool | operator== (const PDFNameTree &other) const |
Equal operator. More... | |
bool | RemoveAllObjs () |
Remove all key names from current name tree, along with theirs value (as PDF object). More... | |
bool | RemoveObj (const WString &name) |
Remove a key name from current name tree, along with its value (as PDF object). More... | |
bool | Rename (const WString &old_name, const WString &new_name) |
Rename an existing key name to a new key name. More... | |
bool | SetObj (const WString &name, objects::PDFObject *pdf_object) |
Set the value (as PDF object) of a specified key name. More... | |
![]() | |
FS_HANDLE | Handle () const |
Get the handle of current object. More... | |
Name tree is a kind of common data structure in PDF. Name tree serves a similar purpose to PDF dictionary
Constructor, with parameters.
If there exists name tree with specified type in the PDF document, this function is just to construct a PDF name tree object to be associated with the name tree. If there is no such name tree in PDF document, the constructed PDF name tree object can be used to create such name tree in PDF document and add items to the name tree.
[in] | document | A valid PDF document object. |
[in] | type | The type of the name tree. Please refer to values starting from PDFNameTree::e_Dests and this should be one of these values. |
foxit::pdf::objects::PDFNameTree::PDFNameTree | ( | const PDFNameTree & | other | ) |
Constructor, with another PDF name tree object.
[in] | other | Another PDF name tree object. |
bool foxit::pdf::objects::PDFNameTree::Add | ( | const WString & | name, |
objects::PDFObject * | pdf_object | ||
) |
Add a new key name with a PDF object as its value.
All PDF objects in the name tree are ordered by their names. When a new PDF object is added, Foxit PDF SDK will find a suitable place in the name tree to add it. After adding successfully, the indexes of some old keys may be changed.
[in] | name | String for a new key name. This should not be an empty string. This new name should not have existed in current name tree. |
[in] | pdf_object | A PDF object, to be set with the new name. The type of this PDF object should match current name tree; otherwise, the input PDF object is invalid. Please refer to comment of class PDFNameTree for more details. User should not release this PDF object after this function succeeds. |
int foxit::pdf::objects::PDFNameTree::GetCount | ( | ) |
Get the count of elements in current name tree.
WString foxit::pdf::objects::PDFNameTree::GetName | ( | int | index | ) |
Get a key name in the name tree, by index.
[in] | index | Index of the key name to be retrieved. Valid range: from 0 to (count-1). count is returned by function PDFNameTree::GetCount. |
objects::PDFObject* foxit::pdf::objects::PDFNameTree::GetObj | ( | const WString & | name | ) |
Get the value (as PDF object) of a specified key name.
[in] | name | String for a key name. It should not be an empty string. |
Type foxit::pdf::objects::PDFNameTree::GetType | ( | ) |
Get the type of current name tree.
bool foxit::pdf::objects::PDFNameTree::HasName | ( | const WString & | name | ) |
Check if the specified key name exists in current name tree.
[in] | name | A string that represents the key name to be checked. It should not be an empty string. |
bool foxit::pdf::objects::PDFNameTree::IsEmpty | ( | ) | const |
Check whether current object is empty or not.
When the current object is empty, that means current object is useless.
bool foxit::pdf::objects::PDFNameTree::operator!= | ( | const PDFNameTree & | other | ) | const |
Not equal operator.
[in] | other | Another PDF name tree object. This function will check if current object is not equal to this one. |
PDFNameTree& foxit::pdf::objects::PDFNameTree::operator= | ( | const PDFNameTree & | other | ) |
Assign operator.
[in] | other | Another PDF name tree object, whose value would be assigned to current object. |
bool foxit::pdf::objects::PDFNameTree::operator== | ( | const PDFNameTree & | other | ) | const |
Equal operator.
[in] | other | Another PDF name tree object. This function will check if current object is equal to this one. |
bool foxit::pdf::objects::PDFNameTree::RemoveAllObjs | ( | ) |
Remove all key names from current name tree, along with theirs value (as PDF object).
bool foxit::pdf::objects::PDFNameTree::RemoveObj | ( | const WString & | name | ) |
Remove a key name from current name tree, along with its value (as PDF object).
If the input name does not exist in current name tree, this function will return true directly.
[in] | name | String for a key name to be removed. This should not be an empty string. |
bool foxit::pdf::objects::PDFNameTree::Rename | ( | const WString & | old_name, |
const WString & | new_name | ||
) |
Rename an existing key name to a new key name.
[in] | old_name | String for an old key name which is to be renamed. This should not be an empty string. This name should have existed in current name tree. |
[in] | new_name | String for a new key name. This should not be an empty string. This new name should not have existed in current name tree. |
bool foxit::pdf::objects::PDFNameTree::SetObj | ( | const WString & | name, |
objects::PDFObject * | pdf_object | ||
) |
Set the value (as PDF object) of a specified key name.
[in] | name | String for a key name. It should not be an empty string. This name should have existed in current name tree. |
[in] | pdf_object | A PDF object to be set as the name's value. It should not be NULL. The type of this PDF object should match current name tree; otherwise, the input PDF object is invalid. Please refer to comment of class PDFNameTree for more details. User should not release this PDF object after this function succeeds. |