Skip to content

Commit 182dbf8

Browse files
committed
Integrate StringUtils::Multiply
Signed-off-by: Mei Chu <meimchu@gmail.com>
1 parent bb69820 commit 182dbf8

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

src/OpenColorIO/Op.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
#include <cstring>
55
#include <sstream>
66

7-
#include <pystring.h>
8-
97
#include <OpenColorIO/OpenColorIO.h>
108

119
#include "Logging.h"
@@ -23,6 +21,7 @@
2321
#include "ops/lut1d/Lut1DOp.h"
2422
#include "ops/lut3d/Lut3DOp.h"
2523
#include "ops/range/RangeOp.h"
24+
#include "utils/StringUtils.h"
2625

2726
namespace OCIO_NAMESPACE
2827
{
@@ -478,7 +477,7 @@ std::string SerializeOpVec(const OpRcPtrVec & ops, int indent)
478477
{
479478
const OpRcPtr & op = ops[idx];
480479

481-
oss << pystring::mul(" ", indent);
480+
oss << StringUtils::Multiply(" ", indent);
482481
oss << "Op " << idx << ": " << *op << " ";
483482
oss << op->getCacheID();
484483

tests/utils/StringUtils_tests.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,3 +275,16 @@ OCIO_ADD_TEST(StringUtils, remove_contain)
275275
OCIO_CHECK_ASSERT(!StringUtils::Contain(values, "2"));
276276
}
277277
}
278+
279+
OCIO_ADD_TEST(StringUtils, multiply)
280+
{
281+
constexpr char ref[]{"10.0 9. 1 er\t1e-5f"};
282+
283+
OCIO_CHECK_EQUAL(StringUtils::Multiply(ref, 0), "");
284+
OCIO_CHECK_EQUAL(StringUtils::Multiply(ref, 1), "10.0 9. 1 er\t1e-5f");
285+
OCIO_CHECK_EQUAL(StringUtils::Multiply(ref, 2), "10.0 9. 1 er\t1e-5f10.0 9. 1 er\t1e-5f");
286+
287+
OCIO_CHECK_EQUAL(StringUtils::Multiply(" ", 0), "");
288+
OCIO_CHECK_EQUAL(StringUtils::Multiply(" ", 1), " ");
289+
OCIO_CHECK_EQUAL(StringUtils::Multiply(" ", 2), " ");
290+
}

0 commit comments

Comments
 (0)