Modify to test email notice.
[asdcplib.git] / src / MXF.h
index 046a7b2d31dbeebf697152c18bcb29031ea11790..b8d11939a4e0674a03b70474fa61b35f3801efed 100755 (executable)
--- a/src/MXF.h
+++ b/src/MXF.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2005-2015, John Hurst
+Copyright (c) 2005-2018, John Hurst
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -185,12 +185,22 @@ namespace ASDCP
            LocalTagEntry(const TagValue& tag, ASDCP::UL& ul) : Tag(tag), UL(ul) {}
 
              bool operator<(const LocalTagEntry& rhs) const {
-               return ( ( Tag.a < rhs.Tag.a ) || ( Tag.b < rhs.Tag.b ) );
+               if ( Tag.a < rhs.Tag.a )
+                 {
+                   return true;
+                 }
+               
+               if ( Tag.a == rhs.Tag.a && Tag.b < rhs.Tag.b )
+                 {
+                   return true;
+                 }
+
+               return false;
              }
 
              inline const char* EncodeString(char* str_buf, ui32_t buf_len) const {
                snprintf(str_buf, buf_len, "%02x %02x: ", Tag.a, Tag.b);
-               UL.EncodeString(str_buf + strlen(str_buf), buf_len - strlen(str_buf));
+               UL.EncodeString(str_buf + strlen(str_buf), buf_len - (ui32_t)strlen(str_buf));
                return str_buf;
              }
 
@@ -235,8 +245,12 @@ namespace ASDCP
 
        public:
        optional_property() : m_has_value(false) {}
-       optional_property(const PropertyType& value) : m_property(value), m_has_value(false) {}
-         const optional_property<PropertyType>& operator=(const PropertyType& rhs) { this->m_property = rhs; this->m_has_value = true; return *this; }
+       optional_property(const PropertyType& value) : m_property(value), m_has_value(true) {}
+         const optional_property<PropertyType>& operator=(const PropertyType& rhs) {
+           this->m_property = rhs;
+           this->m_has_value = true;
+           return *this;
+         }
          bool operator==(const PropertyType& rhs) const { return this->m_property == rhs; }
          bool operator==(const optional_property<PropertyType>& rhs) const { return this->m_property == rhs.m_property; }
          operator PropertyType&() { return this->m_property; }
@@ -248,6 +262,30 @@ namespace ASDCP
          const PropertyType& const_get() const { return m_property; }
        };
 
+      // wrapper object manages optional properties
+      template <class PropertyType>
+       class optional_container_property
+       {
+         PropertyType m_property;
+
+       public:
+         optional_container_property() {}
+       optional_container_property(const PropertyType& value) : m_property(value) {}
+         const optional_container_property<PropertyType>& operator=(const PropertyType& rhs) {
+           this->Copy(rhs.m_property);
+           return *this;
+         }
+
+         bool operator==(const PropertyType& rhs) const { return this->m_property == rhs; }
+         bool operator==(const optional_property<PropertyType>& rhs) const { return this->m_property == rhs.m_property; }
+         operator PropertyType&() { return this->m_property; }
+         void set(const PropertyType& rhs) { this->m_property = rhs; }
+         void reset(const PropertyType& rhs) { this->clear(); }
+         bool empty() const { return ! this->m_property.HasValue(); }
+         PropertyType& get() { return m_property; }
+         const PropertyType& const_get() const { return m_property; }
+       };
+
       // base class of all metadata objects
       //
       class InterchangeObject : public ASDCP::KLVPacket
@@ -294,6 +332,7 @@ namespace ASDCP
          Batch<UL>    EssenceContainers;
          Batch<UL>    DMSchemes;
          optional_property<Batch<UL> > ApplicationSchemes;
+         optional_property<Batch<UL> > ConformsToSpecifications;
 
          Preface(const Dictionary*& d);
          virtual ~Preface() {}