|
GlistEngine
|
#include <string>#include <sstream>#include <ostream>#include <iostream>#include <iomanip>#include "utf8.h"#include <stdlib.h>#include <wchar.h>#include <vector>#include <memory>#include "gConstants.h"#include "gKeyCode.h"#include "gGUIEvents.h"#include "tinyfiledialogs.h"#include "gColor.h"#include <cstdint>#include <deque>

Go to the source code of this file.
Classes | |
| class | gUTF8Iterator |
| class | gLog |
| class | gLogi |
| class | gLogd |
| class | gLogw |
| class | gLoge |
| class | gUtils |
Macros | |
| #define | UTILS_GUTILS_H_ |
| #define | PI 3.14159265358979323846 |
Functions | |
| int | gDefaultWidth () |
| int | gDefaultHeight () |
| int | gDefaultUnitWidth () |
| int | gDefaultUnitHeight () |
| int | gDefaultMonitorWidth () |
| int | gDefaultMonitorHeight () |
| int | gDefaultScreenScaling () |
| float | gRadToDeg (float radians) |
| float | gDegToRad (float degrees) |
| void | gSeedRandom () |
| float | gRandom (float max) |
| float | gRandomf () |
| uint64_t | gGetSystemTimeMillis () |
| unsigned int | gGetUnixTime () |
| int | gGetYear () |
| int | gGetMonth () |
| int | gGetDay () |
| int | gGetWeekday () |
| int | gGetHours () |
| int | gGetMinutes () |
| int | gGetSeconds () |
| void | gFlipImageDataVertically (unsigned char *pixelData, int width, int height, int numChannels) |
| std::string | gGetTimestampString () |
| std::string | gGetTimestampString (const std::string &format) |
| void | gStringReplace (std::string &input, const std::string &searchStr, const std::string &replaceStr) |
| std::locale | gGetLocale (const std::string &locale) |
| std::string | gToLower (const std::string &src, const std::string &locale="") |
| std::string | gToUpper (const std::string &src, const std::string &locale="") |
| std::vector< std::string > | gSplitString (const std::string &textToSplit, const std::string &delimiter) |
| std::deque< std::string > | gSplitStringToDeque (const std::string &textToSplit, const std::string &delimiter) |
| std::string | gReplaceAll (const std::string &source, const std::string &from, const std::string &to) |
| bool | gIsValidFilename (std::string fileName) |
| std::string | gGetFirstLineOfTextFile (std::string fullFilepath) |
| bool | gIsInt (const std::string &str) |
| bool | gIsFloat (const std::string &str) |
| bool | gIsNumber (const std::string &str) |
| bool | gIsString (const std::string &str) |
| template<class T > | |
| std::string | gToStr (const T &numValue) |
| template<class T > | |
| std::string | gToHex (const T &numValue, int width=sizeof(T) *2) |
| template<class T > | |
| std::string | gToStr (const T &value, int width, char fill) |
| int | gToInt (const std::string &intString) |
| float | gToFloat (const std::string &floatString) |
| double | gToDouble (const std::string &doubleString) |
| std::string | gWStrToStr (const std::wstring &s) |
| template<typename T > | |
| int | gSign (T val) |
| std::string | gCodepointToStr (unsigned int codepoint) |
| std::string | gEncodeBase64 (unsigned char *data, int len) |
| std::string | gDecodeBase64 (const std::string &encoded_string) |
| bool | gIsBase64 (char c) |
| bool | gIsOnline () |
| void | gOpenUrlInDefaultBrowser (std::string url) |
| void | gEnableLogging () |
| void | gDisableLogging () |
| bool | gIsLoggingEnabled () |
| template<typename T > | |
| T | gClamp (T t, T min, T max) |
| std::string | gShowOpenFileDialog (const std::string &dialogTitle, const std::string &defaultPathAndFile, int filterNum, const std::string *filterPatterns, const std::string &filterDescription, bool isMultipleSelectionAllowed=false) |
| std::string | gShowOpenFileDialog (const std::string &dialogTitle, const std::string &defaultPathAndFile, std::initializer_list< const char * > filterPatterns, const std::string &filterDescription, bool isMultipleSelectionAllowed=false) |
| std::string | gShowOpenFileDialog (const std::string &dialogTitle, const std::string &defaultPathAndFile, int filterNum, const char **filterPatterns, const std::string &filterDescription, bool isMultipleSelectionAllowed=false) |
| std::string | gShowSaveFileDialog (const std::string &dialogTitle, const std::string &defaultPathAndFile, int filterNum, const std::string *filterPatterns, const std::string &filterDescription) |
| std::string | gShowSaveFileDialog (const std::string &dialogTitle, const std::string &defaultPathAndFile, std::initializer_list< const char * > filterPatterns, const std::string &filterDescription) |
| std::string | gShowSaveFileDialog (const std::string &dialogTitle, const std::string &defaultPathAndFile, int filterNum, const char **filterPatterns, const std::string &filterDescription) |
| std::string | gShowSelectFolderDialog (const std::string &dialogTitle, const std::string &defaultPath) |
| int | gShowMessageBox (const std::string &title, const std::string &message, const std::string &dialogue, const std::string &iconType, int defaultButton) |
| std::string | gShowInputBox (const std::string &title, const std::string &message, const std::string &defaultInput) |
| gColor | gShowColorChooser (const std::string &title, const std::string &defaultHex, unsigned char const defaultRGB[3]) |
| bool | gCheckCollision (int xLeft1, int yUp1, int xRight1, int yBottom1, int xLeft2, int yUp2, int xRight2, int yBottom2) |
| bool | gCheckPixelPerfectCollision (gImage *image1, int x1, int y1, gImage *image2, int x2, int y2) |
| std::string | gFixPath (const std::string &path) |
| #define PI 3.14159265358979323846 |
| #define UTILS_GUTILS_H_ |
| bool gCheckCollision | ( | int | xLeft1, |
| int | yUp1, | ||
| int | xRight1, | ||
| int | yBottom1, | ||
| int | xLeft2, | ||
| int | yUp2, | ||
| int | xRight2, | ||
| int | yBottom2 | ||
| ) |
| bool gCheckPixelPerfectCollision | ( | gImage * | image1, |
| int | x1, | ||
| int | y1, | ||
| gImage * | image2, | ||
| int | x2, | ||
| int | y2 | ||
| ) |
| T gClamp | ( | T | t, |
| T | min, | ||
| T | max | ||
| ) |
| std::string gCodepointToStr | ( | unsigned int | codepoint | ) |
| std::string gDecodeBase64 | ( | const std::string & | encoded_string | ) |
| int gDefaultHeight | ( | ) |
| int gDefaultMonitorHeight | ( | ) |
| int gDefaultMonitorWidth | ( | ) |
| int gDefaultScreenScaling | ( | ) |
| int gDefaultUnitHeight | ( | ) |
| int gDefaultUnitWidth | ( | ) |
| int gDefaultWidth | ( | ) |
| float gDegToRad | ( | float | degrees | ) |
| void gDisableLogging | ( | ) |
| void gEnableLogging | ( | ) |
| std::string gEncodeBase64 | ( | unsigned char * | data, |
| int | len | ||
| ) |
| std::string gFixPath | ( | const std::string & | path | ) |
| void gFlipImageDataVertically | ( | unsigned char * | pixelData, |
| int | width, | ||
| int | height, | ||
| int | numChannels | ||
| ) |
| int gGetDay | ( | ) |
| std::string gGetFirstLineOfTextFile | ( | std::string | fullFilepath | ) |
| int gGetHours | ( | ) |
| std::locale gGetLocale | ( | const std::string & | locale | ) |
| int gGetMinutes | ( | ) |
| int gGetMonth | ( | ) |
| int gGetSeconds | ( | ) |
| uint64_t gGetSystemTimeMillis | ( | ) |
| std::string gGetTimestampString | ( | ) |
| std::string gGetTimestampString | ( | const std::string & | format | ) |
| unsigned int gGetUnixTime | ( | ) |
| int gGetWeekday | ( | ) |
| int gGetYear | ( | ) |
| bool gIsBase64 | ( | char | c | ) |
| bool gIsFloat | ( | const std::string & | str | ) |
| bool gIsInt | ( | const std::string & | str | ) |
| bool gIsLoggingEnabled | ( | ) |
| bool gIsNumber | ( | const std::string & | str | ) |
| bool gIsOnline | ( | ) |
| bool gIsString | ( | const std::string & | str | ) |
| bool gIsValidFilename | ( | std::string | fileName | ) |
| void gOpenUrlInDefaultBrowser | ( | std::string | url | ) |
| float gRadToDeg | ( | float | radians | ) |
| float gRandom | ( | float | max | ) |
| float gRandomf | ( | ) |
| std::string gReplaceAll | ( | const std::string & | source, |
| const std::string & | from, | ||
| const std::string & | to | ||
| ) |
| void gSeedRandom | ( | ) |
| gColor gShowColorChooser | ( | const std::string & | title, |
| const std::string & | defaultHex, | ||
| unsigned char const | defaultRGB[3] | ||
| ) |
Shows operating system's color chooser dialog box
| title | Dialog's title. Can be empty. |
| defaultHex | Default color in hexadecimal format (e.g., "#FF0000"). Can be empty. |
| defaultRGB | Default color in RGB format as an array of three unsigned char values (e.g., {0, 255, 255}). |
| std::string gShowInputBox | ( | const std::string & | title, |
| const std::string & | message, | ||
| const std::string & | defaultInput | ||
| ) |
Shows operating system's input dialog box
| title | Dialog's title. Can be empty. |
| message | Dialog's message text. May contain and \t or be empty. |
| defaultInput | Default input text. If empty, it will display a password box. |
| int gShowMessageBox | ( | const std::string & | title, |
| const std::string & | message, | ||
| const std::string & | dialogue, | ||
| const std::string & | iconType, | ||
| int | defaultButton | ||
| ) |
Shows operating system's message dialog box
| title | Dialog's title |
| message | Dialog's message text. May contain and \t or be empty |
| dialogue | Dialog's type. Possible values are "ok", "okcancel", "yesno", "yesnocancel" |
| iconType | Dialog's type. Possible values are "info", "warning", "error", "question" |
| std::string gShowOpenFileDialog | ( | const std::string & | dialogTitle, |
| const std::string & | defaultPathAndFile, | ||
| int | filterNum, | ||
| const char ** | filterPatterns, | ||
| const std::string & | filterDescription, | ||
| bool | isMultipleSelectionAllowed = false |
||
| ) |
| std::string gShowOpenFileDialog | ( | const std::string & | dialogTitle, |
| const std::string & | defaultPathAndFile, | ||
| int | filterNum, | ||
| const std::string * | filterPatterns, | ||
| const std::string & | filterDescription, | ||
| bool | isMultipleSelectionAllowed = false |
||
| ) |
Shows operating system's open file dialog
EXAMPLE USAGE
| dialogTitle | Dialog's title |
| defaultPathAndFile | Default path to show |
| filterNum | Filter pattern number |
| filterPatterns | A string array of the file patterns to browse |
| filterDescription | Description of the filter such as 'Image files' |
| isMultipleSelectionAllowed | Is multiple selection allowed. Default value is false. |
| std::string gShowOpenFileDialog | ( | const std::string & | dialogTitle, |
| const std::string & | defaultPathAndFile, | ||
| std::initializer_list< const char * > | filterPatterns, | ||
| const std::string & | filterDescription, | ||
| bool | isMultipleSelectionAllowed = false |
||
| ) |
Shows the operating system's open file dialog
EXAMPLE USAGE
| dialogTitle | Dialog's title. |
| defaultPathAndFile | Default path and file to display in the dialog. |
| filterPatterns | An initializer list of file patterns to filter (e.g., {"*.txt", "*.csv"}). |
| filterDescription | Description of the file filter (e.g., "Text files"). |
| isMultipleSelectionAllowed | If true, allows multiple file selection. Default is false. |
| std::string gShowSaveFileDialog | ( | const std::string & | dialogTitle, |
| const std::string & | defaultPathAndFile, | ||
| int | filterNum, | ||
| const char ** | filterPatterns, | ||
| const std::string & | filterDescription | ||
| ) |
| std::string gShowSaveFileDialog | ( | const std::string & | dialogTitle, |
| const std::string & | defaultPathAndFile, | ||
| int | filterNum, | ||
| const std::string * | filterPatterns, | ||
| const std::string & | filterDescription | ||
| ) |
| std::string gShowSaveFileDialog | ( | const std::string & | dialogTitle, |
| const std::string & | defaultPathAndFile, | ||
| std::initializer_list< const char * > | filterPatterns, | ||
| const std::string & | filterDescription | ||
| ) |
| std::string gShowSelectFolderDialog | ( | const std::string & | dialogTitle, |
| const std::string & | defaultPath | ||
| ) |
| int gSign | ( | T | val | ) |
| std::vector< std::string > gSplitString | ( | const std::string & | textToSplit, |
| const std::string & | delimiter | ||
| ) |
| std::deque< std::string > gSplitStringToDeque | ( | const std::string & | textToSplit, |
| const std::string & | delimiter | ||
| ) |
| void gStringReplace | ( | std::string & | input, |
| const std::string & | searchStr, | ||
| const std::string & | replaceStr | ||
| ) |
| double gToDouble | ( | const std::string & | doubleString | ) |
| float gToFloat | ( | const std::string & | floatString | ) |
| std::string gToHex | ( | const T & | numValue, |
| int | width = sizeof(T)*2 |
||
| ) |
| int gToInt | ( | const std::string & | intString | ) |
| std::string gToLower | ( | const std::string & | src, |
| const std::string & | locale = "" |
||
| ) |
| std::string gToStr | ( | const T & | numValue | ) |
| std::string gToStr | ( | const T & | value, |
| int | width, | ||
| char | fill | ||
| ) |
| std::string gToUpper | ( | const std::string & | src, |
| const std::string & | locale = "" |
||
| ) |
| std::string gWStrToStr | ( | const std::wstring & | s | ) |