![]() |
Murl Engine Lua Addon API
Version 1.0 beta
|
Utility classes, templates and functions.
Murl.Util.Base64Decoder
Murl.Util.Base64Encoder
Murl.Util.Base64State
Murl.Util.CRC32Checksum
Murl.Util.File
Murl.Util.FileTools
Murl.Util.GeoLocation
Murl.Util.MD5Checksum
Murl.Util.Marsaglia
Murl.Util.Rng
Murl.Util.Rsa
Murl.Util.TT800
Murl.Util.Well1024
Get a constant static empty data object.
Murl.Data StaticEmptyData()
Swap all bytes of a 64 bit value.
Integer SwapBytes(Integer value)
value | The value to swap the bytes. |
Check if the engine was built using the debug configuration.
Boolean IsDebugBuild()
Check if the engine was built using the release configuration.
Boolean IsReleaseBuild()
Compress a given data object using ZLib with IEnums::COMPRESSION_LEVEL_DEFAULT.
Boolean, Murl.Data Compress(Murl.ConstData uncompressedIn, Murl.Data compressedOut)
uncompressedIn | The source data object to compress. |
compressedOut | A reference to an empty Data object to receive the compressed data. |
Compress a given data object using ZLib with a specified compression level.
Boolean, Murl.Data Compress(Murl.ConstData uncompressedIn, Murl.Data compressedOut, Murl.IEnums.CompressionLevel compressionLevel)
uncompressedIn | The source data object to compress. |
compressedOut | A reference to an empty Data object to receive the compressed data. |
compressionLevel | The compression level. |
Uncompress a given data object using ZLib.
Boolean, Murl.Data Uncompress(Murl.ConstData compressedIn, Murl.Data uncompressedOut)
compressedIn | The source data object to decompress. |
uncompressedOut | A reference to an empty Data object to receive the uncompressed data. |
Encode a string to a Base64 character string.
String EncodeBase64(String dataIn)
dataIn | The source string to encode. |
Encode a data object to a Base64 character string.
String EncodeBase64(Murl.ConstData dataIn)
dataIn | The source data object to encode. |
Decode a Base64 character string.
Murl.Data DecodeBase64(String dataIn)
dataIn | The source Base64 character string to decode. |
Decode Base64 characters from a data object.
Murl.Data DecodeBase64(Murl.ConstData dataIn)
dataIn | The source data object to decode. |
Check if a string is Base64 encoded.
Boolean IsBase64(String dataIn)
dataIn | The source Base64 string. |
Check if a data object is Base64 encoded.
Boolean IsBase64(Murl.ConstData dataIn)
dataIn | The source Base64 data object. |
Encode a string to a Hex character string.
String EncodeHex(String dataIn)
dataIn | The source string to encode. |
Encode a data object to a Hex character string
String EncodeHex(Murl.ConstData dataIn)
dataIn | The source data object to encode. |
Decode a Hex character string.
Murl.Data DecodeHex(String dataIn)
dataIn | The source Hex character string to decode. |
Decode Hex characters from a data object.
Murl.Data DecodeHex(Murl.ConstData dataIn)
dataIn | The source data object to decode. |
Encode a string to a url character string (percentage encoding).
String EncodeUrl(String source)
source | The source string to encode. |
Decode a url character string (percentage encoding) to a string.
String DecodeUrl(String source)
source | The source url character string to decode. |
Encode a string so that it can be used as an XML attribute value.
String EncodeXml(String source)
source | The source string to encode. |
Sort a UInt64 array. The array is sorted by using the quick sort algorithm.
Murl.Array.UInt64 SortUInt64Array(Murl.Array.UInt64 array, Boolean ascending)
array | The array to sort. |
ascending | true for ascending sort order, false for descending sort order. |
Sort a SInt64 array. The array is sorted by using the quick sort algorithm.
Murl.Array.SInt64 SortSInt64Array(Murl.Array.SInt64 array, Boolean ascending)
array | The array to sort. |
ascending | true for ascending sort order, false for descending sort order. |
Sort a UInt32 array. The array is sorted by using the quick sort algorithm.
Murl.Array.UInt32 SortUInt32Array(Murl.Array.UInt32 array, Boolean ascending)
array | The array to sort. |
ascending | true for ascending sort order, false for descending sort order. |
Sort a SInt32 array. The array is sorted by using the quick sort algorithm.
Murl.Array.SInt32 SortSInt32Array(Murl.Array.SInt32 array, Boolean ascending)
array | The array to sort. |
ascending | true for ascending sort order, false for descending sort order. |
Sort a Real array. The array is sorted by using the quick sort algorithm.
Murl.Array.Real SortRealArray(Murl.Array.Real array, Boolean ascending)
array | The array to sort. |
ascending | true for ascending sort order, false for descending sort order. |
Sort a Double array. The array is sorted by using the quick sort algorithm.
Murl.Array.Double SortDoubleArray(Murl.Array.Double array, Boolean ascending)
array | The array to sort. |
ascending | true for ascending sort order, false for descending sort order. |
Sort a String array. The array is sorted by using the quick sort algorithm.
Murl.Array.String SortStringArray(Murl.Array.String array, Boolean ascending)
array | The array to sort. |
ascending | true for ascending sort order, false for descending sort order. |
Get the reference to a static empty string.
String StaticEmptyString()
Get the reference to a static whitespace string. The whitespace string contains the characters:
String StaticWhitespaceString()
Get the reference to a static empty string array.
Murl.Array.String StaticEmptyStringArray()
Split a string into pieces using a given delimiter, the pieces are stored in a string array.
Integer, Murl.Array.String SplitString(String inputString, Char delimiter, Murl.Array.String pieces, Boolean acceptEmpty)
inputString | The string to split. |
delimiter | The delimiter character. |
pieces | The pieces return value. |
acceptEmpty | If true, also empty pieces are accepted, i.e. subsequent pieces are considered to be separated by a single delimiter only. |
Split a string into pieces using a given delimiter, the pieces are stored in a string index.
Integer, Murl.Index.String SplitString(String inputString, Char delimiter, Murl.Index.String pieces, Boolean acceptEmpty)
inputString | The string to split. |
delimiter | The delimiter character. |
pieces | The pieces return value. |
acceptEmpty | If true, also empty pieces are accepted, i.e. subsequent pieces are considered to be separated by a single delimiter only. |
Split a string into pieces using a given set of delimiters, the pieces are stored in a string array.
Integer, Murl.Array.String SplitString(String inputString, String delimiters, Murl.Array.String pieces, Boolean acceptEmpty)
inputString | The string to split. |
delimiters | A string containing all delimiter characters. |
pieces | The pieces return value. |
acceptEmpty | If true, also empty pieces are accepted, i.e. subsequent pieces are considered to be separated by a single delimiter only. |
Split a string into pieces using a given set of delimiters, the pieces are stored in a string index.
Integer, Murl.Index.String SplitString(String inputString, String delimiters, Murl.Index.String pieces, Boolean acceptEmpty)
inputString | The string to split. |
delimiters | A string containing all delimiter characters. |
pieces | The pieces return value. |
acceptEmpty | If true, also empty pieces are accepted, i.e. subsequent pieces are considered to be separated by a single delimiter only. |
Join all strings from a string array.
String JoinStringArray(Murl.Array.String inputStrings, String separator, Boolean joinEmpty)
inputStrings | The string array to join. |
separator | The separator string to separate the input strings. |
joinEmpty | If true, also empty strings are added from the input strings. |
Join all strings from a string index.
String JoinStringIndex(Murl.Index.String inputStrings, String separator, Boolean joinEmpty)
inputStrings | The string index to join. |
separator | The separator string to separate the input strings. |
joinEmpty | If true, also empty strings are added from the input strings. |
Indent a (multi-line) string by a given number of white spaces.
String IndentString(String inputString, Integer indent, Boolean indentEmpty)
inputString | The string to indent. |
indent | The number of spaces to indent. If this is negative, the given number of spaces are removed from the beginning of each line, if present. |
indentEmpty | If false, empty lines are not processed (default). |
Fill in a set of given parameters into a placeholder string. A placeholder is represented by a zero-based integer within curly braces, e.g. "{0}", "{7}" or "{42}" (without quotes). The integer represents the index into the given parameters array.
String FillInParameters(String inputString, Murl.Array.String parameters)
inputString | The placeholder string. |
parameters | An array of string holding the individual parameters. |
Trim all strings in a string array. Trim white spaces from left and right for each string in the array.
Murl.Array.String TrimStringArray(Murl.Array.String inputString)
inputString | The string array to trim. |
Get a line from a string.
String, Integer GetLine(String inputString, Integer startPos)
inputString | The string to get the line from. |
startPos | The start position to get the line from. The start position is set to the beginning of the next line or to -1 if the end of the input string is reached. |
Get the next word from a string.
String, Integer GetWord(String inputString, Integer startPos)
inputString | The string to get the word from. |
startPos | The start position to get the word from. The start position is set to the beginning of the next word or to -1 if the end of the input string is reached. |
Check if a class name has a "::" part.
Boolean HasCppScope(String className)
className | The class name string. |
Get the class name substring before the "::" part.
String GetCppScope(String className)
className | The class name string. |
Get the class name substring behind the "::" part.
String StripCppScope(String className)
className | The class name string. |
Check if a name has a dot character.
name | The name string. |
Get the substring before the dot character.
name | The name string. |
Get the substring behind the dot character.
String StripScope(String name)
name | The name string. |
Strip the index part from a name and get the index value. For example, the input string "param[7]" will be split so that the "name" variable contains the string "param", and index is set to 7.
Boolean, String, Integer StripIndex(String name, Integer index, Boolean trimOutput)
name | The name string to strip. |
index | The index return value. |
trimOutput | If true, leading and trailing whitespaces are removed from the name after stripping. |
Strip the count part from a name and get its value. For example, the input string "param7" will be split so that the "name" variable contains the string "param", and count is set to 7.
Boolean, String, Integer StripCount(String name, Integer count, Boolean trimOutput)
name | The name string to strip. |
count | The count return value. |
trimOutput | If true, leading and trailing whitespaces are removed from the name after stripping. |
Check if an identifier string is valid. A valid identifer contains:
Boolean IsIdValid(String identifier)
identifier | The identifer string to check. |
Check if a string has numeric characters only. A leading '+' or '-' character is allowed.
str | The string to check. |
Check if a character is an alphanumeric character.
Boolean IsAlphaNumeric(Char chr)
chr | The character to check. |
Check if a string has alphanumeric characters only.
Boolean IsAlphaNumeric(String str)
str | The string to check. |
Check if a character is a digit character.
chr | The character to check. |
Check if a character is an alphabetic character.
chr | The character to check. |
Check if a character is a punctuation character.
Boolean IsPunctuation(Char chr)
chr | The character to check. |
Check if a character is a spacing character. A whitespace is a space, form feed '\f', newline '\n', carriage return '\r', vertical tabulator '\v' or horizontal tabulator '\t' character.
chr | The character to check. |
Check if a character is a hexadecimal character.
chr | The character to check. |
Check if a character is a control character.
chr | The character to check. |
Convert a decimal string to a bool value. The conversion ignores case, leading and trailing whitespaces.
Boolean, Boolean StringToBool(String inputString, Boolean value)
inputString | The string to convert. |
value | The return value. |
Convert a decimal string to a UInt64 value. The conversion ignores leading and trailing whitespaces.
Boolean, Integer StringToUInt64(String inputString, Integer value)
inputString | The string to convert. |
value | The return value. |
Convert a decimal string to a SInt64 value. The conversion ignores leading and trailing whitespaces.
Boolean, Integer StringToSInt64(String inputString, Integer value)
inputString | The string to convert. |
value | The return value. |
Convert a decimal string to a UInt32 value. The conversion ignores leading and trailing whitespaces.
Boolean, Integer StringToUInt32(String inputString, Integer value)
inputString | The string to convert. |
value | The return value. |
Convert a decimal string to a SInt32 value. The conversion ignores leading and trailing whitespaces.
Boolean, Integer StringToSInt32(String inputString, Integer value)
inputString | The string to convert. |
value | The return value. |
Convert a string to a Double value. The conversion ignores leading and trailing whitespaces. The decimal separator is the '.' character (locale independent).
Boolean, Number StringToDouble(String inputString, Number value)
inputString | The string to convert. |
value | The return value. |
Convert a string to a Float value. The conversion ignores leading and trailing whitespaces. The decimal separator is the '.' character (locale independent).
Boolean, Number StringToFloat(String inputString, Number value)
inputString | The string to convert. |
value | The return value. |
Convert a string to a color object. See StringToColor(const String& inputString, Color& value, Color::StringFormat& format).
Boolean, Murl.Color StringToColor(String inputString, Murl.Color value)
inputString | The string to convert. |
value | The color return value. |
Convert a string to a color object. The conversion ignores case, leading and trailing whitespaces. A color value can be specified by comma separated component values or a single 32 bit hex value:
The component format specifiers are:
If a component has no format specifier the float format is assumed. If the string has only one component and the format specifier is missing, the "AARRGGBBh" format is assumed.
Boolean, Murl.Color, Murl.Color.StringFormat StringToColor(String inputString, Murl.Color value, Murl.Color.StringFormat format)
inputString | The string to convert. |
value | The color return value. |
format | This return value is set to the color string format recognized during conversion, or Color::STRING_FORMAT_UNKNOWN if failed. If different format specifiers are given, Color::STRING_FORMAT_MIXED is returned, and if not all of the given components have an explicit specifier, Color::STRING_FORMAT_INCOMPLETE is returned. |
Convert a string to a color object. See StringToColor(const String& inputString, Color& value, Color::StringFormat& format).
Boolean, Murl.Color, Boolean StringToColor(String inputString, Murl.Color value, Boolean hasType)
inputString | The string to convert. |
value | The color return value. |
hasType | This return value is set to false if any format specifier is missing. |
Convert a string to a Float color component. See StringToColorComponent(const String& inputString, Float& value, Color::StringFormat& format).
Boolean, Number StringToColorComponent(String inputString, Number value)
inputString | The string to convert. |
value | The color component return value. |
Convert a string to a Float color component. The conversion ignores case, leading and trailing whitespaces. The component format specifiers are:
If the format specifier is missing the float format is assumed.
Boolean, Number, Murl.Color.StringFormat StringToColorComponent(String inputString, Number value, Murl.Color.StringFormat format)
inputString | The string to convert. |
value | The color component return value. |
format | This return value is set to the color string format recognized during conversion, or Color::STRING_FORMAT_UNKNOWN if failed. If different format specifiers are given, Color::STRING_FORMAT_MIXED is returned, and if not all of the given components have an explicit specifier, Color::STRING_FORMAT_INCOMPLETE is returned. |
Convert a string to a Float color component. See StringToColorComponent(const String& inputString, Float& value, Color::StringFormat& format).
Boolean, Number, Boolean StringToColorComponent(String inputString, Number value, Boolean hasType)
inputString | The string to convert. |
value | The color component return value. |
hasType | This return value is set to false if any format specifier is missing. |
Convert a hexadecimal string to a UInt64 value. The conversion ignores leading and trailing whitespaces.
Boolean, Integer HexStringToUInt64(String inputString, Integer value)
inputString | The string to convert. |
value | The return value. |
Convert a hexadecimal string to a UInt32 value. The conversion ignores leading and trailing whitespaces.
Boolean, Integer HexStringToUInt32(String inputString, Integer value)
inputString | The string to convert. |
value | The return value. |
Convert an angle string to a Double value. The conversion ignores case, leading and trailing whitespaces. An angle string can specify the unit:
If the unit specifier is missing the radiants unit is assumed.
Boolean, Number, Boolean AngleStringToDouble(String inputString, Number value, Boolean hasUnit)
inputString | The string to convert. |
value | The angle return value. |
hasUnit | This return value is set to false if the unit specifier is missing. |
Convert a string to a Bool array using a given delimiter.
Boolean, Murl.Array.Bool StringToBoolArray(String inputString, Char delimiter, Murl.Array.Bool values)
inputString | The string to convert. |
delimiter | The delimiter character. |
values | The return values array. |
Convert a string to a UInt64 array using a given delimiter.
Boolean, Murl.Array.UInt64 StringToUInt64Array(String inputString, Char delimiter, Murl.Array.UInt64 values)
inputString | The string to convert. |
delimiter | The delimiter character. |
values | The return values array. |
Convert a string to a SInt64 array using a given delimiter.
Boolean, Murl.Array.SInt64 StringToSInt64Array(String inputString, Char delimiter, Murl.Array.SInt64 values)
inputString | The string to convert. |
delimiter | The delimiter character. |
values | The return values array. |
Convert a string to a UInt32 array using a given delimiter.
Boolean, Murl.Array.UInt32 StringToUInt32Array(String inputString, Char delimiter, Murl.Array.UInt32 values)
inputString | The string to convert. |
delimiter | The delimiter character. |
values | The return values array. |
Convert a string to a SInt32 array using a given delimiter.
Boolean, Murl.Array.SInt32 StringToSInt32Array(String inputString, Char delimiter, Murl.Array.SInt32 values)
inputString | The string to convert. |
delimiter | The delimiter character. |
values | The return values array. |
Convert a string to a Double array using a given delimiter.
Boolean, Murl.Array.Double StringToDoubleArray(String inputString, Char delimiter, Murl.Array.Double values)
inputString | The string to convert. |
delimiter | The delimiter character. |
values | The return values array. |
Convert a string to a Float array using a given delimiter.
Boolean, Murl.Array.Float StringToFloatArray(String inputString, Char delimiter, Murl.Array.Float values)
inputString | The string to convert. |
delimiter | The delimiter character. |
values | The return values array. |
Convert a UInt64 value to a string.
String UInt64ToString(Integer inputValue)
inputValue | The value to convert. |
Convert a UInt64 value to a string using a format string.
String UInt64ToString(Integer inputValue, String format)
inputValue | The value to convert. |
format | The format string should contain "%llu". |
Convert a SInt64 value to a string.
String SInt64ToString(Integer inputValue)
inputValue | The value to convert. |
Convert a SInt64 value to a string using a format string.
String SInt64ToString(Integer inputValue, String format)
inputValue | The value to convert. |
format | The format string should contain "%lld". |
Convert a UInt32 value to a string.
String UInt32ToString(Integer inputValue)
inputValue | The value to convert. |
Convert a UInt32 value to a string using a format string.
String UInt32ToString(Integer inputValue, String format)
inputValue | The value to convert. |
format | The format string should contain "%u". |
Convert a SInt32 value to a string.
String SInt32ToString(Integer inputValue)
inputValue | The value to convert. |
Convert a SInt32 value to a string using a format string.
String SInt32ToString(Integer inputValue, String format)
inputValue | The value to convert. |
format | The format string should contain "%d". |
Convert a Double value to a string.
String DoubleToString(Number inputValue)
inputValue | The value to convert. |
Convert a Double value to a string using a format string.
String DoubleToString(Number inputValue, String format)
inputValue | The value to convert. |
format | The format string should contain "%f" or "%g". |
Convert a Color object to a string in float representation.
String ColorToString(Murl.Color inputValue)
inputValue | The color to convert. |
Convert a Color object to a string using a given color string format.
String ColorToString(Murl.Color inputValue, Murl.Color.StringFormat colorStringFormat)
inputValue | The color to convert. |
colorStringFormat | The color string format. |
Convert a Color object to a string using a given color string format.
String ColorToString(Murl.Color inputValue, Murl.Color.StringFormat colorStringFormat, String format)
inputValue | The color to convert. |
colorStringFormat | The color string format |
format | The format string should contain "%f" or "%g" for Color::STRING_FORMAT_FLOAT, "%i" or "%x" (or similar) for int and hex formats. |
Convert a Color object to a string in float representation.
String ColorToString(Murl.Color inputValue, String format)
inputValue | The color to convert. |
format | The format string should contain "%f" or "%g". |
Convert a Bool value to a string.
String BoolToString(Boolean inputValue)
inputValue | The value to convert. |
Convert a time value to a string.
String TimeToString(Murl.System.Time inputValue)
inputValue | The value to convert. |
Convert a time value to a string using a separator.
String TimeToString(Murl.System.Time inputValue, String separator)
inputValue | The value to convert. |
separator | The separator string. |
Convert an UTF8 character sequence to an UTF32 character. For string operation the String class provides the GetUTF32Chars() method.
Boolean, Integer, Integer Utf8ToUtf32(String inputBytes, Integer outputValue, Integer numToSkip)
inputBytes | Pointer to the UTF8 character(s). |
outputValue | The UTF-32 character return value. |
numToSkip | Return value parameter returning the number of input bytes to skip to the next UTF8 character. |
ValueToString overload for DoubleToString() method.
String ValueToString(Number inputValue)
inputValue | The value to convert. |
ValueToString overload for BoolToString() method.
String ValueToString(Boolean inputValue)
inputValue | The value to convert. |
ValueToString overload for ColorToString() method.
String ValueToString(Murl.Color inputValue)
inputValue | The value to convert. |
ValueToString overload for TimeToString() method.
String ValueToString(Murl.System.Time inputValue)
inputValue | The value to convert. |
Get the file path substring of a file path and name. Returns the substring before the last '/' character.
String GetFilePath(String filePathAndName)
filePathAndName | The file path and name. |
Get the file name substring of a file path and name. Returns the substring behind the last '/' character.
String GetFileName(String filePathAndName)
filePathAndName | The file path and name. |
Get the file extension substring of a file name. Returns the substring behind the last '.' character.
String GetFileExtension(String fileName)
fileName | The file name. |
Strip the file extension from a file name. Returns the substring before the last '.' character.
String StripExtension(String fileName)
fileName | The file name. |
Strip the file path and extension from a file path and name. Returns the substring from the last '/' to the last '.' character.
String StripPathAndExtension(String filePathAndName)
filePathAndName | The file path and name. |
Join two path strings. Ensures exactly one '/' character between the left and the right part.
String JoinPaths(String leftPath, String rightPath)
leftPath | The left path string. |
rightPath | The right path string. |
Exchange all '\' with '/' characters.
String GetUnixPath(String windowsPath)
windowsPath | The path string to convert. |
Exchange all '/' with '\' characters.
String GetWindowsPath(String unixPath)
unixPath | The path string to convert. |
Get a normalized path. Returns the given path, with all occurrences of "." removed, and any occurrences of ".." revursively joined with the previous sub-path.
String GetNormalizedPath(String path)
path | The path to normalize. |
Get a relative path from an absolute one. When the relative path cannot be resolved, the given absolute path is returned. This may happen e.g. when both given paths are located on different volumes.
String GetRelativePath(String absolutePath, String absoluteBasePath)
absolutePath | The absolute path to convert. |
absoluteBasePath | The absolute base path relative to which the path is converted. |
Get an absolute path from a relative one. When the given relative path is actually representing an absolute location (i.e. starting with "/"), it is directly returned. Otherwise, the base path and relative path are concatenated and normalized.
String GetAbsolutePath(String relativePath, String absoluteBasePath)
relativePath | The relative path to convert. |
absoluteBasePath | The absolute base path relative to which the path is converted. |
Check if a name contains pattern matching statements. Pattern matching is supported by IsNameMatching().
Boolean HasMatchPattern(String name, Integer matchOption)
name | The name string to check. |
matchOption | The option for checking, either MATCH_DEFAULT or MATCH_NOESCAPE. |
Check if a name matches a specified pattern. Matches patterns according to the Unix-like globbing rules * ? [0-z]
. See HasMatchPattern() to check a name for patterns.
Boolean IsNameMatching(String pattern, String name, Integer matchOptions)
pattern | The pattern string. |
name | The name string to check. |
matchOptions | The options for checking, any MatchOptions can be combined using bitwise OR. |