summaryrefslogtreecommitdiff
path: root/internal/dynamic_depth/element.h
blob: 90f112f312bcddb770688d3451a954f514d9edef (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
#ifndef DYNAMIC_DEPTH_INTERNAL_DYNAMIC_DEPTH_ELEMENT_H_  // NOLINT
#define DYNAMIC_DEPTH_INTERNAL_DYNAMIC_DEPTH_ELEMENT_H_  // NOLINT

#include <unordered_map>

#include "xmpmeta/xml/deserializer.h"
#include "xmpmeta/xml/serializer.h"

namespace dynamic_depth {

/**
 * An interface for an element in the Dynamic Depth spec.
 */
class Element {
 public:
  virtual ~Element() {}

  // Appends child elements' namespaces' and their respective hrefs to the
  // given collection, and any parent nodes' names to prefix_names.
  // Key: Name of the namespace.
  // Value: Full namespace URL.
  // Example: ("Image", "http://ns.google.com/photos/dd/1.0/image/")
  virtual void GetNamespaces(
      std::unordered_map<string, string>* ns_name_href_map) = 0;

  // Serializes this element.
  virtual bool Serialize(
      ::dynamic_depth::xmpmeta::xml::Serializer* serializer) const = 0;
};

}  // namespace dynamic_depth

#endif  // DYNAMIC_DEPTH_INTERNAL_DYNAMIC_DEPTH_ELEMENT_H_  // NOLINT