summaryrefslogtreecommitdiff
path: root/DevTools/Inspector/RemoteObjectPropertyModel.h
blob: 9ff905ecd1f36cb0434528355f349d98c6a607ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once

#include <AK/JsonValue.h>
#include <LibGUI/GModel.h>

class RemoteObject;

class RemoteObjectPropertyModel final : public GModel {
public:
    virtual ~RemoteObjectPropertyModel() override {}
    static NonnullRefPtr<RemoteObjectPropertyModel> create(RemoteObject& object)
    {
        return adopt(*new RemoteObjectPropertyModel(object));
    }

    enum Column {
        Name,
        Value,
        __Count,
    };

    virtual int row_count(const GModelIndex& = GModelIndex()) const override;
    virtual int column_count(const GModelIndex& = GModelIndex()) const override { return Column::__Count; }
    virtual String column_name(int) const override;
    virtual GVariant data(const GModelIndex&, Role = Role::Display) const override;
    virtual void update() override;

private:
    explicit RemoteObjectPropertyModel(RemoteObject&);

    RemoteObject& m_object;
    struct NameAndValue {
        JsonValue name;
        JsonValue value;
    };
    Vector<NameAndValue> m_properties;
};