Murl::System::CLib Functions

Forward to C-runtime library functions. More...

Collaboration diagram for Murl::System::CLib Functions:

Typedefs

typedef SInt32(* Murl::System::CLib::CompareFunctionType) (const void *source1, const void *source2)
 Definition of the compare function. More...
 

Functions

String Murl::System::CLib::PrintToString (const Char *format,...)
 Print formatted variadic arguments into string. More...
 
String Murl::System::CLib::PrintToStringArg (const Char *format, void *vaListPtr)
 Print formatted variadic arguments into string. More...
 
SInt32 Murl::System::CLib::PrintToDebug (const Char *format,...)
 Print formatted variadic arguments to the system specific debug output. More...
 
SInt32 Murl::System::CLib::PrintToError (const Char *format,...)
 Print formatted variadic arguments to the system specific error output. More...
 
SInt32 Murl::System::CLib::PrintToCString (Char *targetString, UInt32 targetLength, const Char *format,...)
 Print formatted variadic arguments into a C-string. More...
 
SInt32 Murl::System::CLib::PrintToFile (const Char *fileName, const Char *format,...)
 Print formatted variadic arguments to file. More...
 
SInt32 Murl::System::CLib::PrintToStdOut (const Char *format,...)
 Print formatted variadic arguments to stdout. More...
 
SInt32 Murl::System::CLib::ScanString (const Char *stringToScan, const Char *format,...)
 Scan formatted string into variadic arguments. More...
 
void * Murl::System::CLib::Alloc (UInt64 byteSize)
 Allocate heap memory. More...
 
void Murl::System::CLib::Free (void *data)
 Free allocated heap memory. More...
 
void * Murl::System::CLib::MemSet (void *destination, UInt32 value, UInt64 byteSize)
 Fill memory with a value. More...
 
void * Murl::System::CLib::MemCopy (void *destination, const void *source, UInt64 byteSize)
 Copy non-overlapping memory. More...
 
void * Murl::System::CLib::MemMove (void *destination, const void *source, UInt64 byteSize)
 Copy overlapping memory. More...
 
SInt32 Murl::System::CLib::MemCompare (const void *source1, const void *source2, UInt64 byteSize)
 Compare memory. More...
 
void Murl::System::CLib::QuickSort (void *items, UInt32 numberOfItems, UInt32 itemByteSize, CompareFunctionType compareFunction)
 Quick sort items. More...
 
void * Murl::System::CLib::BinarySearch (const void *key, const void *items, UInt32 numberOfItems, UInt32 itemByteSize, CompareFunctionType compareFunction)
 Binary search an item. More...
 
void Murl::System::CLib::SRand (UInt32 seed)
 Seed the C-runtime library random number generator. More...
 
SInt32 Murl::System::CLib::Rand ()
 Get a random number form the C-runtime library random number generator. More...
 
SInt32 Murl::System::CLib::StrCmp (const Char *string1, const Char *string2)
 Compare C-strings. More...
 
UInt32 Murl::System::CLib::StrLen (const Char *string)
 Get the length of C-string. More...
 
Bool Murl::System::CLib::IsDigit (SInt32 characterCode)
 Check if a character is a numeric character. More...
 
Bool Murl::System::CLib::IsAlpha (SInt32 characterCode)
 Check if a character is an alphabetic character. More...
 
Bool Murl::System::CLib::IsAlphaNumeric (SInt32 characterCode)
 Check if a character is an alphanumeric character. More...
 
Bool Murl::System::CLib::IsPunctuation (SInt32 characterCode)
 Check if a character is a punctuation character. More...
 
Bool Murl::System::CLib::IsSpace (SInt32 characterCode)
 Check if a character is a spacing character. More...
 
Bool Murl::System::CLib::IsHexDigit (SInt32 characterCode)
 Check if a character is a hexadecimal character. More...
 
Bool Murl::System::CLib::IsControl (SInt32 characterCode)
 Check if a character is a control character. More...
 
Bool Murl::System::CLib::FileExists (const Char *path)
 Check if a file exists. More...
 
Bool Murl::System::CLib::DeleteFile (const Char *path)
 Delete a file. More...
 
Bool Murl::System::CLib::MoveFile (const Char *oldPath, const Char *newPath)
 Move/rename a file. More...
 
