1 #ifndef DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_VENDOR_INFO_H_ // NOLINT 2 #define DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_VENDOR_INFO_H_ // NOLINT 3 4 #include <memory> 5 #include <string> 6 #include <unordered_map> 7 8 #include "dynamic_depth/element.h" 9 #include "xmpmeta/xml/deserializer.h" 10 #include "xmpmeta/xml/serializer.h" 11 12 namespace dynamic_depth { 13 14 /** 15 * A VendorInfo element for a Dynamic Depth device. 16 */ 17 class VendorInfo : public Element { 18 public: 19 // Appends child elements' namespaces' and their respective hrefs to the 20 // given collection, and any parent nodes' names to prefix_names. 21 // Key: Name of the namespace. 22 // Value: Full namespace URL. 23 // Example: ("VendorInfo", "http://ns.google.com/photos/dd/1.0/vendorinfo/") 24 void GetNamespaces( 25 std::unordered_map<string, string>* ns_name_href_map) override; 26 27 // Serializes this object. 28 bool Serialize( 29 ::dynamic_depth::xmpmeta::xml::Serializer* serializer) const override; 30 31 // Creates an VendorInfo from the given fields. Returns null if 32 // any of the required fields is empty (see fields below). 33 // Manufacturer is the manufacturer of the element that created the content. 34 // Model is the model of the element that created the content. 35 // Notes is general comments. 36 static std::unique_ptr<VendorInfo> FromData(const string& manufacturer, 37 const string& model, 38 const string& notes); 39 40 // Returns the deserialized VendorInfo; null if parsing fails. 41 static std::unique_ptr<VendorInfo> FromDeserializer( 42 const ::dynamic_depth::xmpmeta::xml::Deserializer& parent_deserializer, 43 const string& namespace_str); 44 45 // Returns the Manufacturer. 46 const string& GetManufacturer() const; 47 48 // Returns the Model. 49 const string& GetModel() const; 50 51 // Returns the Notes. 52 const string& GetNotes() const; 53 54 // Disallow copying. 55 VendorInfo(const VendorInfo&) = delete; 56 void operator=(const VendorInfo&) = delete; 57 58 private: 59 VendorInfo(); 60 61 bool ParseFields( 62 const ::dynamic_depth::xmpmeta::xml::Deserializer& deserializer); 63 64 // Required field. 65 string manufacturer_; // The manufacturer. 66 67 // Optional fields. 68 string model_; // The model. 69 string notes_; // The notes. 70 }; 71 72 } // namespace dynamic_depth 73 74 #endif // DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_VENDOR_INFO_H_ // NOLINT 75