1#line 2 "src/Glb/Core.cpp"
6#include <Wt/WModelIndex.h>
7#include <Wt/WDateTime.h>
8#include <Wt/WLocalDateTime.h>
10#include "../3rd/guid.hpp"
15std::vector<std::string> &
16split(
const std::string & s,
char delim, std::vector<std::string> & elems )
18 std::stringstream ss( s );
20 while( std::getline( ss, item, delim ) )
22 elems.push_back( item );
28std::vector<std::string>
30split(
const std::string & s,
char delim )
32 std::vector<std::string> elems;
42rtrim( std::string & s,
const char* t )
44 s.erase( s.find_last_not_of(t) + 1 );
51ltrim( std::string & s,
const char* t )
53 s.erase( 0, s.find_first_not_of(t) );
60trim( std::string & s,
const char* t )
69 std::string retVal = s;
71 std::transform( retVal.begin(), retVal.end(), retVal.begin(), ::toupper );
80 std::string retVal = s;
82 std::transform( retVal.begin(), retVal.end(), retVal.begin(), ::tolower );
102 if( !view()-> isExpanded( _parent ) )
110 bool expanded =
false;
111 for(
int row=0; row< view()-> model()-> rowCount( _parent ); row++ )
112 expanded |=
iterate( _jary, view()-> model()-> index( row, 0, _parent ) );
129 if( accountGuid !=
"" )
130 _jary.push_back( accountGuid );
153 jobj[
"selected"] =
Wt::WString( selectedAccount() );
155 for(
int col=0; col< 7; col++ )
160 jobj[
"expanded"] = jary;
170hexDump(
const std::string &
string,
int start,
int end )-> std::string
172 std::stringstream rv;
175 for(
unsigned int i=0; i<
string.length(); i += 16 )
181 sprintf( buffer,
"%04x: ", i );
182 adrLine = std::string(buffer);
184 for(
int j=0; j<16; j++ )
186 if( i+j <
string.length() )
188 sprintf( buffer,
"%02x ", (
string.at(i+j) & 0xff) );
189 hexLine += std::string(buffer);
191 if( std::isprint(
string.at(i+j) ) )
193 sprintf( buffer,
"%c",
string.at(i+j) );
194 ascLine += std::string(buffer);
209 bool showline =
false;
210 if( start == -1 && end == -1 )
214 if( (start > -1 && i >= start)
215 && (end > -1 && i <= end)
237 std::string g = xg::newGuid();
242 retVal.push_back( c );
static bool iterate(Wt::Json::Array &_jary, Wt::WModelIndex _parent)
static std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
static constexpr const int User
static WDateTime currentDateTime()
cpp17::any data(ItemDataRole role=ItemDataRole::Display) const
std::string toUTF8() const
WString & arg(const std::wstring &value)
#define GCW_DATE_FORMAT_DISPLAY
#define GCW_DATE_FORMAT_STORAGE
WString asString(const cpp17::any &v, const WString &formatString=WString())
std::string toupper(const std::string &s)
auto currentDateTime() -> Wt::WDateTime
Current Date/Time.
std::string tolower(const std::string &s)
std::vector< std::string > split(const std::string &value, char delim)
std::string & trim(std::string &s, const char *t=trim_ws)
std::string & ltrim(std::string &s, const char *t=trim_ws)
auto currentDateTimeDisplayString() -> std::string
std::string hexDump(const std::string &data, int start=-1, int end=-1)
std::string & rtrim(std::string &s, const char *t=trim_ws)
Wt::Json::Object toJson(Wt::WTreeView *_view)
auto newGuid() -> std::string
Generate new GUID string value.
auto currentDateTimeStorageString() -> std::string