add PIProtectedVariable
This commit is contained in:
46
main.cpp
46
main.cpp
@@ -8,12 +8,50 @@
|
||||
#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();
|
||||
@@ -47,14 +85,6 @@ int main(int argc, char * argv[]) {
|
||||
piCout << "hello!"_tr("Co") << "hello!"_tr;*/
|
||||
// piCout << "hello!"_trNoOp;
|
||||
|
||||
// PICodeParser parser;
|
||||
// parser.parseFile("cmg_test.h");
|
||||
/*for (auto m: parser.macros) {
|
||||
piCout << "";
|
||||
piCout << m.name << m.args << m.value;
|
||||
piCout << m.expand({"hello"});
|
||||
}
|
||||
*/
|
||||
|
||||
/*PISet<int> set;
|
||||
piCout << set << piSerialize(set) << piDeserialize<PISet<int>>(piSerialize(set));
|
||||
|
||||
Reference in New Issue
Block a user