#ifndef KeyedDecoder_h
#define KeyedDecoder_h
#include <WebCore/KeyedCoding.h>
#include <glib.h>
#include <wtf/HashMap.h>
#include <wtf/glib/GRefPtr.h>
#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>
namespace WebKit {
class KeyedDecoder final : public WebCore::KeyedDecoder {
public:
KeyedDecoder(const uint8_t* data, size_t);
virtual ~KeyedDecoder() override;
private:
virtual bool decodeBytes(const String& key, const uint8_t*&, size_t&) override;
virtual bool decodeBool(const String& key, bool&) override;
virtual bool decodeUInt32(const String& key, uint32_t&) override;
virtual bool decodeInt32(const String& key, int32_t&) override;
virtual bool decodeInt64(const String& key, int64_t&) override;
virtual bool decodeFloat(const String& key, float&) override;
virtual bool decodeDouble(const String& key, double&) override;
virtual bool decodeString(const String& key, String&) override;
virtual bool beginObject(const String& key) override;
virtual void endObject() override;
virtual bool beginArray(const String& key) override;
virtual bool beginArrayElement() override;
virtual void endArrayElement() override;
virtual void endArray() override;
template<typename T, typename F> bool decodeSimpleValue(const String& key, T& result, F getFunction);
HashMap<String, GRefPtr<GVariant>> dictionaryFromGVariant(GVariant*);
Vector<HashMap<String, GRefPtr<GVariant>>> m_dictionaryStack;
Vector<GVariant*, 16> m_arrayStack;
Vector<unsigned> m_arrayIndexStack;
};
}
#endif // KeyedDecoder_h