Utility template functions.
More...
#include <fstream>
#include <sstream>
#include <vector>
Go to the source code of this file.
|
|
bool | ParseBool (const char *str) |
| |
|
int | ParseNumberInt (const char *str) |
| |
|
double | ParseNumberDouble (const char *str) |
| |
|
void | Waitms (int val) |
| |
|
std::string | GetUserProfile () |
| |
|
void | GetFullPathName (const char *rpstr, char *&ret_buff, int buffLen) |
| |
|
void | GetFullPathName (const char *relativePathName, const char *initPath, char *&ret_buff, int buffLen) |
| |
|
std::string | GetFullPathName (std::string relativePathName, std::string initPath) |
| |
| std::string | GetFilledDigits (int number, size_t totalDigits) |
| | Gets the string prefixed with zeros so the string is a certain length. More...
|
| |
|
void | StringToLower (std::string &str) |
| |
|
void | StringToUpper (std::string &str) |
| |
| template<class T > |
| void __declspec(dllexport) smessage(std void | SafeDelete (T *&pVal) |
| | messaging More...
|
| |
| template<class T > |
| void | SafeDeleteArray (T *&pVal) |
| | Safely delete memory that was allocated with new[]. More...
|
| |
|
template<class T > |
| void | ResizeContainer (std::vector< T > &vec, size_t size, bool zeroIfNotResized=false) |
| |
| template<typename T > |
| T | Round (T num) |
| | round value More...
|
| |
| template<typename DstType , typename SrcType > |
| bool | IsType (const SrcType *src) |
| |
| template<typename T > |
| bool | Contains (std::vector< T, std::allocator< T > > vec, T item) |
| |
| template<typename T > |
| std::string | NumToString (T val) |
| |
| template<typename T > |
| bool | FromString (T &t, const std::string &s, std::ios_base &(*f)(std::ios_base &)=std::dec) |
| | save the array to file More...
|
| |
Utility template functions.
◆ Contains()
template<typename T >
| bool Contains |
( |
std::vector< T, std::allocator< T > > |
vec, |
|
|
T |
item |
|
) |
| |
|
inline |
- Returns
- true if item is contained in vec
◆ FromString()
template<typename T >
| bool FromString |
( |
T & |
t, |
|
|
const std::string & |
s, |
|
|
std::ios_base &(*)(std::ios_base &) |
f = std::dec |
|
) |
| |
|
inline |
save the array to file
- Parameters
-
| len | length of array |
| line_data | array |
| fname | name of file to save. ".txt" is appended to filename |
◆ GetFilledDigits()
| std::string GetFilledDigits |
( |
int |
number, |
|
|
size_t |
totalDigits |
|
) |
| |
Gets the string prefixed with zeros so the string is a certain length.
Gets the string prefixed with zeros so the string is a certain length.
- Parameters
-
| number | The number to convert to a string. |
| totalDigits | The total length to make the string. |
- Returns
◆ IsType()
template<typename DstType , typename SrcType >
| bool IsType |
( |
const SrcType * |
src | ) |
|
|
inline |
- Returns
- true if source is type of DstType
◆ NumToString()
template<typename T >
| std::string NumToString |
( |
T |
val | ) |
|
|
inline |
◆ Round()
round value
- Parameters
-
- Returns
- rounded value
◆ SafeDelete()
template<class T >
| void __declspec (dllexport) smessage(std void SafeDelete |
( |
T *& |
pVal | ) |
|
messaging
Safely delete memory that was allocated with new.
- Parameters
-
| pVal | The pointer to memory. |
◆ SafeDeleteArray()
template<class T >
| void SafeDeleteArray |
( |
T *& |
pVal | ) |
|
Safely delete memory that was allocated with new[].
- Parameters
-
| pVal | The pointer to memory. |