124 lines
3.2 KiB
C++
124 lines
3.2 KiB
C++
#include "pibytearray.h"
|
|
#include "piclientserver_client.h"
|
|
#include "piclientserver_server.h"
|
|
#include "picodeparser.h"
|
|
#include "piintrospection_server.h"
|
|
#include "piiostream.h"
|
|
#include "pijson.h"
|
|
#include "pilog.h"
|
|
#include "pimathbase.h"
|
|
#include "pip.h"
|
|
#include "piprotectedvariable.h"
|
|
#include "pitranslator_p.h"
|
|
#include "pivaluetree_conversions.h"
|
|
|
|
using namespace PICoutManipulators;
|
|
|
|
class MyStr: public PIString {
|
|
public:
|
|
MyStr(): PIString() {}
|
|
MyStr(const char * o): PIString(o) { piCout << "MyStr *"; }
|
|
MyStr(const MyStr & o): PIString(o) { piCout << "MyStr &"; }
|
|
// MyStr(const MyStr & o): PIString(o) { piCout << "MyStr &"; }
|
|
MyStr(MyStr && o): PIString(o) { piCout << "MyStr &&"; }
|
|
MyStr & operator=(const MyStr & o) {
|
|
*this += o;
|
|
piCout << "MyStr =&";
|
|
return *this;
|
|
}
|
|
MyStr & operator=(MyStr && o) {
|
|
*this += o;
|
|
piCout << "MyStr =&&";
|
|
return *this;
|
|
}
|
|
};
|
|
|
|
|
|
int main(int argc, char * argv[]) {
|
|
PIProtectedVariable<MyStr> var;
|
|
// MyStr s("hello");
|
|
var.set("hello");
|
|
auto & v = var.lock();
|
|
// v = "world";
|
|
var.unlock();
|
|
piCout << var.get();
|
|
|
|
/*PICodeParser parser;
|
|
parser.parseFile("client_server.h");
|
|
for (auto m: parser.enums) {
|
|
piCout << "";
|
|
piCout << m.name; // << m.args << m.value;
|
|
// piCout << m.expand({"hello"});
|
|
}*/
|
|
|
|
return 0;
|
|
PITranslator::loadLang("ru");
|
|
PISerial f("COM123");
|
|
f.open();
|
|
|
|
/*auto test = [](PIString s, PIString v) {
|
|
piCout << " in:" << s;
|
|
piCout << "arg:" << minArgPlaceholder(s);
|
|
piCout << "out:" << arg(s, v);
|
|
piCout << "";
|
|
};
|
|
|
|
test(" %", "asd");
|
|
test("%", "asd");
|
|
test("1", "asd");
|
|
test(" %11", "asd");
|
|
test("%1%2 %0f%0g", "asd");
|
|
test("%01 ", "asd");*/
|
|
|
|
/*piCout << PIString::readableSize(50_KiB);
|
|
piCout << PIString::readableSize(1_GB);
|
|
PITranslator::loadLang("ru");
|
|
piCout << PIString::readableSize(50_KiB);
|
|
piCout << PIString::readableSize(1_GB);
|
|
piCout << "test\nstring"_tr;
|
|
PITranslator::clear();
|
|
piCout << PIString::readableSize(50_KiB);
|
|
piCout << PIString::readableSize(1_GB);
|
|
piCout << "test\nstring"_tr;
|
|
piCout << "hello!"_tr;
|
|
PITranslator::loadConfig("[]\nhello!=привет!\n[Co]\nhello!=привет CO!\n"_u8);
|
|
piCout << "hello!"_tr("Co") << "hello!"_tr;*/
|
|
// piCout << "hello!"_trNoOp;
|
|
|
|
|
|
/*PISet<int> set;
|
|
piCout << set << piSerialize(set) << piDeserialize<PISet<int>>(piSerialize(set));
|
|
set << 1 << 2 << 3;
|
|
piCout << set << piSerialize(set) << piDeserialize<PISet<int>>(piSerialize(set));
|
|
set << 1 << -2 << 50 << -100;
|
|
piCout << set << piSerialize(set) << piDeserialize<PISet<int>>(piSerialize(set));*/
|
|
return 0;
|
|
|
|
std::numeric_limits<complexf>::epsilon();
|
|
using cmlp = complexf;
|
|
PIMathMatrixT<3, 3, double> v0;
|
|
PIMathMatrixT<3, 3, cmlp> v1;
|
|
v0[0][1] = 1;
|
|
v0[1][1] = 2;
|
|
v0[2][1] = 3;
|
|
v1[0][1] = cmlp(1., 0);
|
|
v1[1][1] = cmlp(2., -1);
|
|
v1[2][1] = cmlp(3., 2);
|
|
piCout << v0 << v1;
|
|
piCout << (v0 * 2.) << (v1 * cmlp(2., 2.));
|
|
piCout << (v0 + 2.) << (v1 + cmlp(2.));
|
|
piCout << (v0 - 2.) << (v1 - cmlp(2.));
|
|
piCout << (v0 / 2.) << (v1 / cmlp(2., 1.));
|
|
// piCout << (v0.length()) << (v1.length());
|
|
// piCout << (v0.lengthSqr()) << (v1.lengthSqr());
|
|
// piCout << (v0.manhattanLength()) << (v1.manhattanLength());
|
|
|
|
/*foo<int>();
|
|
foo<double>();
|
|
foo<complexf>();
|
|
foo<complexd>();
|
|
return 0;*/
|
|
|
|
return 0;
|
|
}
|