Skip to content

Commit

Permalink
Documentation of audio_form and token_gen (#82)
Browse files Browse the repository at this point in the history
* Documentation of audio_form and token_gen

* Documentation for Token Gen has been updated, including its enum constants.
* Audio Form documentation: `set_enable_go_to_index`, and `set_disallowed_chars`.

* Update and rename token_gen_flag {.md to token_gen_flag.md
  • Loading branch information
harrymkt authored Aug 16, 2024
1 parent 83d0b3c commit 3206481
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# set_disallowed_chars
Sets the whitelist/blacklist characters of a control.

`bool audio_form::set_disallowed_chars(int control_index, string chars, bool use_only_disallowed_chars = false, string char_disallowed_description = "");`

## Arguments:
* int control_index: the index of the control.
* string chars: the characters to set.
* bool use_only_disallowed_chars = false: sets whether the control should only use the characters in this list. true means use only characters that are in the list, and false means allow only characters that are not in the list.
* string char_disallowed_description = "": the text to speak when an invalid character is inputted.

## Returns:
bool: true if the characters were successfully set, false otherwise.

## Remarks:
Setting the use_only_disallowed_chars parameter to true will restrict all characters that are not in the list. This is useful to prevent other characters in number inputs.

Setting the chars parameter to blank will clear the characters and will switch back to default.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# set_enable_go_to_index
Toggles whether the control can use go to line functionality.

`bool audio_form::set_enable_go_to_index(int control_index, bool enabled);`

## Arguments:
* int control_index: the index of the control.
* bool enabled: enables the go to line functionality.

## Returns:
bool: true if the state was successfully set, false otherwise.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Token generation include
Allows you to easily generate random strings of characters of any length.
Allows you to easily generate random strings of characters of any length in a given mode.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# token_gen_flag
This enum holds various constants that can be passed to the mode parameter in order to change how tokens are generated.

* token_gen_flag_all: Uses all characters, numbers and symbols, see below.
* token_gen_flag_characters: Uses only characters, a-z, A-Z
* token_gen_flag_numbers: Uses only numbers, 0-9
* token_gen_flag_symbols: Uses only symbols, \`\~\!\@\#\$\%\^\&\*\(\)\_\+\=\-\[\]\{\}\/\.\,\;\:\|\?\>\<\
* token_gen_flag_numbers_symbols: Uses numbers and symbols.
* token_gen_flag_characters_symbols: Uses characters and symbols.
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
/**
Generates a string of random characters, or token.
string generate_token(int token_length)
string generate_token(int token_length, int mode = token_gen_flag_all)
## Arguments:
* int token_length: the length of the token to generate.
* int mode = token_gen_flag_all: the mode to generate.
## returns:
String: a random token.
String: a random token depending on the mode.
## Remarks:
The characters used to generate the token are: "1234567890abcdefthijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".
The characters used to generate the token will depend on the mode you set. See `token_gen_flags` enum constants.
*/

// Example:
#include "token_gen.nvgt"

void main() {
alert("Info", "Your token is: " + generate_token(10));
alert("Info", "Numbers only token is: " + generate_token(10, token_gen_flag_numbers));
alert("Info", "Characters only token is: " + generate_token(10, token_gen_flag_characters));
}

0 comments on commit 3206481

Please sign in to comment.