summaryrefslogtreecommitdiffstats
path: root/source/core
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-03-02 19:14:18 -0500
committerGitHub <noreply@github.com>2020-03-02 19:14:18 -0500
commitcbba1f2ba451f31e910d59fb9efbadc5e370c095 (patch)
treecf34d86713e2f915a42ce4ece11b7da82b9d4454 /source/core
parentdbd8e8dc0847338a2a93d35385f48b5ce5671dd6 (diff)
Renamed UnownedStringSlice::size to getLength to make match String. (#1254)
Diffstat (limited to 'source/core')
-rw-r--r--source/core/slang-gcc-compiler-util.cpp2
-rw-r--r--source/core/slang-hex-dump-util.cpp4
-rw-r--r--source/core/slang-io.cpp10
-rw-r--r--source/core/slang-nvrtc-compiler.cpp2
-rw-r--r--source/core/slang-offset-container.cpp4
-rw-r--r--source/core/slang-render-api-util.cpp2
-rw-r--r--source/core/slang-string-slice-pool.cpp2
-rw-r--r--source/core/slang-string-util.cpp2
-rw-r--r--source/core/slang-string.cpp8
-rw-r--r--source/core/slang-string.h6
-rw-r--r--source/core/slang-type-text-util.cpp4
-rw-r--r--source/core/slang-visual-studio-compiler-util.cpp2
-rw-r--r--source/core/slang-writer.cpp2
13 files changed, 25 insertions, 25 deletions
diff --git a/source/core/slang-gcc-compiler-util.cpp b/source/core/slang-gcc-compiler-util.cpp
index 833ae884e..08e45b5c1 100644
--- a/source/core/slang-gcc-compiler-util.cpp
+++ b/source/core/slang-gcc-compiler-util.cpp
@@ -20,7 +20,7 @@ namespace Slang
{
if (line.startsWith(prefix))
{
- const UnownedStringSlice remainingSlice = UnownedStringSlice(line.begin() + prefix.size(), line.end()).trim();
+ const UnownedStringSlice remainingSlice = UnownedStringSlice(line.begin() + prefix.getLength(), line.end()).trim();
const Index versionEndIndex = remainingSlice.indexOf(' ');
if (versionEndIndex < 0)
{
diff --git a/source/core/slang-hex-dump-util.cpp b/source/core/slang-hex-dump-util.cpp
index b0bd6f923..69c6d3f21 100644
--- a/source/core/slang-hex-dump-util.cpp
+++ b/source/core/slang-hex-dump-util.cpp
@@ -23,7 +23,7 @@ static const char s_hex[] = "0123456789abcdef";
/* static */SlangResult HexDumpUtil::dumpWithMarkers(const uint8_t* data, size_t dataCount, int maxBytesPerLine, ISlangWriter* writer)
{
WriterHelper helper(writer);
- SLANG_RETURN_ON_FAIL(helper.write(s_start.begin(), s_start.size()));
+ SLANG_RETURN_ON_FAIL(helper.write(s_start.begin(), s_start.getLength()));
SLANG_RETURN_ON_FAIL(helper.print(" %zu", dataCount));
const int hash = GetHashCode((const char*)data, dataCount);
@@ -31,7 +31,7 @@ static const char s_hex[] = "0123456789abcdef";
SLANG_RETURN_ON_FAIL(dump(data, dataCount, maxBytesPerLine, writer));
- SLANG_RETURN_ON_FAIL(helper.write(s_end.begin(), s_end.size()));
+ SLANG_RETURN_ON_FAIL(helper.write(s_end.begin(), s_end.getLength()));
SLANG_RETURN_ON_FAIL(helper.put("\n"));
return SLANG_OK;
}
diff --git a/source/core/slang-io.cpp b/source/core/slang-io.cpp
index 6cff8e1c9..e02bbb89f 100644
--- a/source/core/slang-io.cpp
+++ b/source/core/slang-io.cpp
@@ -235,7 +235,7 @@ namespace Slang
ioBuilder.append(path);
return;
}
- if (path.size() > 0)
+ if (path.getLength() > 0)
{
// If ioBuilder doesn't end in a delimiter, add one
if (!isDelimiter(ioBuilder[ioBuilder.getLength() - 1]))
@@ -278,7 +278,7 @@ namespace Slang
/* static */ bool Path::isDriveSpecification(const UnownedStringSlice& element)
{
- switch (element.size())
+ switch (element.getLength())
{
case 0:
{
@@ -306,14 +306,14 @@ namespace Slang
/* static */bool Path::isAbsolute(const UnownedStringSlice& path)
{
- if (path.size() > 0 && isDelimiter(path[0]))
+ if (path.getLength() > 0 && isDelimiter(path[0]))
{
return true;
}
#if SLANG_WINDOWS_FAMILY
// Check for the \\ network drive style
- if (path.size() >= 2 && path[0] == '\\' && path[1] == '\\')
+ if (path.getLength() >= 2 && path[0] == '\\' && path[1] == '\\')
{
return true;
}
@@ -348,7 +348,7 @@ namespace Slang
}
// Okay if the end is empty. And we aren't with a spec like // or c:/ , then drop the final slash
- if (splitOut.getCount() > 1 && splitOut.getLast().size() == 0)
+ if (splitOut.getCount() > 1 && splitOut.getLast().getLength() == 0)
{
if (splitOut.getCount() == 2 && isDriveSpecification(splitOut[0]))
{
diff --git a/source/core/slang-nvrtc-compiler.cpp b/source/core/slang-nvrtc-compiler.cpp
index 27d269125..2f9944786 100644
--- a/source/core/slang-nvrtc-compiler.cpp
+++ b/source/core/slang-nvrtc-compiler.cpp
@@ -181,7 +181,7 @@ static bool _isDriveLetter(char c)
static bool _hasDriveLetter(const UnownedStringSlice& line)
{
- return line.size() > 2 && line[1] == ':' && _isDriveLetter(line[0]);
+ return line.getLength() > 2 && line[1] == ':' && _isDriveLetter(line[0]);
}
static SlangResult _parseNVRTCLine(const UnownedStringSlice& line, DownstreamDiagnostic& outDiagnostic)
diff --git a/source/core/slang-offset-container.cpp b/source/core/slang-offset-container.cpp
index 5fed2a452..75852c990 100644
--- a/source/core/slang-offset-container.cpp
+++ b/source/core/slang-offset-container.cpp
@@ -79,7 +79,7 @@ size_t OffsetString::calcEncodedSize(size_t size, uint8_t encode[kMaxSizeEncodeS
/* static */size_t OffsetString::calcAllocationSize(const UnownedStringSlice& slice)
{
- return calcAllocationSize(slice.size());
+ return calcAllocationSize(slice.getLength());
}
UnownedStringSlice OffsetString::getSlice() const
@@ -166,7 +166,7 @@ void* OffsetContainer::allocateAndZero(size_t size, size_t alignment)
Offset32Ptr<OffsetString> OffsetContainer::newString(const UnownedStringSlice& slice)
{
- size_t stringSize = slice.size();
+ size_t stringSize = slice.getLength();
uint8_t head[OffsetString::kMaxSizeEncodeSize];
size_t headSize = OffsetString::calcEncodedSize(stringSize, head);
diff --git a/source/core/slang-render-api-util.cpp b/source/core/slang-render-api-util.cpp
index 960537a0b..edf8c13ca 100644
--- a/source/core/slang-render-api-util.cpp
+++ b/source/core/slang-render-api-util.cpp
@@ -122,7 +122,7 @@ enum class Token
static Token nextToken(Slang::UnownedStringSlice& textInOut, Slang::UnownedStringSlice& lexemeOut)
{
using namespace Slang;
- if (textInOut.size() <= 0)
+ if (textInOut.getLength() <= 0)
{
return Token::eEnd;
}
diff --git a/source/core/slang-string-slice-pool.cpp b/source/core/slang-string-slice-pool.cpp
index 7ea15e0d6..be7bec785 100644
--- a/source/core/slang-string-slice-pool.cpp
+++ b/source/core/slang-string-slice-pool.cpp
@@ -50,7 +50,7 @@ StringSlicePool::Handle StringSlicePool::add(const Slice& slice)
}
// Create a scoped copy
- UnownedStringSlice scopePath(m_arena.allocateString(slice.begin(), slice.size()), slice.size());
+ UnownedStringSlice scopePath(m_arena.allocateString(slice.begin(), slice.getLength()), slice.getLength());
const auto index = m_slices.getCount();
diff --git a/source/core/slang-string-util.cpp b/source/core/slang-string-util.cpp
index cd79ffce7..32f017f46 100644
--- a/source/core/slang-string-util.cpp
+++ b/source/core/slang-string-util.cpp
@@ -208,7 +208,7 @@ ComPtr<ISlangBlob> StringUtil::createStringBlob(const String& string)
return slice;
}
- const Index numChars = slice.size();
+ const Index numChars = slice.getLength();
const char* srcChars = slice.begin();
StringBuilder builder;
diff --git a/source/core/slang-string.cpp b/source/core/slang-string.cpp
index 22049f82d..df711218c 100644
--- a/source/core/slang-string.cpp
+++ b/source/core/slang-string.cpp
@@ -74,8 +74,8 @@ namespace Slang
bool UnownedStringSlice::startsWith(UnownedStringSlice const& other) const
{
- UInt thisSize = size();
- UInt otherSize = other.size();
+ UInt thisSize = getLength();
+ UInt otherSize = other.getLength();
if (otherSize > thisSize)
return false;
@@ -91,8 +91,8 @@ namespace Slang
bool UnownedStringSlice::endsWith(UnownedStringSlice const& other) const
{
- UInt thisSize = size();
- UInt otherSize = other.size();
+ UInt thisSize = getLength();
+ UInt otherSize = other.getLength();
if (otherSize > thisSize)
return false;
diff --git a/source/core/slang-string.h b/source/core/slang-string.h
index 357eb726e..3fb612af3 100644
--- a/source/core/slang-string.h
+++ b/source/core/slang-string.h
@@ -93,7 +93,7 @@ namespace Slang
return m_end;
}
- Index size() const
+ Index getLength() const
{
return Index(m_end - m_begin);
}
@@ -134,8 +134,8 @@ namespace Slang
// Note that memcmp is undefined when passed in null ptrs, so if we want to handle
// we need to cover that case.
// Can only be nullptr if size is 0.
- auto thisSize = size();
- auto otherSize = other.size();
+ auto thisSize = getLength();
+ auto otherSize = other.getLength();
if (thisSize != otherSize)
{
diff --git a/source/core/slang-type-text-util.cpp b/source/core/slang-type-text-util.cpp
index 376efe0a9..8db294cdb 100644
--- a/source/core/slang-type-text-util.cpp
+++ b/source/core/slang-type-text-util.cpp
@@ -193,7 +193,7 @@ static const CompileTargetInfo s_compileTargetInfos[] =
/* static */SlangCompileTarget TypeTextUtil::findCompileTargetFromExtension(const UnownedStringSlice& slice)
{
- if (slice.size())
+ if (slice.getLength())
{
for (const auto& info : s_compileTargetInfos)
{
@@ -208,7 +208,7 @@ static const CompileTargetInfo s_compileTargetInfos[] =
/* static */ SlangCompileTarget TypeTextUtil::findCompileTargetFromName(const UnownedStringSlice& slice)
{
- if (slice.size())
+ if (slice.getLength())
{
for (const auto& info : s_compileTargetInfos)
{
diff --git a/source/core/slang-visual-studio-compiler-util.cpp b/source/core/slang-visual-studio-compiler-util.cpp
index 8dcc97654..af05c9c95 100644
--- a/source/core/slang-visual-studio-compiler-util.cpp
+++ b/source/core/slang-visual-studio-compiler-util.cpp
@@ -291,7 +291,7 @@ static SlangResult _parseVisualStudioLine(const UnownedStringSlice& line, Downst
outDiagnostic.stage = Diagnostic::Stage::Link;
outDiagnostic.type = Diagnostic::Type::Info;
- outDiagnostic.text = UnownedStringSlice(line.begin() + linkPrefix.size(), line.end());
+ outDiagnostic.text = UnownedStringSlice(line.begin() + linkPrefix.getLength(), line.end());
return SLANG_OK;
}
diff --git a/source/core/slang-writer.cpp b/source/core/slang-writer.cpp
index 0688bea6c..0f8286553 100644
--- a/source/core/slang-writer.cpp
+++ b/source/core/slang-writer.cpp
@@ -59,7 +59,7 @@ SlangResult WriterHelper::put(const char* text)
SlangResult WriterHelper::put(const UnownedStringSlice& text)
{
- return m_writer->write(text.begin(), text.size());
+ return m_writer->write(text.begin(), text.getLength());
}
/* !!!!!!!!!!!!!!!!!!!!!!!!! BaseWriter !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/