Skip to content

Commit

Permalink
Merge branch 'samtupy:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathans859 authored Nov 5, 2024
2 parents ec52690 + b5924d7 commit 7356bad
Show file tree
Hide file tree
Showing 39 changed files with 101 additions and 79 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
Determine if a key exists in the JSON object.
bool json_object::exists(string key);
bool json_object::exists(const string?&in key);
## Arguments:
* string: the key to search for.
* const string&in key: the key to search for.
## Returns:
bool: true if the key exists, false if not.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
Remove a value from the JSON object given a key.
void json_object::remove(string key);
void json_object::remove(const string&in key);
## Arguments:
* string key: the key of the value to remove.
* const string&in key: the key of the value to remove.
*/

// Example:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
Set a value in a JSON object.
void json_object::set(string key, var@ value);
void json_object::set(const string&in key, var@ value);
## Arguments:
* string key: the key to give the value.
* const string&in key: the key to give the value.
* var@ value: a handle to the value to be set.
*/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
Get a value out of the JSON object with literal syntax, for example `json["key"]`.
var@ json_object::get_opIndex(string key) property;
var@ json_object::get_opIndex(const string&in key) property;
## Arguments:
* string key: the key of the object to get.
* const string&in key: the key of the object to get.
## Returns:
var@: a handle to the object, or null if not found.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
Get a value out of a JSON object using a query.
var@ json_object::opCall(string query);
var@ json_object::opCall(const string&in query);
## Arguments:
* string query: the JSON query (see the remarks section for details).
* const string&in query: the JSON query (see the remarks section for details).
## Returns:
var@: a handle to the object, null if not found.
## Remarks:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
Set a value in the JSON object with a particular key.
void json_object::set_opIndex(string key, var@ value) property;
void json_object::set_opIndex(const string&in key, var@ value) property;
## Arguments:
* string key: the key of the object.
* const string&in key: the key of the object.
* var@ value: the value to set.
*/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# add_file
Add a file on disk to a pack.

`bool pack::add_file(string disk_filename, string pack_filename, bool allow_replace = false);`
`bool pack::add_file(const string&in disk_filename, const string&in pack_filename, bool allow_replace = false);`

## Arguments:
* string disk_filename: the filename of the file to add to the pack.
* string pack_filename: the name the file should have in your pack.
* const string&in disk_filename: the filename of the file to add to the pack.
* const string&in pack_filename: the name the file should have in your pack.
* bool allow_replace = false: if a file already exists in the pack with that name, should it be overwritten?

## Returns:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# add_memory
Add content stored in memory to a pack.

`bool pack::add_memory(string pack_filename, string data, bool replace = false);`
`bool pack::add_memory(const string&in pack_filename, const string&in data, bool replace = false);`

## Arguments:
* string pack_filename: the name the file should have in your pack.
* string data: a string containing the data to be added.
* const string&in pack_filename: the name the file should have in your pack.
* const string&in data: a string containing the data to be added.
* bool allow_replace = false: if a file already exists in the pack with that name, should it be overwritten?

## Returns:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# delete_file
Attempt to remove a file from a pack.

`bool pack::delete_file(string filename);`
`bool pack::delete_file(const string&in filename);`

## Arguments:
* string filename: the name of the file to be deleted.
* const string&in filename: the name of the file to be deleted.

## Returns:
bool: true if the file was successfully deleted, false otherwise.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# file_exists
Query whether or not a file exists in your pack.

`bool pack::file_exists(string filename);`
`bool pack::file_exists(const string&in filename);`

## Arguments:
* string filename: the name of the file to query.
* const string&in filename: the name of the file to query.

## Returns:
bool: true if the file exists in the pack, false if not.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# get_file_offset
Get the offset of a file in your pack.

`uint pack::get_file_offset(string filename);`
`uint pack::get_file_offset(const string&in filename);`

## Arguments:
* string filename: the name of the file to get the offset of.
* const string&in filename: the name of the file to get the offset of.

## Returns:
uint: the offset of the file (in bytes).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# get_file_size
Returns the size of a particula file in the pack.

`uint pack::get_file_size(string filename);`
`uint pack::get_file_size(const string&in filename);`

## Arguments:
* string filename: the name of the file to query the size of.
* const string&in filename: the name of the file to query the size of.

## Returns:
uint: the size of the file (in bytes), or 0 if no file with that name was found.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# open
Open a pack to perform operations on it.

