2018-08-12 18:07:22 +00:00
|
|
|
#ifndef QPDF_DICTIONARY_HH
|
|
|
|
#define QPDF_DICTIONARY_HH
|
2008-04-29 12:55:25 +00:00
|
|
|
|
|
|
|
#include <qpdf/QPDFObject.hh>
|
|
|
|
|
|
|
|
#include <set>
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
#include <qpdf/QPDFObjectHandle.hh>
|
|
|
|
|
|
|
|
class QPDF_Dictionary: public QPDFObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
QPDF_Dictionary(std::map<std::string, QPDFObjectHandle> const& items);
|
|
|
|
virtual ~QPDF_Dictionary();
|
|
|
|
virtual std::string unparse();
|
2018-12-17 22:40:29 +00:00
|
|
|
virtual JSON getJSON();
|
2013-01-22 14:57:07 +00:00
|
|
|
virtual QPDFObject::object_type_e getTypeCode() const;
|
|
|
|
virtual char const* getTypeName() const;
|
2018-02-16 22:25:27 +00:00
|
|
|
virtual void setDescription(QPDF*, std::string const&);
|
2008-04-29 12:55:25 +00:00
|
|
|
|
|
|
|
// hasKey() and getKeys() treat keys with null values as if they
|
|
|
|
// aren't there. getKey() returns null for the value of a
|
|
|
|
// non-existent key. This is as per the PDF spec.
|
|
|
|
bool hasKey(std::string const&);
|
|
|
|
QPDFObjectHandle getKey(std::string const&);
|
|
|
|
std::set<std::string> getKeys();
|
2011-08-10 17:33:58 +00:00
|
|
|
std::map<std::string, QPDFObjectHandle> const& getAsMap() const;
|
2008-04-29 12:55:25 +00:00
|
|
|
|
2009-02-21 02:54:31 +00:00
|
|
|
// Replace value of key, adding it if it does not exist
|
2018-02-16 22:25:27 +00:00
|
|
|
void replaceKey(std::string const& key, QPDFObjectHandle);
|
2008-04-29 12:55:25 +00:00
|
|
|
// Remove key, doing nothing if key does not exist
|
|
|
|
void removeKey(std::string const& key);
|
2010-08-02 22:17:01 +00:00
|
|
|
// If object is null, replace key; otherwise, remove key
|
|
|
|
void replaceOrRemoveKey(std::string const& key, QPDFObjectHandle);
|
2008-04-29 12:55:25 +00:00
|
|
|
|
2010-06-06 13:32:08 +00:00
|
|
|
protected:
|
|
|
|
virtual void releaseResolved();
|
|
|
|
|
2008-04-29 12:55:25 +00:00
|
|
|
private:
|
|
|
|
std::map<std::string, QPDFObjectHandle> items;
|
|
|
|
};
|
|
|
|
|
2018-08-12 18:07:22 +00:00
|
|
|
#endif // QPDF_DICTIONARY_HH
|