![]() |
Geometrize
1.0
An application for geometrizing images into geometric primitives
|
Functions | |
void | debugBreak () |
debugBreak Forces the debugger to break/halt the application when this is called. More... | |
void | printToConsole (const std::string &str) |
printToConsole A convenience function for printing a string to the command-line console. More... | |
void | printToAllScriptConsoleWidgets (const std::string &str) |
printToAllScriptConsoleWidgets A convenience function for printing a string to all the GUI console widgets in the application More... | |
void | messageBox (const std::string &str) |
messageBox A convenience function for displaying a message box containing a message. More... | |
void | processApplicationEvents () |
processApplicationEvents Processes all pending application events for the calling thread. More... | |
bool | fileExists (const std::string &filePath) |
fileExists Checks if a file exists, returns true if it does. More... | |
bool | directoryExists (const std::string &dirPath) |
directoryExists Checks if a directory exists, returns true if it does. More... | |
bool | directoryContainsFile (const std::string &dirPath, const std::string &fileName) |
directoryContainsFile Checks if the directory contains the given file, returns true if it does. More... | |
std::string | readFileAsString (const std::string &filePath) |
readFileAsString Reads a file, returning a string containing the contents. More... | |
std::vector< std::string > | getFilePathsForDirectory (const std::string &dirPath) |
getFilePathsForDirectory Gets the absolute file paths to the files in the given directory. More... | |
std::vector< std::string > | getSubdirectoriesForDirectory (const std::string &dirPath) |
getSubdirectoriesForDirectory Gets the absolute paths for direct subdirectories of the given directory. More... | |
bool | endsWith (const std::string &value, const std::string &ending) |
std::vector< std::string > | getFilesWithExtension (const std::string &dirPath, const std::string &extension) |
getFilesWithExtension Gets the absolute file paths to the files with the given extension in the given directory. More... | |
std::string | getFirstFileWithExtension (const std::string &dirPath, const std::string &extension) |
getFirstFileWithExtension Gets the absolute file path to the first file with the given extension in the given directory. More... | |
std::string | getFirstFileWithExtensions (const std::string &dirPath, const std::vector< std::string > &extensions) |
getFirstFileWithExtensions Gets the absolute file path to the first file with one of the given extensions in the given directory. More... | |
std::vector< std::string > | getScriptsForPath (const std::string &path) |
getScriptsForPath Gets the absolute file paths to the script files (*.chai) for the given directory, using recursive search. More... | |
std::string | getDirectoryForFilePath (const std::string &filePath) |
getDirectoryForFilePath Gets the directory path from the given local file path. More... | |
bool | openInDefaultApplication (const std::string &path) |
openInDefaultApplication Opens the given path in the default application. More... | |
bool | revealInDefaultApplication (const std::string &path) |
revealInDefaultApplication Reveals the given path in the parent folder (or path with the filename trimmed). More... | |
void | clearGlobalClipboard () |
clearGlobalClipboard Clears the global system clipboard contents. More... | |
std::string | getGlobalClipboardText () |
getGlobalClipboardText Gets the global system clipboard text. More... | |
void | setGlobalClipboardText (const std::string &text) |
setClipboardText Sets the global system clipboard text. More... | |
bool | stringBeginsWith (const std::string &str, const std::string &prefix) |
stringBeginsWith Checks if a string begins with the given prefix. More... | |
bool | stringEndsWith (const std::string &str, const std::string &suffix) |
stringEndsWith Checks if a string ends with the given suffix. More... | |
std::string | getApplicationDirectoryLocation () |
getApplicationDirectory Get directory that the application is in. More... | |
std::string | getAppDataLocation () |
getAppDataLocation Returns a directory location where persistent application data can be stored. More... | |
std::string | getHomeDirectoryLocation () |
getHomeDirectoryLocation Returns a path to where the user's home directory is. More... | |
bool | writeStringToFile (const std::string &str, const std::string &path) |
writeStringToFile Writes the string to the file path, attempting to overwrite any existing file at the path. More... | |
std::string | percentEncode (const std::string &str) |
percentEncode Returns a percent-encoded copy of the input string. More... | |
int | randomInRange (int lower, int upper) |
randomInRange Returns a random integer in the range [lower, upper], inclusive. Note that this uses thread-local RNGs under the hood. This must not be called on the same thread as the Geometrize shape mutation code - otherwise the shape generation may not be deterministic. More... | |
std::vector< std::string > | split (const std::string &s, char delimiter) |
split Splits a given string into a vector of tokens using the given delimiter. More... | |
int | getCursorX () |
getCursorX Gets the x-coordinate of the cursor in global screen coordinates. More... | |
int | getCursorY () |
getCursorY Gets the y-coordinate of the cursor in global screen coordinates. More... | |
void | setCursorPos (int x, int y) |
setCursorPos Sets the cursor position in global screen coordinates. More... | |
std::string | getOperatingSystemProductType () |
getOperatingSystemProductType Returns the product name of the operating system this application is running in. More... | |
bool | saveWidgetScreenshot (const std::string &path, QWidget *widget) |
saveWidgetScreenshot Takes a screenshot of the given widget and saves it as a .png image to the given path. More... | |
template<typename T > | |
T | clamp (T value, T lower, T upper) |
clamp Clamps a value within a range. More... | |
template<typename T > | |
void | split (const std::string &s, const char delimiter, T result) |
std::vector< std::string > | readStringVector (const std::string &filePath) |
readStringVector Reads the JSON file containing the vector of strings at the given filepath. Will attempt to overwrite any existing file when it does this. More... | |
void | writeStringVector (const std::vector< std::string > &vec, const std::string &filePath) |
writeStringVector Writes the string vector to the given filepath as JSON. Will attempt to overwrite any existing file. More... | |
void | openTask (const QString &urlStr, bool addToRecents) |
void | openTasks (const QStringList &urls, const bool addToRecents) |
bool | openTemplate (chaiscript::ChaiScript &engine, const std::string &templateFolder) |
TemplateManifest | getTemplateManifest (const std::string &templateFolder) |
T geometrize::util::clamp | ( | T | value, |
T | lower, | ||
T | upper | ||
) |
clamp Clamps a value within a range.
value | The value to clamp. |
lower | The lower bound of the range. |
upper | The upper bound of the range. |
void geometrize::util::clearGlobalClipboard | ( | ) |
void geometrize::util::debugBreak | ( | ) |
debugBreak Forces the debugger to break/halt the application when this is called.
bool geometrize::util::directoryContainsFile | ( | const std::string & | dirPath, |
const std::string & | fileName | ||
) |
directoryContainsFile Checks if the directory contains the given file, returns true if it does.
bool geometrize::util::directoryExists | ( | const std::string & | dirPath | ) |
|
inline |
bool geometrize::util::fileExists | ( | const std::string & | filePath | ) |
std::string geometrize::util::getAppDataLocation | ( | ) |
getAppDataLocation Returns a directory location where persistent application data can be stored.
std::string geometrize::util::getApplicationDirectoryLocation | ( | ) |
int geometrize::util::getCursorX | ( | ) |
int geometrize::util::getCursorY | ( | ) |
std::string geometrize::util::getDirectoryForFilePath | ( | const std::string & | filePath | ) |
getDirectoryForFilePath Gets the directory path from the given local file path.
filePath | The filepath to chop. |
std::vector< std::string > geometrize::util::getFilePathsForDirectory | ( | const std::string & | dirPath | ) |
getFilePathsForDirectory Gets the absolute file paths to the files in the given directory.
dirPath | The directory to search. |
std::vector< std::string > geometrize::util::getFilesWithExtension | ( | const std::string & | dirPath, |
const std::string & | extension | ||
) |
getFilesWithExtension Gets the absolute file paths to the files with the given extension in the given directory.
dirPath | The directory to search. |
extension | The file extension to match. |
std::string geometrize::util::getFirstFileWithExtension | ( | const std::string & | dirPath, |
const std::string & | extension | ||
) |
getFirstFileWithExtension Gets the absolute file path to the first file with the given extension in the given directory.
dirPath | The directory to search. |
extension | The file extension to match. |
std::string geometrize::util::getFirstFileWithExtensions | ( | const std::string & | dirPath, |
const std::vector< std::string > & | extensions | ||
) |
getFirstFileWithExtensions Gets the absolute file path to the first file with one of the given extensions in the given directory.
dirPath | The directory to search. |
extensions | The file extension to match. |
std::string geometrize::util::getGlobalClipboardText | ( | ) |
std::string geometrize::util::getHomeDirectoryLocation | ( | ) |
std::string geometrize::util::getOperatingSystemProductType | ( | ) |
getOperatingSystemProductType Returns the product name of the operating system this application is running in.
std::vector< std::string > geometrize::util::getScriptsForPath | ( | const std::string & | path | ) |
getScriptsForPath Gets the absolute file paths to the script files (*.chai) for the given directory, using recursive search.
dirPath | The directory to search. |
std::vector< std::string > geometrize::util::getSubdirectoriesForDirectory | ( | const std::string & | dirPath | ) |
getSubdirectoriesForDirectory Gets the absolute paths for direct subdirectories of the given directory.
dirPath | The directory to search. |
TemplateManifest geometrize::util::getTemplateManifest | ( | const std::string & | templateFolder | ) |
void geometrize::util::messageBox | ( | const std::string & | str | ) |
bool geometrize::util::openInDefaultApplication | ( | const std::string & | path | ) |
openInDefaultApplication Opens the given path in the default application.
path | The path to the resource to open. |
void geometrize::util::openTask | ( | const QString & | urlStr, |
bool | addToRecents | ||
) |
void geometrize::util::openTasks | ( | const QStringList & | urls, |
const bool | addToRecents | ||
) |
bool geometrize::util::openTemplate | ( | chaiscript::ChaiScript & | engine, |
const std::string & | templateFolder | ||
) |
std::string geometrize::util::percentEncode | ( | const std::string & | str | ) |
percentEncode Returns a percent-encoded copy of the input string.
str | The input string, to be percent-encoded. |
void geometrize::util::printToAllScriptConsoleWidgets | ( | const std::string & | str | ) |
printToAllScriptConsoleWidgets A convenience function for printing a string to all the GUI console widgets in the application
str | The string to print to the script console widgets. |
void geometrize::util::printToConsole | ( | const std::string & | str | ) |
void geometrize::util::processApplicationEvents | ( | ) |
processApplicationEvents Processes all pending application events for the calling thread.
int geometrize::util::randomInRange | ( | int | lower, |
int | upper | ||
) |
randomInRange Returns a random integer in the range [lower, upper], inclusive. Note that this uses thread-local RNGs under the hood. This must not be called on the same thread as the Geometrize shape mutation code - otherwise the shape generation may not be deterministic.
lower | The minimum value. |
upper | The maximum value. |
std::string geometrize::util::readFileAsString | ( | const std::string & | filePath | ) |
readFileAsString Reads a file, returning a string containing the contents.
filePath | The path to the file. |
std::vector< std::string > geometrize::util::readStringVector | ( | const std::string & | filePath | ) |
readStringVector Reads the JSON file containing the vector of strings at the given filepath. Will attempt to overwrite any existing file when it does this.
filePath | The path to the file to read. |
bool geometrize::util::revealInDefaultApplication | ( | const std::string & | path | ) |
revealInDefaultApplication Reveals the given path in the parent folder (or path with the filename trimmed).
path | The path to the resource to view. |
bool geometrize::util::saveWidgetScreenshot | ( | const std::string & | path, |
QWidget * | widget | ||
) |
saveWidgetScreenshot Takes a screenshot of the given widget and saves it as a .png image to the given path.
path | The file path to save the screenshot to. |
widget | The widget to take a screenshot of. |
void geometrize::util::setCursorPos | ( | int | x, |
int | y | ||
) |
void geometrize::util::setGlobalClipboardText | ( | const std::string & | text | ) |
void geometrize::util::split | ( | const std::string & | s, |
const char | delimiter, | ||
T | result | ||
) |
std::vector< std::string > geometrize::util::split | ( | const std::string & | s, |
char | delimiter | ||
) |
split Splits a given string into a vector of tokens using the given delimiter.
s | The string to split. |
delimiter | The delimiter to split on. |
bool geometrize::util::stringBeginsWith | ( | const std::string & | str, |
const std::string & | prefix | ||
) |
stringBeginsWith Checks if a string begins with the given prefix.
str | The string to check. |
prefix | The prefix to check for. |
bool geometrize::util::stringEndsWith | ( | const std::string & | str, |
const std::string & | suffix | ||
) |
stringEndsWith Checks if a string ends with the given suffix.
str | The string to check. |
suffix | The suffix ending to check for. |
bool geometrize::util::writeStringToFile | ( | const std::string & | str, |
const std::string & | path | ||
) |
writeStringToFile Writes the string to the file path, attempting to overwrite any existing file at the path.
str | The string to write to file. |
path | The file path to write to. |
void geometrize::util::writeStringVector | ( | const std::vector< std::string > & | vec, |
const std::string & | filePath | ||
) |
writeStringVector Writes the string vector to the given filepath as JSON. Will attempt to overwrite any existing file.
text | The vector of strings to write. |
filePath | The path of the file to write to. |