39 lines
722 B
C++
39 lines
722 B
C++
#include "pip.h"
|
|
|
|
struct S {
|
|
S() {
|
|
_int = -66;
|
|
int_v << 1 << 2;
|
|
d = 10.5;
|
|
str = "S String";
|
|
}
|
|
int _int;
|
|
PIVector<int> int_v;
|
|
double d;
|
|
PIString str;
|
|
};
|
|
|
|
PIByteArray getMember(const S * p, const char * name) {
|
|
PIByteArray ret;
|
|
if (!p || !name) return ret;
|
|
if (strcmp(name, "_int") == 0) ret << p->_int;
|
|
if (strcmp(name, "int_v") == 0) ret << p->int_v;
|
|
if (strcmp(name, "d") == 0) ret << p->d;
|
|
return ret;
|
|
}
|
|
|
|
int main(int argc, char *argv[]) {
|
|
S s;
|
|
s.int_v <<777;
|
|
PIByteArray ba = getMember(&s, "int_v");
|
|
piCout << PICoutManipulators::Hex << ba;
|
|
PIVector<int> i; ba >> i;
|
|
piCout << i;
|
|
//S s;
|
|
//s.i;
|
|
//PICodeParser cp;
|
|
//cp.parseFile("cp.h");
|
|
return 0;
|
|
}
|
|
|