From e8a695add46ae4c94596a4066db0f73789678822 Mon Sep 17 00:00:00 2001 From: Roger Godspeed Date: Mon, 15 Apr 2024 15:06:45 -0700 Subject: [PATCH] Cxx17 updates (#58) * switch to ASWF OTIO submodule * update to std any and std optional * get latest OTIO changes * repair discrepancies between copentimelineio headers and code * remove unused references to old OTIO any.h * Add disclaimer for missing version map support in JSON serialization Signed-off-by: Jon Morley --- .gitignore | 1 + .gitmodules | 6 +- CMakeLists.txt | 2 +- OpenTimelineIO | 2 +- README.md | 4 ++ include/copentimelineio/anyVector.h | 4 +- include/copentimelineio/timeline.h | 1 - src/copentimelineio/any.cpp | 4 +- src/copentimelineio/anyDictionary.cpp | 9 +-- src/copentimelineio/anyVector.cpp | 15 ++-- src/copentimelineio/clip.cpp | 5 +- src/copentimelineio/composition.cpp | 17 ++--- src/copentimelineio/deserialization.cpp | 5 +- src/copentimelineio/externalReference.cpp | 5 +- src/copentimelineio/generatorReference.cpp | 5 +- src/copentimelineio/item.cpp | 17 ++--- src/copentimelineio/mediaReference.cpp | 13 ++-- src/copentimelineio/missingReference.cpp | 5 +- .../optionalPairRationalTime.cpp | 31 +++++---- src/copentimelineio/safely_typed_any.cpp | 68 +++++++++---------- src/copentimelineio/serializableObject.cpp | 2 + src/copentimelineio/serialization.cpp | 7 +- src/copentimelineio/stack.cpp | 5 +- src/copentimelineio/timeline.cpp | 13 ++-- src/copentimelineio/track.cpp | 9 +-- src/copentimelineio/transition.cpp | 9 +-- 26 files changed, 144 insertions(+), 120 deletions(-) diff --git a/.gitignore b/.gitignore index 5d46bd3..4d6f534 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.swp *.pyc build* +compile_commands.json cmake-build* dist* *.egg-info diff --git a/.gitmodules b/.gitmodules index 3c2627d..e8f1ce0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ -[submodule "OpenTimelineIO"] - path = OpenTimelineIO - url = https://github.com/PixarAnimationStudios/OpenTimelineIO [submodule "cmocka"] path = cmocka url = https://git.cryptomilk.org/projects/cmocka.git +[submodule "OpenTimelineIO"] + path = OpenTimelineIO + url = https://github.com/AcademySoftwareFoundation/OpenTimelineIO.git diff --git a/CMakeLists.txt b/CMakeLists.txt index d9d1d46..e818859 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) #------------------------------------------------------------------------------ # Global language settings -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) diff --git a/OpenTimelineIO b/OpenTimelineIO index 2a33b58..abe8308 160000 --- a/OpenTimelineIO +++ b/OpenTimelineIO @@ -1 +1 @@ -Subproject commit 2a33b58dd52ff59f7df8b3bc14043a210cdbc9bd +Subproject commit abe83087a8990b1ab9ace1c0e9cbdb2f18484103 diff --git a/README.md b/README.md index 1e5ba33..e6b5f73 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,10 @@ some essential features and there are large changes planned. During this phase we actively encourage you to provide feedback, requests, comments, and/or contributions. +NOTE: One of these missing features is support for the downgrade versioning +map in the JSON serialization and deserialization. This can be addressed in +the future, but for now an empty map is passed to the underlying C++ calls. + Overview -------- diff --git a/include/copentimelineio/anyVector.h b/include/copentimelineio/anyVector.h index e55988a..399e57f 100644 --- a/include/copentimelineio/anyVector.h +++ b/include/copentimelineio/anyVector.h @@ -73,9 +73,9 @@ AnyVectorIterator_not_equal(AnyVectorIterator *lhs, AnyVectorIterator *rhs); OTIO_API void AnyVectorIterator_destroy(AnyVectorIterator *self); -OTIO_API AnyVectorMutationStamp *MutationStamp_create(AnyVector *v); +OTIO_API AnyVectorMutationStamp *AnyVectorMutationStamp_create(AnyVector *v); -OTIO_API void MutationStamp_destroy(AnyVectorMutationStamp *self); +OTIO_API void AnyVectorMutationStamp_destroy(AnyVectorMutationStamp *self); OTIO_API AnyVectorMutationStamp * AnyVector_get_or_create_mutation_stamp(AnyVector *self); diff --git a/include/copentimelineio/timeline.h b/include/copentimelineio/timeline.h index 92015ba..c956a70 100644 --- a/include/copentimelineio/timeline.h +++ b/include/copentimelineio/timeline.h @@ -45,6 +45,5 @@ OTIO_API const char *Timeline_to_json_string( Timeline *self, OTIOErrorStatus *error_status, int indent); OTIO_API bool Timeline_is_equivalent_to(Timeline *self, OTIOSerializableObject *other); OTIO_API Timeline *Timeline_clone(Timeline *self, OTIOErrorStatus *error_status); -OTIO_API bool Timeline_is_unknown_schema(Timeline *self); OTIO_API const char *Timeline_schema_name(Timeline *self); OTIO_API int Timeline_schema_version(Timeline *self); diff --git a/src/copentimelineio/any.cpp b/src/copentimelineio/any.cpp index f4e5e8f..f60a129 100644 --- a/src/copentimelineio/any.cpp +++ b/src/copentimelineio/any.cpp @@ -2,9 +2,9 @@ // Copyright Contributors to the OpenTimelineIO project #include "copentimelineio/any.h" -#include #include +#include OTIO_API void Any_destroy(Any *self) { - delete reinterpret_cast(self); + delete reinterpret_cast(self); } diff --git a/src/copentimelineio/anyDictionary.cpp b/src/copentimelineio/anyDictionary.cpp index 2c5f8b1..5920528 100644 --- a/src/copentimelineio/anyDictionary.cpp +++ b/src/copentimelineio/anyDictionary.cpp @@ -5,8 +5,9 @@ #include #include #include +#include -typedef std::map::iterator DictionaryIterator; +typedef std::map::iterator DictionaryIterator; OTIO_API AnyDictionary* AnyDictionary_create() { @@ -85,7 +86,7 @@ AnyDictionary_insert(AnyDictionary* self, const char* key, Any* anyObj) { DictionaryIterator it = reinterpret_cast(self) - ->insert({ key, *reinterpret_cast(anyObj) }) + ->insert({ key, *reinterpret_cast(anyObj) }) .first; return reinterpret_cast( new DictionaryIterator(it)); @@ -118,9 +119,9 @@ OTIO_API const char* AnyDictionaryIterator_key(AnyDictionaryIterator* iter) } OTIO_API Any* AnyDictionaryIterator_value(AnyDictionaryIterator* iter) { - OTIO_NS::any value = + std::any value = (*reinterpret_cast(iter))->second; - return reinterpret_cast(new OTIO_NS::any(value)); + return reinterpret_cast(new std::any(value)); } OTIO_API bool AnyDictionaryIterator_equal( AnyDictionaryIterator* lhs, AnyDictionaryIterator* rhs) diff --git a/src/copentimelineio/anyVector.cpp b/src/copentimelineio/anyVector.cpp index 30bcaef..8f9bd3c 100644 --- a/src/copentimelineio/anyVector.cpp +++ b/src/copentimelineio/anyVector.cpp @@ -4,8 +4,9 @@ #include "copentimelineio/anyVector.h" #include #include +#include -typedef std::vector::iterator VectorIterator; +typedef std::vector::iterator VectorIterator; OTIO_API AnyVector *AnyVector_create() { return reinterpret_cast(new OTIO_NS::AnyVector()); @@ -59,14 +60,14 @@ OTIO_API void AnyVector_swap(AnyVector *self, AnyVector *other) { } OTIO_API Any *AnyVector_at(AnyVector *self, int pos) { - OTIO_NS::any value = + std::any value = reinterpret_cast(self)->at(pos); - return reinterpret_cast(new OTIO_NS::any(value)); + return reinterpret_cast(new std::any(value)); } OTIO_API void AnyVector_push_back(AnyVector *self, Any *value) { reinterpret_cast(self)->push_back( - *reinterpret_cast(value)); + *reinterpret_cast(value)); } OTIO_API void AnyVector_pop_back(AnyVector *self) { @@ -77,7 +78,7 @@ OTIO_API AnyVectorIterator * AnyVector_insert(AnyVector *self, AnyVectorIterator *pos, Any *val) { VectorIterator it = reinterpret_cast(self)->insert( *reinterpret_cast(pos), - *reinterpret_cast(val)); + *reinterpret_cast(val)); return reinterpret_cast(new VectorIterator(it)); } @@ -116,8 +117,8 @@ OTIO_API AnyVectorIterator *AnyVectorIterator_prev(AnyVectorIterator *iter, int } OTIO_API Any *AnyVectorIterator_value(AnyVectorIterator *iter) { - OTIO_NS::any value = *reinterpret_cast(iter); - return reinterpret_cast(new OTIO_NS::any(value)); + std::any value = *reinterpret_cast(iter); + return reinterpret_cast(new std::any(value)); } OTIO_API bool diff --git a/src/copentimelineio/clip.cpp b/src/copentimelineio/clip.cpp index 53b446d..757d0d3 100644 --- a/src/copentimelineio/clip.cpp +++ b/src/copentimelineio/clip.cpp @@ -11,6 +11,7 @@ #include #include #include +#include OTIO_API Clip * Clip_create( @@ -18,9 +19,9 @@ Clip_create( MediaReference *media_reference, OptionalTimeRange source_range, AnyDictionary *metadata) { - nonstd::optional timeRangeOptional = nonstd::nullopt; + std::optional timeRangeOptional = std::nullopt; if (source_range.valid) - timeRangeOptional = nonstd::optional( + timeRangeOptional = std::optional( CTimeRange_to_CppTimeRange(source_range.value)); std::string name_str = std::string(); diff --git a/src/copentimelineio/composition.cpp b/src/copentimelineio/composition.cpp index a9116d5..6db0f6e 100644 --- a/src/copentimelineio/composition.cpp +++ b/src/copentimelineio/composition.cpp @@ -16,6 +16,7 @@ #include #include #include +#include typedef std::vector MarkerVectorDef; typedef std::vector::iterator MarkerVectorIteratorDef; @@ -33,8 +34,8 @@ typedef OTIO_NS::SerializableObject::Retainer typedef std::vector ComposableVectorDef; typedef std::vector::iterator ComposableVectorIteratorDef; typedef std::pair< - nonstd::optional, - nonstd::optional> + std::optional, + std::optional> PairDef; OTIO_API Composition *Composition_create( @@ -43,9 +44,9 @@ OTIO_API Composition *Composition_create( AnyDictionary *metadata, EffectVector *effects, MarkerVector *markers) { - nonstd::optional timeRangeOptional = nonstd::nullopt; + std::optional timeRangeOptional = std::nullopt; if (source_range.valid) - timeRangeOptional = nonstd::optional( + timeRangeOptional = std::optional( CTimeRange_to_CppTimeRange(source_range.value)); std::string name_str = std::string(); @@ -166,20 +167,20 @@ OTIO_API OptionalTimeRange Composition_trimmed_range_of_child( Composition *self, Composable *child, OTIOErrorStatus *error_status) { - nonstd::optional timeRangeOptional = + std::optional timeRangeOptional = reinterpret_cast(self) ->trimmed_range_of_child( reinterpret_cast(child), reinterpret_cast(error_status)); - if (timeRangeOptional == nonstd::nullopt) return OptionalTimeRange_create_null(); + if (timeRangeOptional == std::nullopt) return OptionalTimeRange_create_null(); return OptionalTimeRange_create(CppTimeRange_to_CTimeRange(timeRangeOptional.value())); } OTIO_API OptionalTimeRange Composition_trim_child_range(Composition *self, TimeRange child_range) { - nonstd::optional timeRangeOptional = + std::optional timeRangeOptional = reinterpret_cast(self)->trim_child_range( CTimeRange_to_CppTimeRange(child_range)); - if (timeRangeOptional == nonstd::nullopt) return OptionalTimeRange_create_null(); + if (timeRangeOptional == std::nullopt) return OptionalTimeRange_create_null(); return OptionalTimeRange_create(CppTimeRange_to_CTimeRange(timeRangeOptional.value())); } OTIO_API bool Composition_has_child(Composition *self, Composable *child) { diff --git a/src/copentimelineio/deserialization.cpp b/src/copentimelineio/deserialization.cpp index 8968e67..4b9972c 100644 --- a/src/copentimelineio/deserialization.cpp +++ b/src/copentimelineio/deserialization.cpp @@ -3,13 +3,14 @@ #include "copentimelineio/deserialization.h" #include +#include OTIO_API bool deserialize_json_from_string( const char *input, Any *destination, OTIOErrorStatus *error_status) { std::string str = input; return OTIO_NS::deserialize_json_from_string( str, - reinterpret_cast(destination), + reinterpret_cast(destination), reinterpret_cast(error_status)); } @@ -17,6 +18,6 @@ OTIO_API bool deserialize_json_from_file( const char *file_name, Any *destination, OTIOErrorStatus *error_status) { return OTIO_NS::deserialize_json_from_file( file_name, - reinterpret_cast(destination), + reinterpret_cast(destination), reinterpret_cast(error_status)); } diff --git a/src/copentimelineio/externalReference.cpp b/src/copentimelineio/externalReference.cpp index c184b53..a22defc 100644 --- a/src/copentimelineio/externalReference.cpp +++ b/src/copentimelineio/externalReference.cpp @@ -10,14 +10,15 @@ #include #include #include +#include OTIO_API ExternalReference *ExternalReference_create( const char *target_url, OptionalTimeRange available_range, AnyDictionary *metadata) { - nonstd::optional timeRangeOptional = nonstd::nullopt; + std::optional timeRangeOptional = std::nullopt; if (available_range.valid) - timeRangeOptional = nonstd::optional( + timeRangeOptional = std::optional( CTimeRange_to_CppTimeRange(available_range.value)); OTIO_NS::AnyDictionary metadataDictionary = OTIO_NS::AnyDictionary(); diff --git a/src/copentimelineio/generatorReference.cpp b/src/copentimelineio/generatorReference.cpp index 5b7a28d..3448971 100644 --- a/src/copentimelineio/generatorReference.cpp +++ b/src/copentimelineio/generatorReference.cpp @@ -9,6 +9,7 @@ #include #include #include +#include OTIO_API GeneratorReference *GeneratorReference_create( const char *name, @@ -32,9 +33,9 @@ OTIO_API GeneratorReference *GeneratorReference_create( metadataDictionary = *reinterpret_cast(metadata); - nonstd::optional timeRangeOptional = nonstd::nullopt; + std::optional timeRangeOptional = std::nullopt; if (available_range.valid) - timeRangeOptional = nonstd::optional( + timeRangeOptional = std::optional( CTimeRange_to_CppTimeRange(available_range.value)); return reinterpret_cast( new OTIO_NS::GeneratorReference( diff --git a/src/copentimelineio/item.cpp b/src/copentimelineio/item.cpp index db4a868..a34bfb4 100644 --- a/src/copentimelineio/item.cpp +++ b/src/copentimelineio/item.cpp @@ -8,6 +8,7 @@ #include #include #include +#include typedef std::vector EffectVectorDef; typedef std::vector::iterator EffectVectorIteratorDef; @@ -28,9 +29,9 @@ OTIO_API Item *Item_create( AnyDictionary *metadata, EffectVector *effects, MarkerVector *markers) { - nonstd::optional source_range_optional = nonstd::nullopt; + std::optional source_range_optional = std::nullopt; if (source_range.valid) - source_range_optional = nonstd::optional( + source_range_optional = std::optional( CTimeRange_to_CppTimeRange(source_range.value)); std::string name_str = std::string(); @@ -62,16 +63,16 @@ OTIO_API bool Item_overlapping(Item *self) { return reinterpret_cast(self)->overlapping(); } OTIO_API OptionalTimeRange Item_source_range(Item *self) { - nonstd::optional timeRangeOptional = + std::optional timeRangeOptional = reinterpret_cast(self)->source_range(); - if (timeRangeOptional == nonstd::nullopt) + if (timeRangeOptional == std::nullopt) return OptionalTimeRange_create_null(); return OptionalTimeRange_create(CppTimeRange_to_CTimeRange(timeRangeOptional.value())); } OTIO_API void Item_set_source_range(Item *self, OptionalTimeRange source_range) { - nonstd::optional timeRangeOptional = nonstd::nullopt; + std::optional timeRangeOptional = std::nullopt; if (source_range.valid) - timeRangeOptional = nonstd::optional( + timeRangeOptional = std::optional( CTimeRange_to_CppTimeRange(source_range.value)); reinterpret_cast(self)->set_source_range( timeRangeOptional); @@ -114,10 +115,10 @@ OTIO_API TimeRange Item_visible_range(Item *self, OTIOErrorStatus *error_status) } OTIO_API OptionalTimeRange Item_trimmed_range_in_parent(Item *self, OTIOErrorStatus *error_status) { - nonstd::optional timeRangeOptional = + std::optional timeRangeOptional = reinterpret_cast(self)->trimmed_range_in_parent( reinterpret_cast(error_status)); - if (timeRangeOptional == nonstd::nullopt) return OptionalTimeRange_create_null(); + if (timeRangeOptional == std::nullopt) return OptionalTimeRange_create_null(); return OptionalTimeRange_create(CppTimeRange_to_CTimeRange(timeRangeOptional.value())); } OTIO_API TimeRange Item_range_in_parent(Item *self, OTIOErrorStatus *error_status) { diff --git a/src/copentimelineio/mediaReference.cpp b/src/copentimelineio/mediaReference.cpp index 42ede75..7c4ecac 100644 --- a/src/copentimelineio/mediaReference.cpp +++ b/src/copentimelineio/mediaReference.cpp @@ -8,12 +8,13 @@ #include #include #include +#include OTIO_API MediaReference *MediaReference_create( const char *name, OptionalTimeRange available_range, AnyDictionary *metadata) { - nonstd::optional timeRangeOptional = nonstd::nullopt; + std::optional timeRangeOptional = std::nullopt; if (available_range.valid) - timeRangeOptional = nonstd::optional( + timeRangeOptional = std::optional( CTimeRange_to_CppTimeRange(available_range.value)); std::string name_str = std::string(); @@ -28,16 +29,16 @@ OTIO_API MediaReference *MediaReference_create( name_str, timeRangeOptional, metadataDictionary)); } OTIO_API OptionalTimeRange MediaReference_available_range(MediaReference *self) { - nonstd::optional timeRangeOptional = + std::optional timeRangeOptional = reinterpret_cast(self)->available_range(); - if (timeRangeOptional == nonstd::nullopt) return OptionalTimeRange_create_null(); + if (timeRangeOptional == std::nullopt) return OptionalTimeRange_create_null(); return OptionalTimeRange_create(CppTimeRange_to_CTimeRange(timeRangeOptional.value())); } OTIO_API void MediaReference_set_available_range( MediaReference *self, OptionalTimeRange available_range) { - nonstd::optional timeRangeOptional = nonstd::nullopt; + std::optional timeRangeOptional = std::nullopt; if (available_range.valid) - timeRangeOptional = nonstd::optional( + timeRangeOptional = std::optional( CTimeRange_to_CppTimeRange(available_range.value)); reinterpret_cast(self)->set_available_range( timeRangeOptional); diff --git a/src/copentimelineio/missingReference.cpp b/src/copentimelineio/missingReference.cpp index 313c30f..9a7a62c 100644 --- a/src/copentimelineio/missingReference.cpp +++ b/src/copentimelineio/missingReference.cpp @@ -9,12 +9,13 @@ #include #include #include +#include OTIO_API MissingReference *MissingReference_create( const char *name, OptionalTimeRange available_range, AnyDictionary *metadata) { - nonstd::optional timeRangeOptional = nonstd::nullopt; + std::optional timeRangeOptional = std::nullopt; if (available_range.valid) - timeRangeOptional = nonstd::optional( + timeRangeOptional = std::optional( CTimeRange_to_CppTimeRange(available_range.value)); OTIO_NS::AnyDictionary metadataDictionary = OTIO_NS::AnyDictionary(); if (metadata != NULL) diff --git a/src/copentimelineio/optionalPairRationalTime.cpp b/src/copentimelineio/optionalPairRationalTime.cpp index 799c792..7c993d0 100644 --- a/src/copentimelineio/optionalPairRationalTime.cpp +++ b/src/copentimelineio/optionalPairRationalTime.cpp @@ -4,50 +4,51 @@ #include "copentime/util.h" #include "copentimelineio/optionalPairRationalTime.h" #include -#include +//#include #include +#include typedef std::pair< - nonstd::optional, - nonstd::optional> + std::optional, + std::optional> PairDef; OTIO_API OptionalPairRationalTime * OptionalPairRationalTime_create(OptionalRationalTime first, OptionalRationalTime second) { - nonstd::optional firstRationalTimeOptional = - nonstd::nullopt; - nonstd::optional secondRationalTimeOptional = - nonstd::nullopt; + std::optional firstRationalTimeOptional = + std::nullopt; + std::optional secondRationalTimeOptional = + std::nullopt; if (first.valid) { opentime::RationalTime rationalTime = CRationalTime_to_CppRationalTime(first.value); firstRationalTimeOptional = - nonstd::optional(rationalTime); + std::optional(rationalTime); } if (second.valid) { opentime::RationalTime rationalTime = CRationalTime_to_CppRationalTime(second.value); secondRationalTimeOptional = - nonstd::optional(rationalTime); + std::optional(rationalTime); } return reinterpret_cast( new std::pair< - nonstd::optional, - nonstd::optional>( + std::optional, + std::optional>( firstRationalTimeOptional, secondRationalTimeOptional)); } OTIO_API OptionalRationalTime OptionalPairRationalTime_first(OptionalPairRationalTime *self) { - nonstd::optional rationalTimeOptional = + std::optional rationalTimeOptional = reinterpret_cast(self)->first; - if (rationalTimeOptional == nonstd::nullopt) return OptionalRationalTime_create_null(); + if (rationalTimeOptional == std::nullopt) return OptionalRationalTime_create_null(); opentime::RationalTime rtValue = rationalTimeOptional.value(); return OptionalRationalTime_create(CppRationalTime_to_CRationalTime(rtValue)); } OTIO_API OptionalRationalTime OptionalPairRationalTime_second(OptionalPairRationalTime *self) { - nonstd::optional rationalTimeOptional = + std::optional rationalTimeOptional = reinterpret_cast(self)->second; - if (rationalTimeOptional == nonstd::nullopt) return OptionalRationalTime_create_null(); + if (rationalTimeOptional == std::nullopt) return OptionalRationalTime_create_null(); opentime::RationalTime rtValue = rationalTimeOptional.value(); return OptionalRationalTime_create(CppRationalTime_to_CRationalTime(rtValue)); } diff --git a/src/copentimelineio/safely_typed_any.cpp b/src/copentimelineio/safely_typed_any.cpp index 890f53c..3e3b442 100644 --- a/src/copentimelineio/safely_typed_any.cpp +++ b/src/copentimelineio/safely_typed_any.cpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -14,123 +13,124 @@ #include #include #include +#include OTIO_API Any *create_safely_typed_any_bool(bool boolValue) { - OTIO_NS::any anyValue = + std::any anyValue = OTIO_NS::create_safely_typed_any(std::move(boolValue)); - return reinterpret_cast(new OTIO_NS::any(anyValue)); + return reinterpret_cast(new std::any(anyValue)); } OTIO_API Any *create_safely_typed_any_int(int intValue) { - OTIO_NS::any anyValue = + std::any anyValue = OTIO_NS::create_safely_typed_any(std::move(intValue)); - return reinterpret_cast(new OTIO_NS::any(anyValue)); + return reinterpret_cast(new std::any(anyValue)); } OTIO_API Any *create_safely_typed_any_int64(int64_t int64Value) { - OTIO_NS::any anyValue = + std::any anyValue = OTIO_NS::create_safely_typed_any(std::move(int64Value)); - return reinterpret_cast(new OTIO_NS::any(anyValue)); + return reinterpret_cast(new std::any(anyValue)); } OTIO_API Any *create_safely_typed_any_double(double doubleValue) { - OTIO_NS::any anyValue = + std::any anyValue = OTIO_NS::create_safely_typed_any(std::move(doubleValue)); - return reinterpret_cast(new OTIO_NS::any(anyValue)); + return reinterpret_cast(new std::any(anyValue)); } OTIO_API Any *create_safely_typed_any_string(const char *stringValue) { std::string str = stringValue; - OTIO_NS::any anyValue = + std::any anyValue = OTIO_NS::create_safely_typed_any(std::move(str)); - return reinterpret_cast(new OTIO_NS::any(anyValue)); + return reinterpret_cast(new std::any(anyValue)); } OTIO_API Any *create_safely_typed_any_rational_time(RationalTime rationalTimeValue) { - OTIO_NS::any anyValue = OTIO_NS::create_safely_typed_any(std::move( + std::any anyValue = OTIO_NS::create_safely_typed_any(std::move( CRationalTime_to_CppRationalTime(rationalTimeValue))); - return reinterpret_cast(new OTIO_NS::any(anyValue)); + return reinterpret_cast(new std::any(anyValue)); } OTIO_API Any *create_safely_typed_any_time_range(TimeRange timeRangeValue) { - OTIO_NS::any anyValue = OTIO_NS::create_safely_typed_any( + std::any anyValue = OTIO_NS::create_safely_typed_any( CTimeRange_to_CppTimeRange(timeRangeValue)); - return reinterpret_cast(new OTIO_NS::any(anyValue)); + return reinterpret_cast(new std::any(anyValue)); } OTIO_API Any * create_safely_typed_any_time_transform(TimeTransform timeTransformValue) { - OTIO_NS::any anyValue = OTIO_NS::create_safely_typed_any(std::move( + std::any anyValue = OTIO_NS::create_safely_typed_any(std::move( CTimeTransform_to_CppTimeTransform(timeTransformValue))); - return reinterpret_cast(new OTIO_NS::any(anyValue)); + return reinterpret_cast(new std::any(anyValue)); } OTIO_API Any *create_safely_typed_any_any_vector(AnyVector *anyVectorValue) { - OTIO_NS::any anyValue = OTIO_NS::create_safely_typed_any( + std::any anyValue = OTIO_NS::create_safely_typed_any( std::move(*reinterpret_cast(anyVectorValue))); - return reinterpret_cast(new OTIO_NS::any(anyValue)); + return reinterpret_cast(new std::any(anyValue)); } OTIO_API Any * create_safely_typed_any_any_dictionary(AnyDictionary *anyDictionaryValue) { - OTIO_NS::any anyValue = OTIO_NS::create_safely_typed_any(std::move( + std::any anyValue = OTIO_NS::create_safely_typed_any(std::move( *reinterpret_cast(anyDictionaryValue))); - return reinterpret_cast(new OTIO_NS::any(anyValue)); + return reinterpret_cast(new std::any(anyValue)); } OTIO_API Any *create_safely_typed_any_serializable_object( OTIOSerializableObject *serializableObjectValue) { - OTIO_NS::any anyValue = OTIO_NS::create_safely_typed_any( + std::any anyValue = OTIO_NS::create_safely_typed_any( reinterpret_cast( serializableObjectValue)); - return reinterpret_cast(new OTIO_NS::any(anyValue)); + return reinterpret_cast(new std::any(anyValue)); } OTIO_API bool safely_cast_bool_any(Any *a) { return OTIO_NS::safely_cast_bool_any( - *reinterpret_cast(a)); + *reinterpret_cast(a)); } OTIO_API int safely_cast_int_any(Any *a) { return OTIO_NS::safely_cast_int_any( - *reinterpret_cast(a)); + *reinterpret_cast(a)); } OTIO_API int64_t safely_cast_int64_any(Any *a) { return OTIO_NS::safely_cast_int64_any( - *reinterpret_cast(a)); + *reinterpret_cast(a)); } OTIO_API double safely_cast_double_any(Any *a) { return OTIO_NS::safely_cast_double_any( - *reinterpret_cast(a)); + *reinterpret_cast(a)); } OTIO_API const char *safely_cast_string_any(Any *a) { std::string returnStr = OTIO_NS::safely_cast_string_any( - *reinterpret_cast(a)); + *reinterpret_cast(a)); return strdup(returnStr.c_str()); } OTIO_API RationalTime safely_cast_rational_time_any(Any *a) { opentime::RationalTime rationalTime = OTIO_NS::safely_cast_rational_time_any( - *reinterpret_cast(a)); + *reinterpret_cast(a)); return CppRationalTime_to_CRationalTime(rationalTime); } OTIO_API TimeRange safely_cast_time_range_any(Any *a) { opentime::TimeRange timeRange = OTIO_NS::safely_cast_time_range_any( - *reinterpret_cast(a)); + *reinterpret_cast(a)); return CppTimeRange_to_CTimeRange(timeRange); } OTIO_API TimeTransform safely_cast_time_transform_any(Any *a) { opentime::TimeTransform timeTransform = OTIO_NS::safely_cast_time_transform_any( - *reinterpret_cast(a)); + *reinterpret_cast(a)); return CppTimeTransform_to_CTimeTransform(timeTransform); } OTIO_API OTIOSerializableObject *safely_cast_retainer_any(Any *a) { return reinterpret_cast( OTIO_NS::safely_cast_retainer_any( - *reinterpret_cast(a))); + *reinterpret_cast(a))); } OTIO_API AnyDictionary *safely_cast_any_dictionary_any(Any *a) { OTIO_NS::AnyDictionary anyDictionary = OTIO_NS::safely_cast_any_dictionary_any( - *reinterpret_cast(a)); + *reinterpret_cast(a)); return reinterpret_cast( new OTIO_NS::AnyDictionary(anyDictionary)); } OTIO_API AnyVector *safely_cast_any_vector_any(Any *a) { OTIO_NS::AnyVector anyVector = OTIO_NS::safely_cast_any_vector_any( - *reinterpret_cast(a)); + *reinterpret_cast(a)); return reinterpret_cast(new OTIO_NS::AnyVector(anyVector)); } diff --git a/src/copentimelineio/serializableObject.cpp b/src/copentimelineio/serializableObject.cpp index 430ad0d..ba534c6 100644 --- a/src/copentimelineio/serializableObject.cpp +++ b/src/copentimelineio/serializableObject.cpp @@ -54,6 +54,7 @@ SerializableObject_to_json_file( ->to_json_file( file_name, reinterpret_cast(error_status), + {}, indent); } @@ -65,6 +66,7 @@ SerializableObject_to_json_string( reinterpret_cast(self) ->to_json_string( reinterpret_cast(error_status), + {}, indent); return strdup(returnStr.c_str()); } diff --git a/src/copentimelineio/serialization.cpp b/src/copentimelineio/serialization.cpp index 43e4a09..30680a0 100644 --- a/src/copentimelineio/serialization.cpp +++ b/src/copentimelineio/serialization.cpp @@ -4,11 +4,13 @@ #include "copentimelineio/serialization.h" #include #include +#include OTIO_API const char *serialize_json_to_string( Any *value, OTIOErrorStatus *error_status, int indent) { std::string returnStr = OTIO_NS::serialize_json_to_string( - *reinterpret_cast(value), + *reinterpret_cast(value), + {}, reinterpret_cast(error_status), indent); return strdup(returnStr.c_str()); @@ -20,8 +22,9 @@ OTIO_API bool serialize_json_to_file( OTIOErrorStatus *error_status, int indent) { return OTIO_NS::serialize_json_to_file( - reinterpret_cast(value), + reinterpret_cast(value), file_name, + {}, reinterpret_cast(error_status), indent); } diff --git a/src/copentimelineio/stack.cpp b/src/copentimelineio/stack.cpp index 5319790..008c05c 100644 --- a/src/copentimelineio/stack.cpp +++ b/src/copentimelineio/stack.cpp @@ -10,6 +10,7 @@ #include #include #include +#include typedef std::vector EffectVectorDef; typedef std::vector::iterator EffectVectorIteratorDef; @@ -25,9 +26,9 @@ OTIO_API Stack *Stack_create( AnyDictionary *metadata, EffectVector *effects, MarkerVector *markers) { - nonstd::optional timeRangeOptional = nonstd::nullopt; + std::optional timeRangeOptional = std::nullopt; if (source_range.valid) - timeRangeOptional = nonstd::optional( + timeRangeOptional = std::optional( CTimeRange_to_CppTimeRange(source_range.value)); std::string name_str = std::string(); diff --git a/src/copentimelineio/timeline.cpp b/src/copentimelineio/timeline.cpp index 59f529a..aae8d1c 100644 --- a/src/copentimelineio/timeline.cpp +++ b/src/copentimelineio/timeline.cpp @@ -11,6 +11,7 @@ #include #include #include +#include typedef std::vector TrackVectorDef; typedef std::vector::iterator TrackVectorIteratorDef; @@ -27,9 +28,9 @@ OTIO_API Timeline *Timeline_create( metadataDictionary = *reinterpret_cast(metadata); - nonstd::optional rationalTimeOptional = nonstd::nullopt; + std::optional rationalTimeOptional = std::nullopt; if (global_start_time.valid) - rationalTimeOptional = nonstd::optional( + rationalTimeOptional = std::optional( CRationalTime_to_CppRationalTime(global_start_time.value)); return reinterpret_cast(new OTIO_NS::Timeline( name_str, rationalTimeOptional, metadataDictionary)); @@ -46,17 +47,17 @@ OTIO_API void Timeline_set_tracks(Timeline *self, Stack *stack) { } OTIO_API OptionalRationalTime Timeline_global_start_time(Timeline *self) { - nonstd::optional rationalTimeOptional = + std::optional rationalTimeOptional = reinterpret_cast(self)->global_start_time(); - if (rationalTimeOptional == nonstd::nullopt) return OptionalRationalTime_create_null(); + if (rationalTimeOptional == std::nullopt) return OptionalRationalTime_create_null(); return OptionalRationalTime_create(CppRationalTime_to_CRationalTime(rationalTimeOptional.value())); } OTIO_API void Timeline_set_global_start_time( Timeline *self, OptionalRationalTime global_start_time) { - nonstd::optional rationalTimeOptional = nonstd::nullopt; + std::optional rationalTimeOptional = std::nullopt; if (global_start_time.valid) - rationalTimeOptional = nonstd::optional( + rationalTimeOptional = std::optional( CRationalTime_to_CppRationalTime(global_start_time.value)); reinterpret_cast(self)->set_global_start_time( rationalTimeOptional); diff --git a/src/copentimelineio/track.cpp b/src/copentimelineio/track.cpp index 2da8f8e..b109739 100644 --- a/src/copentimelineio/track.cpp +++ b/src/copentimelineio/track.cpp @@ -12,6 +12,7 @@ #include #include #include +#include typedef std::map::iterator MapComposableTimeRangeIteratorDef; @@ -19,8 +20,8 @@ typedef std::map MapComposableTimeRangeDef; typedef std::pair< - nonstd::optional, - nonstd::optional> + std::optional, + std::optional> OptionalPairRationalTimeDef; typedef std::pair< OTIO_NS::Composable::Retainer, @@ -46,9 +47,9 @@ OTIO_API Track *Track_create( OptionalTimeRange source_range, const char *kind, AnyDictionary *metadata) { - nonstd::optional timeRangeOptional = nonstd::nullopt; + std::optional timeRangeOptional = std::nullopt; if (source_range.valid) - timeRangeOptional = nonstd::optional( + timeRangeOptional = std::optional( CTimeRange_to_CppTimeRange(source_range.value)); std::string name_str = std::string(); diff --git a/src/copentimelineio/transition.cpp b/src/copentimelineio/transition.cpp index 7fbc30a..6edad0d 100644 --- a/src/copentimelineio/transition.cpp +++ b/src/copentimelineio/transition.cpp @@ -10,6 +10,7 @@ #include #include #include +#include const char *TransitionType_SMPTE_Dissolve = OTIO_NS::Transition::Type::SMPTE_Dissolve; @@ -86,19 +87,19 @@ Transition_duration(Transition *self, OTIOErrorStatus *error_status) { } OTIO_API OptionalTimeRange Transition_range_in_parent(Transition *self, OTIOErrorStatus *error_status) { - nonstd::optional timeRangeOptional = + std::optional timeRangeOptional = reinterpret_cast(self)->range_in_parent( reinterpret_cast(error_status)); - if (timeRangeOptional == nonstd::nullopt) return OptionalTimeRange_create_null(); + if (timeRangeOptional == std::nullopt) return OptionalTimeRange_create_null(); return OptionalTimeRange_create(CppTimeRange_to_CTimeRange(timeRangeOptional.value())); } OTIO_API OptionalTimeRange Transition_trimmed_range_in_parent( Transition *self, OTIOErrorStatus *error_status) { - nonstd::optional timeRangeOptional = + std::optional timeRangeOptional = reinterpret_cast(self) ->trimmed_range_in_parent( reinterpret_cast(error_status)); - if (timeRangeOptional == nonstd::nullopt) return OptionalTimeRange_create_null(); + if (timeRangeOptional == std::nullopt) return OptionalTimeRange_create_null(); return OptionalTimeRange_create(CppTimeRange_to_CTimeRange(timeRangeOptional.value())); } OTIO_API const char *Transition_name(Transition *self) {