`bool pack::open(string filename, uint mode, bool memload = false);`
`bool pack::open(const string&in filename, uint mode, bool memload = false);`

## Arguments:
* string filename: the name of the pack file to open.
* const string&in filename: the name of the pack file to open.
* uint mode: the mode to open the pack in (see `pack_open_modes` for more information).
* bool memload = false: whether or not the pack should be loaded from memory as opposed to on disk.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# read_file
Get the contents of a file contained in a pack.

`string pack::read_file(string pack_filename, uint offset_in_file, uint size);`
`string pack::read_file(const string&in pack_filename, uint offset_in_file, uint size);`

## Arguments:
* string pack_filename: the name of the file to be read.
* const string&in pack_filename: the name of the file to be read.
* uint offset_in_file: the offset within the file to begin reading data from (do not confuse this with pack::get_file_offset)
* uint size: the number of bytes to read (see `pack::get_file_size` to read the entire file).

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# set_pack_identifier
Set the identifier of this pack object (e.g. the first 8-bytes that determine if you have a valid pack or not).

`bool pack::set_pack_identifier(string ident);`
`bool pack::set_pack_identifier(const string&in ident);`

## Arguments:
* string ident: the new identifier (see remarks).
* const string&in ident: the new identifier (see remarks).

## Returns:
bool: true if the pack's identifier was properly set, false otherwise.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
The regexp object allows for the easy usage of regular expressions in NVGT.
regexp(string pattern, int options = RE_UTF8);
regexp(const string&in pattern, int options = RE_UTF8);
## Arguments:
* string pattern: the regular expression's pattern (see remarks).
* const string&in pattern: the regular expression's pattern (see remarks).
* int options = RE_UTF8: a combination of any of the values from the `regexp_options` enum.
## Remarks:
Regular expressions are a language used for matching, substituting, and otherwise manipulating text. To learn about the regular expression syntax that nVGT uses (called PCRE), see this link: https://en.wikipedia.org/wiki/Perl_Compatible_Regular_Expressions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# match
Determine if the regular expression matches against a particular string or not.

1. `bool regexp::match(string subject, uint64 offset = 0);`
2. `bool regexp::match(string subject, uint64 offset, int options);`
1. `bool regexp::match(const string&in subject, uint64 offset = 0);`
2. `bool regexp::match(const string&in subject, uint64 offset, int options);`

## Arguments (1):
* string subject: the string to compare against.
* const string&in subject: the string to compare against.
* uint64 offset = 0: the offset to start the comparison at.

## Arguments (2):
* string subject: the string to compare against.
* const string&in subject: the string to compare against.
* uint64 offset: the offset to start the comparison at.
* int options: any combination of the values found in the `regexp_options` enum.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
Return the ascii value for the given character.
uint8 character_to_ascii(string character);
uint8 character_to_ascii(const string&in character);
## Arguments:
* string character: the character to convert.
* const string&in character: the character to convert.
## Returns:
uint8: the ascii value for the given character.
## Remarks:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
turn an array into a string, with each element being separated by the given delimiter.
string join(string[] elements, string delimiter);
string join(const string[]@ elements, const string&in delimiter);
## Arguments:
* string[] elements: the array to join.
* string delimiter: the delimiter used to separate each element in the array (can be empty).
* const string[]@ elements: a handle to the array to join.
* const string&in delimiter: the delimiter used to separate each element in the array (can be empty).
## Returns:
string: the given array as a string.
## Remarks:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# pack_set_global_identifier
Set the global identifier of all your packs (e.g. the first 8-bytes that determine if you have a valid pack or not).

`bool pack_set_global_identifier(string ident);`
`bool pack_set_global_identifier(const string&in ident);`

## Arguments:
* string ident: the new identifier (see remarks).
* const string&in ident: the new identifier (see remarks).