Bool Murl::System::CLib::FolderExists (const Char *path)
 Check if a folder exists. More...
 
Bool Murl::System::CLib::CreateFolder (const Char *path)
 Create a folder. More...
 
Bool Murl::System::CLib::DeleteFolder (const Char *path, Bool recursively)
 Delete a folder. More...
 
Bool Murl::System::CLib::MoveFolder (const Char *oldPath, const Char *newPath)
 Move/rename a folder. More...
 
Bool Murl::System::CLib::GetItemCreationTime (const Char *path, UInt64 &seconds, UInt64 &nanoSeconds)
 Get the creation time of a file or folder. More...
 
Bool Murl::System::CLib::GetItemModificationTime (const Char *path, UInt64 &seconds, UInt64 &nanoSeconds)
 Get the time a file or folder was most recently modified. More...
 
SInt32 Murl::System::CLib::LaunchShellCommand (const Char *commandLine)
 Launch a shell command if supported by the platform. More...
 
void Murl::System::CLib::Abort ()
 Call the C-runtime abort function.
 
void Murl::System::CLib::Exit (SInt32 exitCode)
 Call the C-runtime exit function. More...
 

Detailed Description

Forward to C-runtime library functions.

Typedef Documentation

◆ CompareFunctionType

typedef SInt32(* Murl::System::CLib::CompareFunctionType) (const void *source1, const void *source2)

Definition of the compare function.

Parameters
source1Pointer to the 1st source.
source2Pointer to the 2nd source.
Returns
Zero if source1 is equal to source2, negativ if source1 is lesser than source2, positive if source1 is greater than source2.

Function Documentation

◆ PrintToString()

String Murl::System::CLib::PrintToString ( const Char format,
  ... 
)

Print formatted variadic arguments into string.

Parameters
formatThe format string.
...The variadic arguments.
Returns
The string with the printed arguments.

◆ PrintToStringArg()

String Murl::System::CLib::PrintToStringArg ( const Char format,
void *  vaListPtr 
)

Print formatted variadic arguments into string.

Parameters
formatThe format string.
vaListPtrPointer to the variadic arguments.
Returns
The string with the printed arguments.

◆ PrintToDebug()

SInt32 Murl::System::CLib::PrintToDebug ( const Char format,
  ... 
)

Print formatted variadic arguments to the system specific debug output.

Parameters
formatThe format string.
...The variadic arguments.
Returns
The number of characters printed excluding the null terminator.

◆ PrintToError()

SInt32 Murl::System::CLib::PrintToError ( const Char format,
  ... 
)

Print formatted variadic arguments to the system specific error output.

Parameters
formatThe format string.
...The variadic arguments.
Returns
The number of characters printed excluding the null terminator.

◆ PrintToCString()

SInt32 Murl::System::CLib::PrintToCString ( Char targetString,
UInt32  targetLength,
const Char format,
  ... 
)

Print formatted variadic arguments into a C-string.

Parameters
targetStringThe C-string to print into.
targetLengthThe byte length of the C-string to print into.
formatThe format string.
...The variadic arguments.
Returns
The number of characters printed excluding the null terminator.

◆ PrintToFile()

SInt32 Murl::System::CLib::PrintToFile ( const Char fileName,
const Char format,
  ... 
)

Print formatted variadic arguments to file.

The printed string is appended to the file.

Parameters
fileNameThe file name to print into.
formatThe format string.
...The variadic arguments.
Returns
The number of characters printed excluding the null terminator.

◆ PrintToStdOut()

SInt32 Murl::System::CLib::PrintToStdOut ( const Char format,
  ... 
)

Print formatted variadic arguments to stdout.

Parameters
formatThe format string.
...The variadic arguments.
Returns
The number of characters printed excluding the null terminator.

◆ ScanString()

SInt32 Murl::System::CLib::ScanString ( const Char stringToScan,
const Char format,
  ... 
)

Scan formatted string into variadic arguments.

Parameters
stringToScanThe string to scan.
formatThe format string.
...The variadic arguments.
Returns
The number of items assigned.

◆ Alloc()

void* Murl::System::CLib::Alloc ( UInt64  byteSize)

Allocate heap memory.

Parameters
byteSizeThe number of bytes to allocate.
Returns
The pointer to the allocated memory.

◆ Free()

void Murl::System::CLib::Free ( void *  data)

