Rename coral::path::byte_size to coral::path::filled
This commit is contained in:
parent
1954f97666
commit
c16d5c08cb
@ -33,7 +33,7 @@ export namespace coral {
|
||||
* Returns a weak reference to the [path] as a [slice].
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@ -63,7 +56,7 @@ export namespace coral {
|
||||
* Returns the tail pointer of the path name.
|
||||
*/
|
||||
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());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of characters composing the path.
|
||||
*/
|
||||
constexpr usize filled() const {
|
||||
return max - this->buffer[max];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path hash code.
|
||||
*
|
||||
@ -95,7 +95,7 @@ export namespace coral {
|
||||
path joined_path = *this;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ export namespace coral {
|
||||
/**
|
||||
* Attempts to read the file in `target_path`, calling `then` if it was successfully opened for reading and
|
||||
* passing the [file_reader] context along.
|
||||
*
|
||||
*
|
||||
* See [file_reader] for more information on how to read from the file.
|
||||
*/
|
||||
virtual void read_file(path const & target_path, closure<void(file_reader &)> const & then) {}
|
||||
@ -183,9 +183,9 @@ export namespace coral {
|
||||
/**
|
||||
* Attempts to write a file in the file system located at `target_path`, calling `then` if it was successfully
|
||||
* created and / or opened for writing and passing the [file_writer] context along.
|
||||
*
|
||||
*
|
||||
* See [file_writer] for more information on how to write to the file.
|
||||
*
|
||||
*
|
||||
* *Note*: Any file already existing at `target_path` will be overwritten to create a new file for writing.
|
||||
*/
|
||||
virtual void write_file(path const & target_path, closure<void(file_writer &)> const & then) {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user