Object_h.template 1.33 KB
Newer Older
1 2
// This file is generated by Object_h.template.

3 4 5 6 7 8 9 10 11 12 13
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef {{"_".join(config.protocol.namespace)}}_Object_h
#define {{"_".join(config.protocol.namespace)}}_Object_h

//#include "ErrorSupport.h"
//#include "Forward.h"
//#include "Values.h"

14 15
#include "{{config.crdtp.dir}}/serializable.h"

16 17 18 19
{% for namespace in config.protocol.namespace %}
namespace {{namespace}} {
{% endfor %}

20
class {{config.lib.export_macro}} Object : public {{config.crdtp.namespace}}::Serializable {
21
public:
22
    static std::unique_ptr<Object> fromValue(protocol::Value*, ErrorSupport*);
23
    explicit Object(std::unique_ptr<protocol::DictionaryValue>);
24 25
    ~Object();

26 27 28
    // Implements Serializable.
    void AppendSerialized(std::vector<uint8_t>* out) const override;

29
    std::unique_ptr<protocol::DictionaryValue> toValue() const;
30
    std::unique_ptr<Object> clone() const;
31

32
private:
33 34 35
    Object() = default;
    friend struct {{config.crdtp.namespace}}::ProtocolTypeTraits<std::unique_ptr<Object>, void>;

36 37 38 39 40 41 42 43
    std::unique_ptr<protocol::DictionaryValue> m_object;
};

{% for namespace in config.protocol.namespace %}
} // namespace {{namespace}}
{% endfor %}

#endif // !defined({{"_".join(config.protocol.namespace)}}_Object_h)