Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
System Class Reference

Performs system basic operations such as directory creation, timing, threading, file picking. More...

#include <System.hpp>

Public Types

enum class  Picker { Load , Directory , Save }
 

Static Public Member Functions

static bool showPicker (Picker mode, const std::string &startDir, std::string &outPath, const std::string &extensions="")
 
static bool createDirectory (const std::string &directory)
 
static void ping ()
 
static double time ()
 
static std::string timestamp ()
 
static uint64_t hash64 (const void *data, size_t size)
 
static uint32_t hash32 (const void *data, size_t size)
 
template<typename ThreadFunc >
static void forParallel (size_t low, size_t high, ThreadFunc func)
 
static const char * widen (const std::string &str)
 
static std::string narrow (char *str)
 

Detailed Description

Performs system basic operations such as directory creation, timing, threading, file picking.

Member Enumeration Documentation

◆ Picker

enum class System::Picker
strong

The file picker mode.

Enumerator
Load 

Load an existing file.

Directory 

open or create a directory.

Save 

Save to a new or existing file.

Member Function Documentation

◆ createDirectory()

bool System::createDirectory ( const std::string &  directory)
static

Create a directory.

Parameters
directorythe path to the directory to create
Returns
true if the creation is successful.
Note
If the directory already exists, it will fail.
Warning
This function will not create intermediate directories.

◆ forParallel()

template<typename ThreadFunc >
static void System::forParallel ( size_t  low,
size_t  high,
ThreadFunc  func 
)
inlinestatic

Multi-threaded for-loop.

Parameters
lowlower (included) bound
highhigher (excluded) bound
functhe function to execute at each iteration, will receive the index of the element as a unique argument. Signature: void func(size_t i)
Note
For now only an increment by one is supported.

◆ hash32()

uint32_t System::hash32 ( const void *  data,
size_t  size 
)
static

Compute a 32 bits hash of the input data

Parameters
datathe data to hash
sizethe number of bytes of data to consider
Returns
the computed hash

◆ hash64()

uint64_t System::hash64 ( const void *  data,
size_t  size 
)
static

Compute a 64 bits hash of the input data

Parameters
datathe data to hash
sizethe number of bytes of data to consider
Returns
the computed hash

◆ narrow()

std::string System::narrow ( char *  str)
static

Convert a string from the system representation.

Parameters
stra system string
Returns
the corresponding UTF8 standard string

◆ ping()

void System::ping ( )
static

Notify the user by sending a 'Bell' signal.

◆ showPicker()

bool System::showPicker ( Picker  mode,
const std::string &  startDir,
std::string &  outPath,
const std::string &  extensions = "" 
)
static

Present a filesystem document picker to the user, using native controls.

Parameters
modethe type of item to ask to the user (load, save, directory)
startDirthe initial directory when the picker is opened
outPaththe path to the item selected by the user
extensions(optional) the extensions allowed, separated by "," or ";"
Returns
true if the user picked an item, false if cancelled.

◆ time()

double System::time ( )
static

Return the current value of a time counter.

Returns
the current counter value, in seconds.

◆ timestamp()

std::string System::timestamp ( )
static

Obtain a YYYY_MM_DD_HH_MM_SS timestamp of the current time.

Returns
the string representation

◆ widen()

const char * System::widen ( const std::string &  str)
static

Convert a string to the system representation.

Parameters
stra UTF8 standard string
Returns
the corresponding system string

The documentation for this class was generated from the following files: