Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace boost::optional with std::optional for SdfCopySpec #2702

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pxr/usd/bin/sdffilter/sdffilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<VtValue> *valueToCopy) {
std::optional<VtValue> *valueToCopy) {

if (!p.fieldMatcher || p.fieldMatcher->Match(field.GetString())) {
*valueToCopy = GetReportFieldValue(
Expand Down
10 changes: 5 additions & 5 deletions pxr/usd/sdf/copyUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ _ProcessChildField(
const SdfLayerHandle& dstLayer, const SdfPath& dstPath, bool childrenInDst,
const SdfShouldCopyChildrenFn& shouldCopyChildren, _CopyStack* copyStack)
{
boost::optional<VtValue> srcChildrenToCopy, dstChildrenToCopy;
std::optional<VtValue> srcChildrenToCopy, dstChildrenToCopy;
if (!shouldCopyChildren(
childField,
srcLayer, srcPath, childrenInSrc, dstLayer, dstPath, childrenInDst,
Expand Down Expand Up @@ -428,7 +428,7 @@ _AddFieldValueToCopy(
const SdfLayerHandle& dstLayer, const SdfPath& dstPath, bool fieldInDst,
const SdfShouldCopyValueFn& shouldCopyValue, _FieldValueList* valueList)
{
boost::optional<VtValue> value;
std::optional<VtValue> value;
if (shouldCopyValue(
specType, field,
srcLayer, srcPath, fieldInSrc, dstLayer, dstPath, fieldInDst,
Expand Down Expand Up @@ -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<VtValue>* valueToCopy)
std::optional<VtValue>* valueToCopy)
{
if (fieldInSrc) {
if (field == SdfFieldKeys->ConnectionPaths ||
Expand Down Expand Up @@ -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<VtValue>* srcChildren,
boost::optional<VtValue>* dstChildren)
std::optional<VtValue>* srcChildren,
std::optional<VtValue>* dstChildren)
{
if (fieldInSrc) {
if (childrenField == SdfChildrenKeys->ConnectionChildren ||
Expand Down
14 changes: 7 additions & 7 deletions pxr/usd/sdf/copyUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
#include "pxr/usd/sdf/declareHandles.h"
#include "pxr/usd/sdf/types.h"

#include <boost/optional.hpp>
#include <functional>
#include <optional>

PXR_NAMESPACE_OPEN_SCOPE

Expand Down Expand Up @@ -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<VtValue>* valueToCopy)>;
std::optional<VtValue>* valueToCopy)>;

/// \class SdfCopySpecsValueEdit
/// Value containing an editing operation for SdfCopySpecs.
Expand Down Expand Up @@ -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<VtValue>* srcChildren,
boost::optional<VtValue>* dstChildren)>;
std::optional<VtValue>* srcChildren,
std::optional<VtValue>* dstChildren)>;

/// SdfShouldCopyValueFn used by the simple version of SdfCopySpec.
///
Expand All @@ -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<VtValue>* valueToCopy);
std::optional<VtValue>* valueToCopy);

/// SdfShouldCopyChildrenFn used by the simple version of SdfCopySpec.
///
Expand All @@ -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<VtValue>* srcChildren,
boost::optional<VtValue>* dstChildren);
std::optional<VtValue>* srcChildren,
std::optional<VtValue>* 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
Expand Down
6 changes: 3 additions & 3 deletions pxr/usd/sdf/wrapCopyUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<VtValue>* value)
std::optional<VtValue>* value)
{
object result = pyFunc(
specType, field,
Expand Down Expand Up @@ -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<VtValue>* srcChildren,
boost::optional<VtValue>* dstChildren)
std::optional<VtValue>* srcChildren,
std::optional<VtValue>* dstChildren)
{
object result = pyFunc(
field, srcLayer, srcPath, fieldInSrc, dstLayer, dstPath, fieldInDst);
Expand Down
16 changes: 8 additions & 8 deletions pxr/usd/usdUtils/stitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<VtValue>* valueToCopy)
std::optional<VtValue>* valueToCopy)
{
if (!fallback.IsHolding<T>()) {
return false;
Expand All @@ -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<VtValue>* valueToCopy,
std::optional<VtValue>* valueToCopy,
const UsdUtilsStitchValueFn& stitchFn)
{
TF_VERIFY(srcPath == dstPath);
Expand Down Expand Up @@ -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<VtValue>* srcChildren,
boost::optional<VtValue>* dstChildren)
std::optional<VtValue>* srcChildren,
std::optional<VtValue>* dstChildren)
{
return false;
}
Expand All @@ -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<VtValue>* finalSrcValue,
boost::optional<VtValue>* finalDstValue)
std::optional<VtValue>* finalSrcValue,
std::optional<VtValue>* finalDstValue)
{
if (!fallback.IsHolding<T>()) {
return false;
Expand Down Expand Up @@ -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<VtValue>* finalSrcChildren,
boost::optional<VtValue>* finalDstChildren)
std::optional<VtValue>* finalSrcChildren,
std::optional<VtValue>* finalDstChildren)
{
if (!childrenInSrc) {
// Children on the destination spec are never cleared if the
Expand Down