Free allocated heap memory.

Parameters
dataThe pointer to the allocated memory.

◆ MemSet()

void* Murl::System::CLib::MemSet ( void *  destination,
UInt32  value,
UInt64  byteSize 
)

Fill memory with a value.

Parameters
destinationPointer to the destination memory.
valueThe byte-value to fill the memory.
byteSizeThe number of bytes to fill.
Returns
The pointer to the destination memory.

Referenced by Murl::Util::MemClear(), and Murl::Util::MemSet().

◆ MemCopy()

void* Murl::System::CLib::MemCopy ( void *  destination,
const void *  source,
UInt64  byteSize 
)

Copy non-overlapping memory.

Use MemMove if the memory areas do overlap.

Parameters
destinationPointer to the destination memory.
sourcePointer to the source memory.
byteSizeThe number of bytes to copy.
Returns
The pointer to the destination memory.

Referenced by Murl::Util::MemCopy(), and Murl::Util::MemCopyArray().

◆ MemMove()

void* Murl::System::CLib::MemMove ( void *  destination,
const void *  source,
UInt64  byteSize 
)

Copy overlapping memory.

Parameters
destinationPointer to the destination memory.
sourcePointer to the source memory.
byteSizeThe number of bytes to copy.
Returns
The pointer to the destination memory.

Referenced by Murl::Util::MemMove(), and Murl::Array< EvaluatorFunction *>::Remove().

◆ MemCompare()

SInt32 Murl::System::CLib::MemCompare ( const void *  source1,
const void *  source2,
UInt64  byteSize 
)

Compare memory.

Parameters
source1Pointer to the 1st source memory.
source2Pointer to the 2nd source memory.
byteSizeThe number of bytes to compare.
Returns
Zero if source1 is equal to source2, negativ if source1 is lesser than source2, positive if source1 is greater than source2.

Referenced by Murl::String::EndsWith(), Murl::Util::MemCompare(), and Murl::String::StartsWith().

◆ QuickSort()

void Murl::System::CLib::QuickSort ( void *  items,
UInt32  numberOfItems,
UInt32  itemByteSize,
CompareFunctionType  compareFunction 
)

Quick sort items.

Parameters
itemsPointer to the items to sort.
numberOfItemsNumber of items to sort.
itemByteSizeBytesize of an item.
compareFunctionThe CompareFunctionType for the item.

Referenced by Murl::Util::QuickSort().

◆ BinarySearch()

void* Murl::System::CLib::BinarySearch ( const void *  key,
const void *  items,
UInt32  numberOfItems,
UInt32  itemByteSize,
CompareFunctionType  compareFunction 
)

Binary search an item.

The items to search for are required to be sorted.

Parameters
keyPointer to the item to find.
itemsPointer to the items to search for.
numberOfItemsNumber of items to search for.
itemByteSizeBytesize of an item.
compareFunctionThe CompareFunctionType for the item.
Returns
Pointer to the item found or null if item is not found. If there are multiple elements matching key, the element returned is unspecified.

Referenced by Murl::Util::BinarySearch().

◆ SRand()

void Murl::System::CLib::SRand ( UInt32  seed)

Seed the C-runtime library random number generator.

Parameters
seedThe seed for the random number generator.

◆ Rand()

SInt32 Murl::System::CLib::Rand ( )

Get a random number form the C-runtime library random number generator.

Returns
The random number.

◆ StrCmp()

SInt32 Murl::System::CLib::StrCmp ( const Char string1,
const Char string2 
)

Compare C-strings.

Parameters
string1Pointer to the 1st C-string.
string2Pointer to the 2nd C-string.
Returns
Zero if string1 is equal to string2, negativ if string1 is lesser than string2, positive if string1 is greater than string2.

◆ StrLen()

UInt32 Murl::System::CLib::StrLen ( const Char string)

Get the length of C-string.

Parameters
stringPointer to the C-string.
Returns
The length of the C-string.

◆ IsDigit()

Bool Murl::System::CLib::IsDigit ( SInt32  characterCode)

Check if a character is a numeric character.

Parameters
characterCodeThe character to check.
Returns
true if the character is a numeric character.

◆ IsAlpha()

Bool Murl::System::CLib::IsAlpha ( SInt32  characterCode)

Check if a character is an alphabetic character.

