60#ifndef guWhiteboard_Count_h
61#define guWhiteboard_Count_h
63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
72#undef guWhiteboard_Count_DEFINED
73#define guWhiteboard_Count_DEFINED
90 void init(int64_t t_count = 0) {
107 this->init(t_other.
count());
114 this->init(t_other.
count);
121 this->init(t_other.
count());
129 this->init(t_other.
count);
140 return !(*
this == t_other);
145 return *
this ==
Count(t_other);
150 return !(*
this == t_other);
168#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
178#ifdef USE_WB_COUNT_C_CONVERSION
181 std::string descr = buffer;
184 std::ostringstream ss;
185 ss <<
"count=" << this->
count();
191#ifdef USE_WB_COUNT_C_CONVERSION
194 std::string toString = buffer;
197 std::ostringstream ss;
203#ifdef USE_WB_COUNT_C_CONVERSION
208 char * str_cstr =
const_cast<char *
>(t_str.c_str());
209 size_t temp_length = strlen(str_cstr);
210 int length = (temp_length <= INT_MAX) ? static_cast<int>(
static_cast<ssize_t
>(temp_length)) : -1;
215 char* var_str = &var_str_buffer[0];
217 char* key = &key_buffer[0];
224 if (index == 0 && str_cstr[0] ==
'{') {
230 for (
int i = index; i < length; i++) {
232 if (bracecount == 0 && str_cstr[i] ==
'=') {
237 if (bracecount == 0 && isspace(str_cstr[i])) {
244 if (bracecount == 0 && str_cstr[i] ==
',') {
248 if (str_cstr[i] ==
'{') {
252 if (str_cstr[i] ==
'}') {
254 if (bracecount < 0) {
259 if (i == length - 1) {
263 if (endKey >= startKey && endKey - startKey < length) {
264 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
265 key[(endKey - startKey) + 1] = 0;
269 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
270 var_str[(index - startVar) + 1] = 0;
276 if (strlen(key) > 0) {
277 if (0 == strcmp(
"count", key)) {
288 this->
set_count(
static_cast<int64_t
>(atoll(var_str)));
290 this->
set_count(
static_cast<int64_t
>(atol(var_str)));
298 }
while(index < length);
Provides a C++ wrapper around wb_count.
Count(const Count &t_other)
Copy Constructor.
bool operator==(const Count &t_other) const
Count & operator=(const Count &t_other)
Copy Assignment Operator.
void from_string(const std::string &t_str)
void set_count(const int64_t &t_newValue)
Count(const std::string &t_str)
String Constructor.
Count(int64_t t_count=0)
Create a new Count.
std::string description()
Count(const struct wb_count &t_other)
Copy Constructor.
bool operator!=(const Count &t_other) const
const int64_t & count() const
WHITEBOARD_POSTER_STRING_CONVERSION.
const char * wb_count_to_string(const struct wb_count *self, char *toString, size_t bufferSize)
Convert to a string.
const char * wb_count_description(const struct wb_count *self, char *descString, size_t bufferSize)
Convert to a description string.
struct wb_count * wb_count_from_string(struct wb_count *self, const char *str)
Convert from a string.
#define COUNT_DESC_BUFFER_SIZE
#define COUNT_TO_STRING_BUFFER_SIZE