mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 22:34:09 +02:00
Improved enumeration speed, api improvements
This commit is contained in:
parent
0cdfff4898
commit
0536a6c733
1 changed files with 26 additions and 25 deletions
|
@ -1542,7 +1542,7 @@ namespace System
|
||||||
mLength = newLength;
|
mLength = newLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Insert(int_strsize idx, char8 c)
|
public void Insert(int idx, char8 c)
|
||||||
{
|
{
|
||||||
Contract.Requires(idx >= 0);
|
Contract.Requires(idx >= 0);
|
||||||
|
|
||||||
|
@ -1557,7 +1557,7 @@ namespace System
|
||||||
mLength = newLength;
|
mLength = newLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Insert(int_strsize idx, char8 c, int count)
|
public void Insert(int idx, char8 c, int count)
|
||||||
{
|
{
|
||||||
Contract.Requires(idx >= 0);
|
Contract.Requires(idx >= 0);
|
||||||
|
|
||||||
|
@ -1576,7 +1576,7 @@ namespace System
|
||||||
mLength = newLength;
|
mLength = newLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Insert(int_strsize idx, char32 c)
|
public void Insert(int idx, char32 c)
|
||||||
{
|
{
|
||||||
Contract.Requires(idx >= 0);
|
Contract.Requires(idx >= 0);
|
||||||
|
|
||||||
|
@ -1625,7 +1625,7 @@ namespace System
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Insert(int_strsize idx, char32 c, int count)
|
public void Insert(int idx, char32 c, int count)
|
||||||
{
|
{
|
||||||
Contract.Requires(idx >= 0);
|
Contract.Requires(idx >= 0);
|
||||||
|
|
||||||
|
@ -2347,6 +2347,7 @@ namespace System
|
||||||
|
|
||||||
public RawEnumerator RawChars
|
public RawEnumerator RawChars
|
||||||
{
|
{
|
||||||
|
[Inline]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return RawEnumerator(Ptr, 0, mLength);
|
return RawEnumerator(Ptr, 0, mLength);
|
||||||
|
@ -2355,6 +2356,7 @@ namespace System
|
||||||
|
|
||||||
public UTF8Enumerator DecodedChars
|
public UTF8Enumerator DecodedChars
|
||||||
{
|
{
|
||||||
|
[Inline]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return UTF8Enumerator(Ptr, 0, mLength);
|
return UTF8Enumerator(Ptr, 0, mLength);
|
||||||
|
@ -2516,6 +2518,7 @@ namespace System
|
||||||
int_strsize mIdx;
|
int_strsize mIdx;
|
||||||
int_strsize mLength;
|
int_strsize mLength;
|
||||||
|
|
||||||
|
[Inline]
|
||||||
public this(char8* ptr, int idx, int length)
|
public this(char8* ptr, int idx, int length)
|
||||||
{
|
{
|
||||||
mPtr = ptr;
|
mPtr = ptr;
|
||||||
|
@ -2525,11 +2528,13 @@ namespace System
|
||||||
|
|
||||||
public char8 Current
|
public char8 Current
|
||||||
{
|
{
|
||||||
|
[Inline]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return mPtr[mIdx];
|
return mPtr[mIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Inline]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
mPtr[mIdx] = value;
|
mPtr[mIdx] = value;
|
||||||
|
@ -2538,6 +2543,7 @@ namespace System
|
||||||
|
|
||||||
public ref char8 CurrentRef
|
public ref char8 CurrentRef
|
||||||
{
|
{
|
||||||
|
[Inline]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return ref mPtr[mIdx];
|
return ref mPtr[mIdx];
|
||||||
|
@ -2546,6 +2552,7 @@ namespace System
|
||||||
|
|
||||||
public int Index
|
public int Index
|
||||||
{
|
{
|
||||||
|
[Inline]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return mIdx;
|
return mIdx;
|
||||||
|
@ -2554,42 +2561,29 @@ namespace System
|
||||||
|
|
||||||
public int Length
|
public int Length
|
||||||
{
|
{
|
||||||
|
[Inline]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return mLength;
|
return mLength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
[Inline]
|
||||||
{
|
public Result<char8> GetNext() mut
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Reset()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext() mut
|
|
||||||
{
|
{
|
||||||
++mIdx;
|
++mIdx;
|
||||||
if (mIdx >= mLength)
|
if (mIdx >= mLength)
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Result<char8> GetNext() mut
|
|
||||||
{
|
|
||||||
if (!MoveNext())
|
|
||||||
return .Err;
|
return .Err;
|
||||||
return Current;
|
return mPtr[mIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Inline]
|
||||||
public Result<char8*> GetNextRef() mut
|
public Result<char8*> GetNextRef() mut
|
||||||
{
|
{
|
||||||
if (!MoveNext())
|
++mIdx;
|
||||||
|
if (mIdx >= mLength)
|
||||||
return .Err;
|
return .Err;
|
||||||
return &CurrentRef;
|
return &mPtr[mIdx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2990,6 +2984,13 @@ namespace System
|
||||||
return String.[Friend]CompareOrdinalHelper(val1.mPtr, val1.mLength, val2.mPtr, val2.mLength);
|
return String.[Friend]CompareOrdinalHelper(val1.mPtr, val1.mLength, val2.mPtr, val2.mLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int CompareTo(StringView strB, bool ignoreCase = false)
|
||||||
|
{
|
||||||
|
if (ignoreCase)
|
||||||
|
return String.[Friend]CompareOrdinalIgnoreCaseHelper(Ptr, Length, strB.Ptr, strB.Length);
|
||||||
|
return String.[Friend]CompareOrdinalHelper(Ptr, Length, strB.Ptr, strB.Length);
|
||||||
|
}
|
||||||
|
|
||||||
public bool Equals(StringView str)
|
public bool Equals(StringView str)
|
||||||
{
|
{
|
||||||
if (mLength != str.[Friend]mLength)
|
if (mLength != str.[Friend]mLength)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue