![]() |
ArkScript
A small, fast, functional and scripting language for video games
|
Functions | |
bool | fileExists (const std::string &name) noexcept |
Checks if a file exists. | |
std::string | readFile (const std::string &name) |
Helper to read a file. | |
std::string | getDirectoryFromPath (const std::string &path) |
Get the directory from a path. | |
std::string | getFilenameFromPath (const std::string &path) |
Get the filename from a path. | |
std::string | canonicalRelPath (const std::string &path) |
Get the canonical relative path from a path. | |
std::vector< std::string > | splitString (const std::string &source, char sep) |
Cut a string into pieces, given a character separator. | |
bool | isDouble (const std::string &s, double *output=nullptr) |
Checks if a string is a valid double. | |
int | decPlaces (double d) |
Count the number of decimals for a double. | |
int | digPlaces (double d) |
Count the number of digits for a double. | |
int | levenshteinDistance (const std::string &str1, const std::string &str2) |
Calculate the Levenshtein distance between two strings. | |
|
inline |
Get the canonical relative path from a path.
path |
Definition at line 85 of file Files.hpp.
Referenced by Ark::internal::Parser::checkForInclude(), Ark::internal::Parser::feed(), and Ark::State::State().
int Ark::Utils::decPlaces | ( | double | d | ) |
Count the number of decimals for a double.
d |
Definition at line 5 of file Utils.cpp.
Referenced by Ark::Value::toString().
int Ark::Utils::digPlaces | ( | double | d | ) |
Count the number of digits for a double.
d |
Definition at line 21 of file Utils.cpp.
Referenced by Ark::Value::toString().
|
inlinenoexcept |
Checks if a file exists.
name | the file name |
Definition at line 29 of file Files.hpp.
Referenced by Ark::State::doFile(), Ark::VM::loadPlugin(), Ark::internal::Parser::seekFile(), and Ark::State::State().
|
inline |
Get the directory from a path.
path |
Definition at line 63 of file Files.hpp.
Referenced by Ark::internal::Parser::seekFile().
|
inline |
Get the filename from a path.
path |
Definition at line 74 of file Files.hpp.
Referenced by Ark::State::doFile(), and Ark::internal::Parser::seekFile().
|
inline |
Checks if a string is a valid double.
s | the string |
output | optional pointer to the output to avoid 2 conversions |
Definition at line 58 of file Utils.hpp.
Referenced by Ark::internal::Lexer::guessType(), and Ark::VM::safeRun().
int Ark::Utils::levenshteinDistance | ( | const std::string & | str1, |
const std::string & | str2 | ||
) |
Calculate the Levenshtein distance between two strings.
str1 | |
str2 |
Definition at line 33 of file Utils.cpp.
Referenced by Ark::Compiler::offerSuggestion().
|
inline |
Helper to read a file.
name | the file name |
Definition at line 48 of file Files.hpp.
Referenced by Ark::internal::Parser::checkForInclude(), Ark::State::compile(), main(), and Ark::internal::makeNodeBasedErrorCtx().
|
inline |
Cut a string into pieces, given a character separator.
source | |
sep |
Definition at line 34 of file Utils.hpp.
Referenced by Ark::internal::makeContext(), Ark::Compiler::mayBeFromPlugin(), Ark::State::State(), and Ark::internal::Lexer::throwTokenizingError().