From b1f8546b8a2b878bba326cb4b455a71f16cd033c Mon Sep 17 00:00:00 2001 From: Matt Kuruc Date: Tue, 20 Jun 2023 20:30:46 -0700 Subject: [PATCH] Replace `boost::lexical_cast` with `pxr/base/tf/stringUtils.h` --- pxr/usd/usd/stageCache.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pxr/usd/usd/stageCache.h b/pxr/usd/usd/stageCache.h index b33ce6fbf3..09c91a8ffd 100644 --- a/pxr/usd/usd/stageCache.h +++ b/pxr/usd/usd/stageCache.h @@ -28,8 +28,7 @@ #include "pxr/usd/usd/api.h" #include "pxr/usd/sdf/declareHandles.h" #include "pxr/base/tf/declarePtrs.h" - -#include +#include "pxr/base/tf/stringUtils.h" #include #include @@ -107,7 +106,15 @@ class UsdStageCache /// Create an Id from a string value. The supplied \p val must have /// been obtained by calling ToString() previously. static Id FromString(const std::string &s) { - return FromLongInt(boost::lexical_cast(s)); + bool overflow = false; + const long int result = TfStringToLong(s, &overflow); + if (overflow) { + TF_CODING_ERROR( + "'%s' overflowed during conversion to int64_t.", + s.c_str() + ); + } + return FromLongInt(result); } /// Convert this Id to an integral representation. @@ -115,7 +122,7 @@ class UsdStageCache /// Convert this Id to a string representation. std::string ToString() const { - return boost::lexical_cast(ToLongInt()); + return TfStringify(ToLongInt()); } /// Return true if this Id is valid.