Rename coral::path::byte_size to coral::path::filled

This commit is contained in:
kayomn 2023-02-28 16:04:33 +00:00
parent 1954f97666
commit c16d5c08cb

View File

@ -33,7 +33,7 @@ export namespace coral {
* Returns a weak reference to the [path] as a [slice]. * Returns a weak reference to the [path] as a [slice].
*/ */
constexpr slice<char const> as_slice() const { constexpr slice<char const> as_slice() const {
return {this->buffer, this->byte_size()}; return {this->buffer, this->filled()};
} }
/** /**
@ -45,13 +45,6 @@ export namespace coral {
return reinterpret_cast<char const *>(this->buffer); return reinterpret_cast<char const *>(this->buffer);
} }
/**
* Returns the number of bytes composing the path.
*/
constexpr usize byte_size() const {
return max - this->buffer[max];
}
/** /**
* Compares the path to `that`, returning the difference between the two paths or `0` if they are identical. * Compares the path to `that`, returning the difference between the two paths or `0` if they are identical.
*/ */
@ -63,7 +56,7 @@ export namespace coral {
* Returns the tail pointer of the path name. * Returns the tail pointer of the path name.
*/ */
char const * end() const { char const * end() const {
return this->buffer + this->byte_size(); return this->buffer + this->filled();
} }
/** /**
@ -73,6 +66,13 @@ export namespace coral {
return coral::equals(this->as_slice().as_bytes(), that.as_slice().as_bytes()); return coral::equals(this->as_slice().as_bytes(), that.as_slice().as_bytes());
} }
/**
* Returns the number of characters composing the path.
*/
constexpr usize filled() const {
return max - this->buffer[max];
}
/** /**
* Returns the path hash code. * Returns the path hash code.
* *
@ -95,7 +95,7 @@ export namespace coral {
path joined_path = *this; path joined_path = *this;
for (char const c : text) { for (char const c : text) {
joined_path.buffer[joined_path.byte_size()] = c; joined_path.buffer[joined_path.filled()] = c;
joined_path.buffer[max] -= 1; joined_path.buffer[max] -= 1;
} }