Parameters
characterCodeThe character to check.
Returns
true if the character is an alphabetic character.

◆ IsAlphaNumeric()

Bool Murl::System::CLib::IsAlphaNumeric ( SInt32  characterCode)

Check if a character is an alphanumeric character.

Parameters
characterCodeThe character to check.
Returns
true if the character is an alphanumeric character.

◆ IsPunctuation()

Bool Murl::System::CLib::IsPunctuation ( SInt32  characterCode)

Check if a character is a punctuation character.

Parameters
characterCodeThe character to check.
Returns
true if the character is a punctuation character.

◆ IsSpace()

Bool Murl::System::CLib::IsSpace ( SInt32  characterCode)

Check if a character is a spacing character.

Parameters
characterCodeThe character to check.
Returns
true if the character is a spacing character.

◆ IsHexDigit()

Bool Murl::System::CLib::IsHexDigit ( SInt32  characterCode)

Check if a character is a hexadecimal character.

Parameters
characterCodeThe character to check.
Returns
true if the character is a hexadecimal character.

◆ IsControl()

Bool Murl::System::CLib::IsControl ( SInt32  characterCode)

Check if a character is a control character.

Parameters
characterCodeThe character to check.
Returns
true if the character is a control character.

◆ FileExists()

Bool Murl::System::CLib::FileExists ( const Char path)

Check if a file exists.

Parameters
pathThe path and the filename.
Returns
true if the file exists.

◆ DeleteFile()

Bool Murl::System::CLib::DeleteFile ( const Char path)

Delete a file.

Parameters
pathThe path to the file to delete.
Returns
true if successful.

◆ MoveFile()

Bool Murl::System::CLib::MoveFile ( const Char oldPath,
const Char newPath 
)

Move/rename a file.

Parameters
oldPathThe current path to the file to move.
newPathThe new path of the file.
Returns
true if successful.

◆ FolderExists()

Bool Murl::System::CLib::FolderExists ( const Char path)

Check if a folder exists.

Parameters
pathThe path and the folder.
Returns
true if the folder exists.

◆ CreateFolder()

Bool Murl::System::CLib::CreateFolder ( const Char path)

Create a folder.

Parameters
pathThe path and the folder to create.
Returns
true if successful.

◆ DeleteFolder()

Bool Murl::System::CLib::DeleteFolder ( const Char path,
Bool  recursively 
)

Delete a folder.

Parameters
pathThe path and the folder to delete.
recursivelyIf true, the folder and all contents are deleted. If false, the function fails when the folder is not empty.
Returns
true if successful.

◆ MoveFolder()

Bool Murl::System::CLib::MoveFolder ( const Char oldPath,
const Char newPath 
)

Move/rename a folder.

Parameters
oldPathThe current path to the folder to move.
newPathThe new path of the folder.
Returns
true if successful.

◆ GetItemCreationTime()

Bool Murl::System::CLib::GetItemCreationTime ( const Char path,
UInt64 seconds,
UInt64 nanoSeconds 
)

Get the creation time of a file or folder.

Note: explicit item creation time is not available on all platforms, e.g. Android, Linux or emscripten. In this case, false is returned.

Parameters
pathThe path to the file or folder to query.
secondsA reference to an UInt64 value to receive the seconds part.
nanoSecondsA reference to an UInt64 value to receive the nanoseconds part.
Returns
true if successful.

◆ GetItemModificationTime()

Bool Murl::System::CLib::GetItemModificationTime ( const Char path,
UInt64 seconds,
UInt64 nanoSeconds 
)

Get the time a file or folder was most recently modified.

Parameters
pathThe path to the file or folder to query.
secondsA reference to an UInt64 value to receive the seconds part.
nanoSecondsA reference to an UInt64 value to receive the nanoseconds part.
Returns
true if successful.

◆ LaunchShellCommand()

SInt32 Murl::System::CLib::LaunchShellCommand ( const Char commandLine)

Launch a shell command if supported by the platform.

Internally, this calls the CLib std::system function.

Parameters
commandLineThe shell command line, including any parameters.
Returns
The shell command's exit status.

◆ Exit()

void Murl::System::CLib::Exit ( SInt32  exitCode)

Call the C-runtime exit function.

On iOS this function does nothing.

Parameters
exitCodeThe exit code.


Copyright © 2011-2018 Spraylight GmbH.