2018-08-12 18:07:22 +00:00
|
|
|
#ifndef QPDF_DICTIONARY_HH
|
|
|
|
#define QPDF_DICTIONARY_HH
|
2008-04-29 12:55:25 +00:00
|
|
|
|
2022-08-02 20:35:04 +00:00
|
|
|
#include <qpdf/QPDFValue.hh>
|
2008-04-29 12:55:25 +00:00
|
|
|
|
|
|
|
#include <map>
|
2022-04-02 21:14:10 +00:00
|
|
|
#include <set>
|
2008-04-29 12:55:25 +00:00
|
|
|
|
|
|
|
#include <qpdf/QPDFObjectHandle.hh>
|
|
|
|
|
2022-08-02 20:35:04 +00:00
|
|
|
class QPDF_Dictionary: public QPDFValue
|
2008-04-29 12:55:25 +00:00
|
|
|
{
|
|
|
|
public:
|
2022-04-15 23:44:07 +00:00
|
|
|
virtual ~QPDF_Dictionary() = default;
|
2022-09-05 13:15:14 +00:00
|
|
|
static std::shared_ptr<QPDFValueProxy>
|
2022-06-27 16:50:35 +00:00
|
|
|
create(std::map<std::string, QPDFObjectHandle> const& items);
|
2022-09-05 13:15:14 +00:00
|
|
|
virtual std::shared_ptr<QPDFValueProxy> shallowCopy();
|
2008-04-29 12:55:25 +00:00
|
|
|
virtual std::string unparse();
|
2022-05-07 11:53:45 +00:00
|
|
|
virtual JSON getJSON(int json_version);
|
2022-09-08 15:06:15 +00:00
|
|
|
virtual void disconnect();
|
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
|
|
|
|
2022-04-24 13:31:32 +00:00
|
|
|
// If value is null, remove key; otherwise, replace the value of
|
|
|
|
// key, adding it if it does not exist.
|
|
|
|
void replaceKey(std::string const& key, QPDFObjectHandle value);
|
2008-04-29 12:55:25 +00:00
|
|
|
// Remove key, doing nothing if key does not exist
|
|
|
|
void removeKey(std::string const& key);
|
|
|
|
|
|
|
|
private:
|
2022-06-16 16:45:04 +00:00
|
|
|
QPDF_Dictionary(std::map<std::string, QPDFObjectHandle> const& items);
|
2008-04-29 12:55:25 +00:00
|
|
|
std::map<std::string, QPDFObjectHandle> items;
|
|
|
|
};
|
|
|
|
|
2018-08-12 18:07:22 +00:00
|
|
|
#endif // QPDF_DICTIONARY_HH
|