From 5d45c30dc77aa969523e950a7ccdca6f9ce0e912 Mon Sep 17 00:00:00 2001 From: Matt Kuruc Date: Tue, 12 Sep 2023 17:23:11 -0700 Subject: [PATCH] Replace `boost::optional` with `std::optional` for `SdfCopySpec` --- pxr/usd/bin/sdffilter/sdffilter.cpp | 2 +- pxr/usd/sdf/copyUtils.cpp | 10 +++++----- pxr/usd/sdf/copyUtils.h | 14 +++++++------- pxr/usd/sdf/wrapCopyUtils.cpp | 6 +++--- pxr/usd/usdUtils/stitch.cpp | 16 ++++++++-------- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pxr/usd/bin/sdffilter/sdffilter.cpp b/pxr/usd/bin/sdffilter/sdffilter.cpp index 5637da5bbc..ed0d5b5aa9 100644 --- a/pxr/usd/bin/sdffilter/sdffilter.cpp +++ b/pxr/usd/bin/sdffilter/sdffilter.cpp @@ -491,7 +491,7 @@ FilterLayer(SdfLayerHandle const &inLayer, SdfSpecType specType, TfToken const &field, SdfLayerHandle const &srcLayer, const SdfPath& srcPath, bool fieldInSrc, const SdfLayerHandle& dstLayer, const SdfPath& dstPath, bool fieldInDst, - boost::optional *valueToCopy) { + std::optional *valueToCopy) { if (!p.fieldMatcher || p.fieldMatcher->Match(field.GetString())) { *valueToCopy = GetReportFieldValue( diff --git a/pxr/usd/sdf/copyUtils.cpp b/pxr/usd/sdf/copyUtils.cpp index 921abd4336..3a01d9b3b7 100644 --- a/pxr/usd/sdf/copyUtils.cpp +++ b/pxr/usd/sdf/copyUtils.cpp @@ -174,7 +174,7 @@ _ProcessChildField( const SdfLayerHandle& dstLayer, const SdfPath& dstPath, bool childrenInDst, const SdfShouldCopyChildrenFn& shouldCopyChildren, _CopyStack* copyStack) { - boost::optional srcChildrenToCopy, dstChildrenToCopy; + std::optional srcChildrenToCopy, dstChildrenToCopy; if (!shouldCopyChildren( childField, srcLayer, srcPath, childrenInSrc, dstLayer, dstPath, childrenInDst, @@ -428,7 +428,7 @@ _AddFieldValueToCopy( const SdfLayerHandle& dstLayer, const SdfPath& dstPath, bool fieldInDst, const SdfShouldCopyValueFn& shouldCopyValue, _FieldValueList* valueList) { - boost::optional value; + std::optional value; if (shouldCopyValue( specType, field, srcLayer, srcPath, fieldInSrc, dstLayer, dstPath, fieldInDst, @@ -699,7 +699,7 @@ SdfShouldCopyValue( SdfSpecType specType, const TfToken& field, const SdfLayerHandle& srcLayer, const SdfPath& srcPath, bool fieldInSrc, const SdfLayerHandle& dstLayer, const SdfPath& dstPath, bool fieldInDst, - boost::optional* valueToCopy) + std::optional* valueToCopy) { if (fieldInSrc) { if (field == SdfFieldKeys->ConnectionPaths || @@ -784,8 +784,8 @@ SdfShouldCopyChildren( const TfToken& childrenField, const SdfLayerHandle& srcLayer, const SdfPath& srcPath, bool fieldInSrc, const SdfLayerHandle& dstLayer, const SdfPath& dstPath, bool fieldInDst, - boost::optional* srcChildren, - boost::optional* dstChildren) + std::optional* srcChildren, + std::optional* dstChildren) { if (fieldInSrc) { if (childrenField == SdfChildrenKeys->ConnectionChildren || diff --git a/pxr/usd/sdf/copyUtils.h b/pxr/usd/sdf/copyUtils.h index d6ac90c523..d4ae81f6c0 100644 --- a/pxr/usd/sdf/copyUtils.h +++ b/pxr/usd/sdf/copyUtils.h @@ -32,8 +32,8 @@ #include "pxr/usd/sdf/declareHandles.h" #include "pxr/usd/sdf/types.h" -#include #include +#include PXR_NAMESPACE_OPEN_SCOPE @@ -100,7 +100,7 @@ using SdfShouldCopyValueFn = std::function< bool(SdfSpecType specType, const TfToken& field, const SdfLayerHandle& srcLayer, const SdfPath& srcPath, bool fieldInSrc, const SdfLayerHandle& dstLayer, const SdfPath& dstPath, bool fieldInDst, - boost::optional* valueToCopy)>; + std::optional* valueToCopy)>; /// \class SdfCopySpecsValueEdit /// Value containing an editing operation for SdfCopySpecs. @@ -152,8 +152,8 @@ using SdfShouldCopyChildrenFn = std::function< bool(const TfToken& childrenField, const SdfLayerHandle& srcLayer, const SdfPath& srcPath, bool fieldInSrc, const SdfLayerHandle& dstLayer, const SdfPath& dstPath, bool fieldInDst, - boost::optional* srcChildren, - boost::optional* dstChildren)>; + std::optional* srcChildren, + std::optional* dstChildren)>; /// SdfShouldCopyValueFn used by the simple version of SdfCopySpec. /// @@ -170,7 +170,7 @@ SdfShouldCopyValue( SdfSpecType specType, const TfToken& field, const SdfLayerHandle& srcLayer, const SdfPath& srcPath, bool fieldInSrc, const SdfLayerHandle& dstLayer, const SdfPath& dstPath, bool fieldInDst, - boost::optional* valueToCopy); + std::optional* valueToCopy); /// SdfShouldCopyChildrenFn used by the simple version of SdfCopySpec. /// @@ -187,8 +187,8 @@ SdfShouldCopyChildren( const TfToken& childrenField, const SdfLayerHandle& srcLayer, const SdfPath& srcPath, bool fieldInSrc, const SdfLayerHandle& dstLayer, const SdfPath& dstPath, bool fieldInDst, - boost::optional* srcChildren, - boost::optional* dstChildren); + std::optional* srcChildren, + std::optional* dstChildren); /// Utility function for copying spec data at \p srcPath in \p srcLayer to /// \p destPath in \p destLayer. Various behaviors (such as which parts of the diff --git a/pxr/usd/sdf/wrapCopyUtils.cpp b/pxr/usd/sdf/wrapCopyUtils.cpp index bd3a6ecc6b..98f85f8c96 100644 --- a/pxr/usd/sdf/wrapCopyUtils.cpp +++ b/pxr/usd/sdf/wrapCopyUtils.cpp @@ -87,7 +87,7 @@ _ShouldCopyValue( SdfSpecType specType, const TfToken& field, const SdfLayerHandle& srcLayer, const SdfPath& srcPath, bool fieldInSrc, const SdfLayerHandle& dstLayer, const SdfPath& dstPath, bool fieldInDst, - boost::optional* value) + std::optional* value) { object result = pyFunc( specType, field, @@ -117,8 +117,8 @@ _ShouldCopyChildren( const TfToken& field, const SdfLayerHandle& srcLayer, const SdfPath& srcPath, bool fieldInSrc, const SdfLayerHandle& dstLayer, const SdfPath& dstPath, bool fieldInDst, - boost::optional* srcChildren, - boost::optional* dstChildren) + std::optional* srcChildren, + std::optional* dstChildren) { object result = pyFunc( field, srcLayer, srcPath, fieldInSrc, dstLayer, dstPath, fieldInDst); diff --git a/pxr/usd/usdUtils/stitch.cpp b/pxr/usd/usdUtils/stitch.cpp index f61a009ab1..125b1c5de5 100644 --- a/pxr/usd/usdUtils/stitch.cpp +++ b/pxr/usd/usdUtils/stitch.cpp @@ -107,7 +107,7 @@ _MergeValue( const TfToken& field, const VtValue& fallback, const SdfLayerHandle& srcLayer, const SdfPath& srcPath, const SdfLayerHandle& dstLayer, const SdfPath& dstPath, - boost::optional* valueToCopy) + std::optional* valueToCopy) { if (!fallback.IsHolding()) { return false; @@ -134,7 +134,7 @@ _MergeValueFn( SdfSpecType specType, const TfToken& field, const SdfLayerHandle& srcLayer, const SdfPath& srcPath, bool fieldInSrc, const SdfLayerHandle& dstLayer, const SdfPath& dstPath, bool fieldInDst, - boost::optional* valueToCopy, + std::optional* valueToCopy, const UsdUtilsStitchValueFn& stitchFn) { TF_VERIFY(srcPath == dstPath); @@ -292,8 +292,8 @@ _DontCopyChildrenFn( const TfToken& childrenField, const SdfLayerHandle& srcLayer, const SdfPath& srcPath, bool childrenInSrc, const SdfLayerHandle& dstLayer, const SdfPath& dstPath, bool childrenInDst, - boost::optional* srcChildren, - boost::optional* dstChildren) + std::optional* srcChildren, + std::optional* dstChildren) { return false; } @@ -304,8 +304,8 @@ _MergeChildren( const TfToken& field, const VtValue& fallback, const SdfLayerHandle& srcLayer, const SdfPath& srcPath, const SdfLayerHandle& dstLayer, const SdfPath& dstPath, - boost::optional* finalSrcValue, - boost::optional* finalDstValue) + std::optional* finalSrcValue, + std::optional* finalDstValue) { if (!fallback.IsHolding()) { return false; @@ -344,8 +344,8 @@ _MergeChildrenFn( const TfToken& childrenField, const SdfLayerHandle& srcLayer, const SdfPath& srcPath, bool childrenInSrc, const SdfLayerHandle& dstLayer, const SdfPath& dstPath, bool childrenInDst, - boost::optional* finalSrcChildren, - boost::optional* finalDstChildren) + std::optional* finalSrcChildren, + std::optional* finalDstChildren) { if (!childrenInSrc) { // Children on the destination spec are never cleared if the