HyperspaceExplorer 0.7.1
|
Utility functions. More...
Functions | |
void | CheckGLErrors (const char *) |
int | GetGLList () |
void | glVertex (const Vector< 3, double > &V) |
Vector< 3, double > | vnormalize (double xx, double yy, double zz) |
double | atod (QString) |
Convert a QString to double. | |
double | atod (const std::string &) |
Convert a string to unsigned. | |
int | atoi (const std::string &) |
Convert a string to signed int. | |
unsigned | atou (const std::string &) |
Convert a string to unsigned. | |
string | itoa (int x) |
string | ftoa (double x) |
std::string | sup2 () |
A (I hope) Editor-independent repersentation of "²". | |
std::string | sup3 () |
A (I hope) Editor-independent repersentation of "³". | |
std::string | trim (const std::string &str) |
Strips leading and trailing whitespace from a string. | |
std::vector< std::string > | explode (const std::string &delimiter, const std::string &str) |
Splits a string on each occurrence of delimiter . | |
bool | isMultithreadedSensible () |
template<typename T > | |
std::vector< T >::iterator | find (T find_me, std::vector< T > &v) |
Find an element in a vector. | |
template<typename T > | |
bool | isPermutation (T m0, T m1, T n0, T n1) |
Whether the tuple (n0, n1) is a permutation of (m0, m1). | |
template<typename T > | |
bool | isPermutation (T m0, T m1, T m2, T n0, T n1, T n2) |
Whether the tuple (n0, n1, n2) is a permutation of (m0, m1, m2). | |
template<typename T > | |
bool | isPermutation (T m0, T m1, T m2, T m3, T n0, T n1, T n2, T n3) |
Whether the tuple (n0, n1, n2, n3) is a permutation of (m0, m1, m2, m3). | |
template<typename T > | |
bool | isPermutation (T m0, T m1, T m2, T m3, T m4, T n0, T n1, T n2, T n3, T n4) |
Whether the tuple (n0, n1, n2, n3, n4) is a permutation of (m0, m1, m2, m3, n4). |
Utility functions.
__PRETTY_FUNCTION__ is a gcc extension. For other compilers, redefine it to print filename and line instead of the function signature.
double Util::atod | ( | QString | s | ) |
Convert a QString to double.
makes a double precision value from a QString implemented because I called a function atod () ages ago, for convenience
s | string to be converted |
Referenced by Script::ParmStmt< T >::execute().
double Util::atod | ( | const std::string & | ) |
Convert a string to unsigned.
int Util::atoi | ( | const std::string & | ) |
Convert a string to signed int.
Referenced by Script::ParmStmt< T >::execute().
unsigned Util::atou | ( | const std::string & | ) |
Convert a string to unsigned.
Referenced by Script::ParmStmt< T >::execute(), Script::FramesStmt::FramesStmt(), Script::LoopStmt::LoopStmt(), Script::SizeStmt::SizeStmt(), and Script::SleepStmt::SleepStmt().
void Util::CheckGLErrors | ( | const char * | ) |
debug function for OpenGL commands; outputs all current GL errors on cerr
op | optional repetition of last GL command |
References std::cerr, and std::endl().
std::vector< std::string > Util::explode | ( | const std::string & | delimiter, |
const std::string & | str | ||
) |
Splits a string on each occurrence of delimiter
.
delimiter | The string at which str is split. |
str | The string which is split into its part |
str
. delimiter
is not included in any of the parts. References std::vector< _Tp, _Alloc >::begin(), std::vector< _Tp, _Alloc >::end(), std::vector< _Tp, _Alloc >::insert(), and std::vector< _Tp, _Alloc >::push_back().
std::vector<T>::iterator Util::find | ( | T | find_me, |
std::vector< T > & | v | ||
) |
Find an element in a vector.
find_me | The element to find in the vector v |
v | The vector to search for element find_me |
vector<T>::iterator
pointing to the element or v.end()
if it is not in v
References std::vector< _Tp, _Alloc >::begin(), and std::vector< _Tp, _Alloc >::end().
std::string Util::ftoa | ( | double | x | ) |
makes a string from a double value implemented because I called a function ftoa () ages ago, for convenience
x | number to be converted |
int Util::GetGLList | ( | ) |
find the ID of the first free GL list
Referenced by C4DView::PreRedraw().
void Util::glVertex | ( | const VecMath::Vector< 3, double > & | V | ) |
define a GL Vertex from a Vector<3>
V | the vertex to be defined |
References VecMath::Vector< D, N >::data(), and VecMath::sqnorm().
Referenced by C4DView::DrawCoordinates(), and C4DView::drawVertex().
std::string Util::itoa | ( | int | x | ) |
makes a string from an integer value implemented because I called a function itoa () ages ago, for convenience
x | number to be converted |
Referenced by VecMath::RotationAxes< D >::axis(), and C4DView::RenderScene().
std::string Util::trim | ( | const std::string & | str | ) |
Strips leading and trailing whitespace from a string.
str | A string to trim. |
str
without leading and trailing whitespace. VecMath::Vector< 3, double > Util::vnormalize | ( | double | xx, |
double | yy, | ||
double | zz | ||
) |
normalizes a Vector made from 3 doubles out-of-place
xx | x component of Vector to be normalized |
yy | y component of Vector to be normalized |
zz | z component of Vector to be normalized |