2 #ifndef __WTX_UTIL_H_234e0174_6b7d_11e8_b503_fb1ef3651ec0__ 3 #define __WTX_UTIL_H_234e0174_6b7d_11e8_b503_fb1ef3651ec0__ 8 #include <Wt/WItemDelegate.h> 9 #include <Wt/WTemplate.h> 19 :
public Wt::WItemDelegate
25 virtual std::unique_ptr<Wt::WWidget> update( Wt::WWidget * widget,
const Wt::WModelIndex & index, Wt::WFlags< Wt::ViewItemRenderFlag > flags );
89 bool fileExists(
const std::string & fileName );
105 std::vector<std::string>
fileList(
const std::string & folder );
114 std::vector<std::string>
findFiles(
const std::string & folder,
const std::string & match );
120 int stoi(
const std::string & value );
126 std::string
itos(
int value );
132 double stof(
const std::string & value );
138 std::string
ftos(
double value,
int decimals = 2 );
139 std::string
ftos(
double value,
const std::string & suffix,
int decimals = 2 );
140 std::string
ftos(
const std::string & prefix,
double value,
int decimals = 2 );
141 std::string ftom(
double value,
int decimals = 2 );
142 std::string ftom(
const std::string & prefix,
double value,
int decimals = 2 );
148 bool ends_with(
const std::string & value,
const std::string & ending );
157 std::string
append(
const std::string & s,
const std::string &
append,
const std::string & separator );
167 std::string
prepend(
const std::string & s,
int length = 0,
char pad =
'0' );
174 std::string
ucase(
const std::string & value );
181 std::string
lcase(
const std::string & value );
214 std::string
replace(
const std::string &
string,
const std::string & before,
const std::string & after );
216 void ltrim(std::string &s);
217 void rtrim(std::string &s);
218 void trim(std::string &s);
219 std::string ltrim_copy(std::string s);
220 std::string rtrim_copy(std::string s);
221 std::string trim_copy(std::string s);
223 std::vector<std::string> readCSVRow(
const std::string & row );
229 bool feq(
double a,
double b,
double epsilon = 0.005f,
bool trace =
false );
231 std::string to_string( Wt::WTemplate & templt );
232 std::string to_string( Wt::WTemplate * templt );
234 bool to_htmlfile( Wt::WTemplate & templt,
const std::string & folderName,
const std::string & fileName );
235 bool to_htmlfile( Wt::WTemplate * templt,
const std::string & folderName,
const std::string & fileName );
237 std::string hexDump(
const std::string & data,
int start = -1,
int end = -1 );
245 const char * description;
253 #endif // #ifndef __WTX_UTIL_H___ std::string append(const std::string &s, const std::string &append, const std::string &separator)
Append a string to string.
std::string ucase(const std::string &value)
Upper Case a string.
std::string prepend(const std::string &s, int length=0, char pad= '0')
Prepend some number of characters in front of another string.
int roundUp(float value)
Round a number up.
int stoi(const std::string &value)
Convert a String to an Integer.
double stof(const std::string &value)
Convert a String to Float.
bool feq(double a, double b, double epsilon=0.005f, bool trace=false)
std::string ftos(double value, int decimals=2)
Convert a Float to String with decimal precision.
std::string json_number_to_string(const std::string &key, const std::string &data)
Convert a number to a string.
std::string replace(const std::string &string, const std::string &before, const std::string &after)
Replace a String.
std::string itos(int value)
Convert an Integer to a String.
std::vector< std::string > fileList(const std::string &folder)
File Listing.
std::vector< std::string > findFiles(const std::string &folder, const std::string &match)
Find File.
bool ends_with(const std::string &value, const std::string &ending)
Check if a string ends with another string.
std::string makeFileName(const std::string &value)
Make File Name.
std::string lcase(const std::string &value)
Lower Case a string.
int system_command(const std::string &cmd, bool show=false)
Execute a system command.
bool fileExists(const std::string &fileName)
Check if a File or Folder exists.
int roundDown(float value)
Round a number down.
float roundCurrency(float value)
Round a number for Currency.