libtreestore
diff src/treestorepp.h @ 0:740fec9866b1
treestore initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 11 Apr 2014 08:56:46 +0300 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/treestorepp.h Fri Apr 11 08:56:46 2014 +0300 1.3 @@ -0,0 +1,44 @@ 1.4 +#ifndef TREESTOREPP_H_ 1.5 +#define TREESTOREPP_H_ 1.6 + 1.7 +#include "treestore.h" 1.8 + 1.9 +/// wraps a C ts_value in a convenient class 1.10 +class TSValue { 1.11 +private: 1.12 + ts_value *ctsv; 1.13 + 1.14 +public: 1.15 + TSValue(); 1.16 + ~TSValue(); 1.17 + 1.18 + TSValue(const TSValue &tsv); 1.19 + TSValue &operator =(const TSValue &tsv); 1.20 + 1.21 +#ifdef TS_USE_CPP11 1.22 + TSValue(const TSValue &&tsv); 1.23 + TSValue &operator =(const TSValue &&tsv); 1.24 +#endif 1.25 + 1.26 + bool set(const char *str); 1.27 + bool set_int(int inum); 1.28 + bool set_int(int count, ...); 1.29 + bool set_float(float fnum); 1.30 + bool set_float(int count, ...); 1.31 + bool set_array(int count, const TSValue &v0, ...); 1.32 + 1.33 + const char *get() const; 1.34 + 1.35 + int get_int() const; 1.36 + int *get_intv() const; 1.37 + 1.38 + float get_float() const; 1.39 + float *get_floatv() const; 1.40 + 1.41 + const TSValue *get_array() const; 1.42 + int get_array_size() const; 1.43 + 1.44 + int get_vec_size() const; //< equiv: get_array_size */ 1.45 +}; 1.46 + 1.47 +#endif // TREESTOREPP_H_