#ifndef QPDF_DICTIONARY_HH #define QPDF_DICTIONARY_HH #include #include #include #include class QPDF_Dictionary: public QPDFValue { public: ~QPDF_Dictionary() override = default; static std::shared_ptr create(std::map const& items); static std::shared_ptr create(std::map&& items); std::shared_ptr copy(bool shallow = false) override; std::string unparse() override; void writeJSON(int json_version, JSON::Writer& p) override; void disconnect() override; // 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 getKeys(); std::map const& getAsMap() const; // 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); // Remove key, doing nothing if key does not exist void removeKey(std::string const& key); private: QPDF_Dictionary(std::map const& items); QPDF_Dictionary(std::map&& items); std::map items; }; #endif // QPDF_DICTIONARY_HH