This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.
#include "ofUtils.h"
#include "ofImage.h"
#include "ofLog.h"
#include "ofAppBaseWindow.h"
#include "ofMainLoop.h"
#include "ofAppRunner.h"
#include "ofEvents.h"
#include "ofGLUtils.h"
#include "ofMath.h"
#include "ofPixels.h"
#include <chrono>
#include <numeric>
#include <locale>
#include "uriparser/Uri.h"
#include <sys/time.h>
Classes | |
class | of::priv::Clock |
Namespaces | |
namespace | of |
namespace | of::priv |
Macros | |
#define | MAXPATHLEN 1024 |
Functions | |
void | of::priv::initutils () |
void | of::priv::endutils () |
Clock & | of::priv::getClock () |
uint64_t | ofGetFixedStepForFps (double fps) |
void | ofSetTimeModeSystem () |
void | ofSetTimeModeFixedRate (uint64_t stepNanos) |
void | ofSetTimeModeFiltered (float alpha) |
ofTime | ofGetCurrentTime () |
Get the system time. | |
uint64_t | ofGetElapsedTimeMillis () |
Get the elapsed time in milliseconds. | |
uint64_t | ofGetElapsedTimeMicros () |
Get the elapsed time in microseconds. | |
float | ofGetElapsedTimef () |
Get the elapsed time in seconds. | |
void | ofResetElapsedTimeCounter () |
Reset the elapsed time counter. | |
uint64_t | ofGetSystemTime () |
uint64_t | ofGetSystemTimeMillis () |
Get the system time in milliseconds (system uptime). | |
uint64_t | ofGetSystemTimeMicros () |
Get the system time in microseconds (system uptime). | |
uint64_t | ofGetUnixTime () |
Get the number of seconds since Midnight, January 1, 1970. | |
uint64_t | ofGetUnixTimeMillis () |
Get the Unix Time in milliseconds. | |
void | ofSleepMillis (int millis) |
Sleeps the current thread for the specified amount of milliseconds. | |
string | ofGetTimestampString () |
Formats the current system time according to the given format. | |
string | ofGetTimestampString (const string ×tampFormat) |
int | ofGetSeconds () |
Get the seconds after the minute. | |
int | ofGetMinutes () |
Get minutes after the hour. | |
int | ofGetHours () |
Get the hour of the day. | |
int | ofGetYear () |
Get the current year. | |
int | ofGetMonth () |
Get the current month. | |
int | ofGetDay () |
Get the current day within the month. | |
int | ofGetWeekday () |
Get the current weekday. | |
template<> | |
string | ofFromString (const string &value) |
template<> | |
const char * | ofFromString (const string &value) |
template<> | |
string | ofToHex (const string &value) |
string | ofToHex (const char *value) |
Convert a c-style string to a hexadecimal string. | |
int | ofToInt (const string &intString) |
int | ofHexToInt (const string &intHexString) |
char | ofHexToChar (const string &charHexString) |
float | ofHexToFloat (const string &floatHexString) |
string | ofHexToString (const string &stringHexString) |
float | ofToFloat (const string &floatString) |
double | ofToDouble (const string &doubleString) |
int64_t | ofToInt64 (const string &intString) |
bool | ofToBool (const string &boolString) |
char | ofToChar (const string &charString) |
template<> | |
string | ofToBinary (const string &value) |
string | ofToBinary (const char *value) |
Converts a c-style string to a string of only 1s and 0s. | |
int | ofBinaryToInt (const string &value) |
char | ofBinaryToChar (const string &value) |
float | ofBinaryToFloat (const string &value) |
string | ofBinaryToString (const string &value) |
vector< string > | ofSplitString (const string &source, const string &delimiter, bool ignoreEmpty, bool trim) |
string | ofJoinString (const vector< string > &stringElements, const string &delimiter) |
void | ofStringReplace (string &input, const string &searchStr, const string &replaceStr) |
bool | ofIsStringInString (const string &haystack, const string &needle) |
std::size_t | ofStringTimesInString (const string &haystack, const string &needle) |
string | ofToLower (const string &src, const string &locale) |
string | ofToUpper (const string &src, const string &locale) |
string | ofTrimFront (const string &src, const string &locale) |
string | ofTrimBack (const string &src, const string &locale) |
string | ofTrim (const string &src, const string &locale) |
void | ofAppendUTF8 (string &str, uint32_t utf8) |
void | ofUTF8Append (string &str, uint32_t utf8) |
void | ofUTF8Insert (string &str, size_t pos, uint32_t utf8) |
void | ofUTF8Erase (string &str, size_t start, size_t len) |
std::string | ofUTF8Substring (const string &str, size_t start, size_t len) |
std::string | ofUTF8ToString (uint32_t utf8) |
Convert a Unicode codepoint to a UTF8-encoded std::string. | |
size_t | ofUTF8Length (const std::string &str) |
Get the number of Unicode code points in a UTF8-encoded string. | |
void | ofLaunchBrowser (const string &url, bool uriEncodeQuery) |
string | ofGetVersionInfo () |
Get the current version of openFrameworks as a string. | |
unsigned int | ofGetVersionMajor () |
Get the major version number of openFrameworks. | |
unsigned int | ofGetVersionMinor () |
Get the minor version number of openFrameworks. | |
unsigned int | ofGetVersionPatch () |
Get the patch version number of openFrameworks. | |
std::string | ofGetVersionPreRelease () |
Get the pre-release version of openFrameworks. | |
void | ofSaveScreen (const string &filename) |
void | ofSaveViewport (const string &filename) |
void | ofSaveFrame (bool bUseViewport) |
Saves the current frame as a PNG image. | |
string | ofSystem (const string &command) |
ofTargetPlatform | ofGetTargetPlatform () |
Get the target platform of the current system. | |
std::string | ofGetEnv (const std::string &var, const std::string defaultValue) |
Get the value of a given environment variable. | |
Variables | |
int | saveImageCounter = 0 |
Macro Definition Documentation
◆ MAXPATHLEN
#define MAXPATHLEN 1024 |
Function Documentation
◆ ofAppendUTF8()
void ofAppendUTF8 | ( | string & | str, |
uint32_t | utf8 | ||
) |
◆ ofBinaryToChar()
char ofBinaryToChar | ( | const string & | value | ) |
◆ ofBinaryToFloat()
float ofBinaryToFloat | ( | const string & | value | ) |
◆ ofBinaryToInt()
int ofBinaryToInt | ( | const string & | value | ) |
◆ ofBinaryToString()
string ofBinaryToString | ( | const string & | value | ) |
◆ ofFromString() [1/2]
string ofFromString | ( | const string & | value | ) |
◆ ofFromString() [2/2]
const char * ofFromString | ( | const string & | value | ) |
◆ ofGetCurrentTime()
ofTime ofGetCurrentTime | ( | ) |
Get the system time.
- Returns
- the system time, which is the time since the system booted (uptime).
◆ ofGetDay()
int ofGetDay | ( | ) |
Get the current day within the month.
- Returns
- the day witin the month [1-31].
◆ ofGetElapsedTimef()
float ofGetElapsedTimef | ( | ) |
Get the elapsed time in seconds.
This returns the elapsed time since ofResetElapsedTimeCounter() was called. Usually ofResetElapsedTimeCounter() is called automatically once during program startup.
- Returns
- the floating point elapsed time in seconds.
◆ ofGetElapsedTimeMicros()
uint64_t ofGetElapsedTimeMicros | ( | ) |
Get the elapsed time in microseconds.
This returns the elapsed time since ofResetElapsedTimeCounter() was called. Usually ofResetElapsedTimeCounter() is called automatically upon program startup.
- Returns
- the elapsed time in microseconds (1000000 microseconds = 1 second).
◆ ofGetElapsedTimeMillis()
uint64_t ofGetElapsedTimeMillis | ( | ) |
Get the elapsed time in milliseconds.
This returns the elapsed time since ofResetElapsedTimeCounter() was called. Usually ofResetElapsedTimeCounter() is called automatically once during program startup.
- Returns
- the elapsed time in milliseconds (1000 milliseconds = 1 second).
◆ ofGetEnv()
std::string ofGetEnv | ( | const std::string & | var, |
const std::string | defaultValue = "" |
||
) |
Get the value of a given environment variable.
- Note
- The available environment variables differ between operating systems.
- Parameters
-
var the environment variable name. defaultValue the value to return if the environment variable is not set. defaults to empty string.
- Returns
- the environmnt variable's value or the provided default value if not found.
◆ ofGetFixedStepForFps()
uint64_t ofGetFixedStepForFps | ( | double | fps | ) |
◆ ofGetHours()
int ofGetHours | ( | ) |
Get the hour of the day.
- Returns
- the hour of the day [0-23].
◆ ofGetMinutes()
int ofGetMinutes | ( | ) |
Get minutes after the hour.
- Returns
- the minutes after the hour [0-59].
◆ ofGetMonth()
int ofGetMonth | ( | ) |
Get the current month.
- Returns
- the current month [1-12].
◆ ofGetSeconds()
int ofGetSeconds | ( | ) |
◆ ofGetSystemTime()
uint64_t ofGetSystemTime | ( | ) |
◆ ofGetSystemTimeMicros()
uint64_t ofGetSystemTimeMicros | ( | ) |
Get the system time in microseconds (system uptime).
- Returns
- the system time in microseconds.
◆ ofGetSystemTimeMillis()
uint64_t ofGetSystemTimeMillis | ( | ) |
Get the system time in milliseconds (system uptime).
- Returns
- the system time in milliseconds.
◆ ofGetTargetPlatform()
ofTargetPlatform ofGetTargetPlatform | ( | ) |
Get the target platform of the current system.
- Returns
- the current ofTargetPlatform.
◆ ofGetTimestampString() [1/2]
string ofGetTimestampString | ( | ) |
Formats the current system time according to the given format.
The default timestamp format is "%Y-%m-%d-%H-%M-%S-%i" (e.g. 2011-01-15-18-29-35-299).
- Returns
- the current time as a string with the default format.
◆ ofGetTimestampString() [2/2]
string ofGetTimestampString | ( | const string & | timestampFormat | ) |
◆ ofGetUnixTime()
uint64_t ofGetUnixTime | ( | ) |
Get the number of seconds since Midnight, January 1, 1970.
Resolution is in seconds.
- Returns
- the number of seconds since Midnight, January 1, 1970 (epoch time).
◆ ofGetUnixTimeMillis()
uint64_t ofGetUnixTimeMillis | ( | ) |
Get the Unix Time in milliseconds.
This returns the milliseconds since Midnight, January 1, 1970.
- Returns
- the milliseconds since Midnight, January 1, 1970.
◆ ofGetVersionInfo()
string ofGetVersionInfo | ( | ) |
Get the current version of openFrameworks as a string.
Version
openFrameworks uses the semantic versioning system.
- See also
- http://semver.org/
- Returns
- The string representation of the version (e.g.
0.9.0
).
◆ ofGetVersionMajor()
unsigned int ofGetVersionMajor | ( | ) |
Get the major version number of openFrameworks.
openFrameworks uses the semantic versioning system.
- See also
- http://semver.org/
- Returns
- The major version number.
◆ ofGetVersionMinor()
unsigned int ofGetVersionMinor | ( | ) |
Get the minor version number of openFrameworks.
openFrameworks uses the semantic versioning system.
- See also
- http://semver.org/
- Returns
- The minor version number.
◆ ofGetVersionPatch()
unsigned int ofGetVersionPatch | ( | ) |
Get the patch version number of openFrameworks.
openFrameworks uses the semantic versioning system.
- See also
- http://semver.org/
- Returns
- The patch version number.
◆ ofGetVersionPreRelease()
std::string ofGetVersionPreRelease | ( | ) |
Get the pre-release version of openFrameworks.
openFrameworks uses the semantic versioning system.
For pre-release versions of openFrameworks, including development versions, this string will describe the pre-release state. Examples might include "master", "rc1", "rc2", etc. For all stable releases, this string will be empty.
- See also
- http://semver.org/
- Returns
- The pre-release version string.
◆ ofGetWeekday()
int ofGetWeekday | ( | ) |
Get the current weekday.
Values 0 = Sunday, 1 = Monday, ..., 6 = Saturday.
- Returns
- the current weekday [0-6].
◆ ofGetYear()
int ofGetYear | ( | ) |
Get the current year.
- Returns
- the current year.
◆ ofHexToChar()
char ofHexToChar | ( | const string & | charHexString | ) |
◆ ofHexToFloat()
float ofHexToFloat | ( | const string & | floatHexString | ) |
◆ ofHexToInt()
int ofHexToInt | ( | const string & | intHexString | ) |
◆ ofHexToString()
string ofHexToString | ( | const string & | stringHexString | ) |
◆ ofIsStringInString()
bool ofIsStringInString | ( | const string & | haystack, |
const string & | needle | ||
) |
◆ ofJoinString()
string ofJoinString | ( | const vector< string > & | stringElements, |
const string & | delimiter | ||
) |
◆ ofLaunchBrowser()
void ofLaunchBrowser | ( | const string & | url, |
bool | uriEncodeQuery | ||
) |
◆ ofResetElapsedTimeCounter()
void ofResetElapsedTimeCounter | ( | ) |
Reset the elapsed time counter.
Time
This method resets the times returned by ofGetElapsedTimef(), ofGetElapsedTimeMillis() and ofGetElapsedTimeMicros() to zero.
- Note
- This is called on the first frame during app startup.
◆ ofSaveFrame()
void ofSaveFrame | ( | bool | bUseViewport = false | ) |
Saves the current frame as a PNG image.
The PNG image will be named according to an internal counter in sequence. The count will be restarted each time the program is restarted.
- Parameters
-
bUseViewport Set to true if the current viewport should be used.
◆ ofSaveScreen()
void ofSaveScreen | ( | const string & | filename | ) |
◆ ofSaveViewport()
void ofSaveViewport | ( | const string & | filename | ) |
◆ ofSetTimeModeFiltered()
void ofSetTimeModeFiltered | ( | float | alpha | ) |
◆ ofSetTimeModeFixedRate()
void ofSetTimeModeFixedRate | ( | uint64_t | stepNanos | ) |
◆ ofSetTimeModeSystem()
void ofSetTimeModeSystem | ( | ) |
◆ ofSleepMillis()
void ofSleepMillis | ( | int | millis | ) |
Sleeps the current thread for the specified amount of milliseconds.
- Parameters
-
millis The number of millseconds to sleep.
◆ ofSplitString()
vector< string > ofSplitString | ( | const string & | source, |
const string & | delimiter, | ||
bool | ignoreEmpty, | ||
bool | trim | ||
) |
◆ ofStringReplace()
void ofStringReplace | ( | string & | input, |
const string & | searchStr, | ||
const string & | replaceStr | ||
) |
◆ ofStringTimesInString()
std::size_t ofStringTimesInString | ( | const string & | haystack, |
const string & | needle | ||
) |
◆ ofSystem()
string ofSystem | ( | const string & | command | ) |
◆ ofToBinary() [1/2]
string ofToBinary | ( | const char * | value | ) |
Converts a c-style string to a string of only 1s and 0s.
The corresponding string of 1s and 0s corresponds to the way value is stored in memory.
- Parameters
-
value The c-style string to convert to a binary string.
- Returns
- a binary string.
◆ ofToBinary() [2/2]
string ofToBinary | ( | const string & | value | ) |
◆ ofToBool()
bool ofToBool | ( | const string & | boolString | ) |
◆ ofToChar()
char ofToChar | ( | const string & | charString | ) |
◆ ofToDouble()
double ofToDouble | ( | const string & | doubleString | ) |
◆ ofToFloat()
float ofToFloat | ( | const string & | floatString | ) |
◆ ofToHex() [1/2]
string ofToHex | ( | const char * | value | ) |
Convert a c-style string to a hexadecimal string.
Converts a string (e.g., "abc"
) to its equivalent hexadecimal representation (e.g., "616263"
).
- Parameters
-
value The value to convert to a hexadecimal string.
- Returns
- a hexadecimal string.
◆ ofToHex() [2/2]
string ofToHex | ( | const string & | value | ) |
◆ ofToInt()
int ofToInt | ( | const string & | intString | ) |
◆ ofToInt64()
int64_t ofToInt64 | ( | const string & | intString | ) |
◆ ofToLower()
string ofToLower | ( | const string & | src, |
const string & | locale | ||
) |
◆ ofToUpper()
string ofToUpper | ( | const string & | src, |
const string & | locale | ||
) |
◆ ofTrim()
string ofTrim | ( | const string & | src, |
const string & | locale | ||
) |
◆ ofTrimBack()
string ofTrimBack | ( | const string & | src, |
const string & | locale | ||
) |
◆ ofTrimFront()
string ofTrimFront | ( | const string & | src, |
const string & | locale | ||
) |
◆ ofUTF8Append()
void ofUTF8Append | ( | string & | str, |
uint32_t | utf8 | ||
) |
◆ ofUTF8Erase()
void ofUTF8Erase | ( | string & | str, |
size_t | start, | ||
size_t | len | ||
) |
◆ ofUTF8Insert()
void ofUTF8Insert | ( | string & | str, |
size_t | pos, | ||
uint32_t | utf8 | ||
) |
◆ ofUTF8Length()
size_t ofUTF8Length | ( | const std::string & | utf8 | ) |
Get the number of Unicode code points in a UTF8-encoded string.
- Parameters
-
utf8 The UTF8-encoded std::string.
- Returns
- the number of Unicode codepoints in the given string, or 0 if the string is an invalid UTF8 string.
◆ ofUTF8Substring()
std::string ofUTF8Substring | ( | const string & | str, |
size_t | start, | ||
size_t | len | ||
) |
◆ ofUTF8ToString()
std::string ofUTF8ToString | ( | uint32_t | codepoint | ) |
Convert a Unicode codepoint to a UTF8-encoded std::string.
- Parameters
-
codepoint The Unicode codepoint.
- Returns
- a UTF8-encoded string.
Variable Documentation
◆ saveImageCounter
int saveImageCounter = 0 |