## Returns:
bool: true if the identifier was properly set, false otherwise.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
Test if the text matches the specified regular expression.
bool regexp_match(string text, string pattern);
bool regexp_match(const string&in text, const string&in pattern);
## Arguments:
* string text: the text to compare against the regular expression.
* string pattern: the regular expression to match.
* const string&in text: the text to compare against the regular expression.
* const string&in pattern: the regular expression to match.
## Returns:
bool: true if the text matches the given regular expression, false otherwise.
## Remarks:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
Decodes a string from base32.
string string_base32_decode(string the_data);
string string_base32_decode(const string&in the_data);
## Arguments:
* string the_data: The data that is to be decoded.
* const string&in the_data: The data that is to be decoded.
## Returns:
String: The decoded string on success or an empty string on failure.
## Remarks:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
Encodes a string as base32.
string string_base32_encode(string the_data);
string string_base32_encode(const string&in the_data);
## Arguments:
* string the_data: The data that is to be encoded.
* const string&in the_data: The data that is to be encoded.
## Returns:
String: The encoded string on success or an empty string on failure.
## Remarks:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
Normalize a string to conform to the base32 spec.
string string_base32_normalize(string the_data);
string string_base32_normalize(const string&in the_data);
## Arguments:
* string the_data: the string to normalize.
* const string&in the_data: the string to normalize.
## Returns:
string: the normalized string.
## Remarks:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
Decodes a string which has previously been encoded in base64.
string string_base64_decode(string the_data, string_base64_options options = STRING_BASE64_PADLESS);
string string_base64_decode(const string&in the_data, string_base64_options options = STRING_BASE64_PADLESS);
## Arguments:
* string the_data: The data that is to be decoded.
* const string&in the_data: The data that is to be decoded.
* string_base64_options options = STRING_BASE64_PADLESS: A bitwise of options that control the behavior of the decoding (see remarks).
## Returns:
String: The decoded string on success or an empty string on failure.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
Encodes a string as base64.
string string_base64_encode(string the_data, string_base64_options options = STRING_BASE64_DEFAULT);
string string_base64_encode(const string&in the_data, string_base64_options options = STRING_BASE64_DEFAULT);
## Arguments:
* string the_data: The data that is to be encoded.
* const string&in the_data: The data that is to be encoded.
* string_base64_options options = STRING_BASE64_DEFAULT: A bitwise of options that control the behavior of the encoding (see remarks).
## Returns:
String: The encoded string on success or an empty string on failure.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
Print a message to the C debugger.
void c_debug_message(string message);
void c_debug_message(const string&in message);
## Arguments:
* Message: The message to print to the C debugger's console.
* const string&in message: The message to print to the C debugger's console.
*/

// Example:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
Throws an exception with a particular message.
void throw(string msg);
void throw(const string&in msg);
## Arguments:
* string msg: the message to include in your exception.
* const string&in msg: the message to include in your exception.
## Remarks:
This is presently slightly limited, the only value of the exception you can set is the message. There are plans to expand this in the future.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
Brailles a string through the currently active screen reader, if supported.
bool screen_reader_braille(string text);
bool screen_reader_braille(const string&in text);
## Arguments:
* string text: the text to braille.
* const string&in text: the text to braille.
## Returns:
bool: true if the function succeeded, false otherwise.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
Speaks and brailles a string through the currently active screen reader, if supported.
bool screen_reader_output(string text, bool interrupt = true);
bool screen_reader_output(const string&in text, bool interrupt = true);
## Arguments:
* string text: the text to output.
* const string&in text: the text to output.
* bool interrupt = true: Whether or not the previously spoken speech should be interrupted or not when speaking the new string.
## Returns:
bool: true if the function succeeded, false otherwise.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
Speaks a string through the currently active screen reader, if supported.
bool screen_reader_speak(string text, bool interrupt = true);
bool screen_reader_speak(const string&in text, bool interrupt = true);
## Arguments:
* string text: the text to speak.
* const string&in text: the text to speak.
* bool interrupt = true: Whether or not the previously spoken speech should be interrupted or not when speaking the new string.
## Returns:
bool: true if the function succeeded, false otherwise.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
Speak a string of text through the currently active TTS voice.
bool tts_voice::speak(string text, bool interrupt = false);
bool tts_voice::speak(const string &in text, bool interrupt = false);
## Arguments:
* string text: the text to be spoken.
* const string&in text: the text to be spoken.
* bool interrupt = false: whether or not to interrupt the previously speaking speech to speak the new string.
## Returns:
bool: true if speech was successful, false otherwise.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
Speaks a string (forcefully interrupting) through the currently active text-to-speech voice.
bool tts_voice::speak_interrupt(string text);
bool tts_voice::speak_interrupt(const string&in text);
## Arguments:
* string text: the text to speak.
* const string&in text: the text to speak.
## Returns:
bool: true if the speech was generated successfully, false otherwise.
*/
Expand Down
Loading

0 comments on commit 7356bad

Please sign in to comment.