git-svn-id: svn://db.shs.com.ru/pip@603 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
59
ccm_kbd.cpp
59
ccm_kbd.cpp
@@ -1,59 +0,0 @@
|
||||
// Generated by "PIP Code model generator" 27.02.2015 20:30:36
|
||||
|
||||
#include <string.h>
|
||||
#include "ccm_kbd.h"
|
||||
|
||||
using namespace PICodeInfo;
|
||||
|
||||
|
||||
|
||||
__ClassInfo_______LIBS_PIP_SRC_CCM_KBD_H_Initializer__::__ClassInfo_______LIBS_PIP_SRC_CCM_KBD_H_Initializer__() {
|
||||
if (_inited_) return;
|
||||
_inited_ = true;
|
||||
|
||||
EnumInfo * ei;
|
||||
(*enumsInfo)[""] = new EnumInfo();
|
||||
|
||||
// Enums
|
||||
|
||||
ei = new EnumInfo();
|
||||
(*enumsInfo)["PIKbdListener::SpecialKey"] = ei;
|
||||
ei->name = "PIKbdListener::SpecialKey";
|
||||
ei->members << PICodeInfo::EnumeratorInfo("Tab", 9);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("Return", 10);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("Esc", 27);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("Space", 32);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("Backspace", 127);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("UpArrow", -1);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("DownArrow", -2);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("RightArrow", -3);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("LeftArrow", -4);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("Home", -5);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("End", -6);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("PageUp", -7);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("PageDown", -8);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("Insert", -9);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("Delete", -10);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("F1", -11);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("F2", -12);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("F3", -13);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("F4", -14);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("F5", -15);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("F6", -16);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("F7", -17);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("F8", -18);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("F9", -19);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("F10", -20);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("F11", -21);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("F12", -22);
|
||||
|
||||
ei = new EnumInfo();
|
||||
(*enumsInfo)["PIKbdListener::KeyModifier"] = ei;
|
||||
ei->name = "PIKbdListener::KeyModifier";
|
||||
ei->members << PICodeInfo::EnumeratorInfo("Ctrl", 1);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("Shift", 2);
|
||||
ei->members << PICodeInfo::EnumeratorInfo("Alt", 4);
|
||||
}
|
||||
|
||||
|
||||
bool __ClassInfo_______LIBS_PIP_SRC_CCM_KBD_H_Initializer__::_inited_ = false;
|
||||
19
ccm_kbd.h
19
ccm_kbd.h
@@ -1,19 +0,0 @@
|
||||
// Generated by "PIP Code model generator" 27.02.2015 20:30:36
|
||||
|
||||
#ifndef ______LIBS_PIP_SRC_CCM_KBD_H
|
||||
#define ______LIBS_PIP_SRC_CCM_KBD_H
|
||||
|
||||
#include "pivariant.h"
|
||||
#include "picodeinfo.h"
|
||||
|
||||
|
||||
class __ClassInfo_______LIBS_PIP_SRC_CCM_KBD_H_Initializer__ {
|
||||
public:
|
||||
__ClassInfo_______LIBS_PIP_SRC_CCM_KBD_H_Initializer__();
|
||||
static bool _inited_;
|
||||
};
|
||||
|
||||
static __ClassInfo_______LIBS_PIP_SRC_CCM_KBD_H_Initializer__ __classinfo_______libs_pip_src_ccm_kbd_h_initializer__;
|
||||
|
||||
|
||||
#endif // ______LIBS_PIP_SRC_CCM_KBD_H
|
||||
28
main.cpp
28
main.cpp
@@ -1,34 +1,6 @@
|
||||
#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;
|
||||
|
||||
@@ -461,7 +461,7 @@ void PIPeer::dtReceived(const PIString & from, const PIByteArray & data) {
|
||||
|
||||
bool PIPeer::dataRead(uchar * readed, int size) {
|
||||
if (destroyed) {
|
||||
piCout << "[PIPeer] SegFault";
|
||||
//piCout << "[PIPeer] SegFault";
|
||||
return true;
|
||||
}
|
||||
if (size < 16) return true;
|
||||
|
||||
@@ -298,20 +298,29 @@ void makeGetter(PIFile & f, const PICodeParser::Entity * e) {
|
||||
f << "\treturn ret;\n}\n";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
void makeGetterHeader(PIFile & f, const PICodeParser::Entity * e) {
|
||||
f << "\nPIByteArray getter" << toCName(e->name) << "(const void * p, const char * name);";
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
void writeModel(PICodeParser & parser, PICLI & cli, const PIString out, bool meta, bool enums, bool streams, bool texts, bool getters) {
|
||||
PIVector<const PICodeParser::Entity * > ventities;
|
||||
PIString defname = out.replaceAll(".", "_").replaceAll("/", "_").replaceAll(":", "_").replaceAll("-", "_").toUpperCase() + "_H";
|
||||
bool inc_h, inc_cpp;
|
||||
inc_h = streams || texts;
|
||||
inc_cpp = !inc_h && getters;
|
||||
|
||||
PISet<PIString> inc_files;
|
||||
piForeachC (PICodeParser::Entity * e, parser.entities)
|
||||
if (e->name.find("::") < 0 && !e->name.startsWith("_PI"))
|
||||
inc_files << e->file;
|
||||
PIString inc_string;
|
||||
PIVector<PIString> incf = inc_files.toVector();
|
||||
piForeachC (PIString & i, incf) {
|
||||
if (i != parser.mainFile())
|
||||
inc_string << "\n#include \"" << i << "\"";
|
||||
}
|
||||
|
||||
PIFile f(out + ".cpp");
|
||||
f.clear();
|
||||
@@ -321,6 +330,7 @@ void writeModel(PICodeParser & parser, PICLI & cli, const PIString out, bool met
|
||||
if (streams || texts)
|
||||
f << "#include <pichunkstream.h>\n";
|
||||
f << "#include \"" << out << ".h\"\n";
|
||||
if (inc_cpp) f << inc_string;
|
||||
f << "\nusing namespace PICodeInfo;\n\n";
|
||||
/*
|
||||
PIString entry, argtype, rettype, args;
|
||||
@@ -370,6 +380,13 @@ void writeModel(PICodeParser & parser, PICLI & cli, const PIString out, bool met
|
||||
*/
|
||||
|
||||
if (meta || enums || getters) {
|
||||
if (getters) {
|
||||
f << "\n\n// Getter funtions\n";
|
||||
piForeachC (PICodeParser::Entity * e, parser.entities) {
|
||||
if (!e->has_name || e->name.startsWith("_PI")) continue;
|
||||
makeGetter(f, e);
|
||||
}
|
||||
}
|
||||
f << "\n\n// Metainformation\n\n__ClassInfo_" << defname << "_Initializer__::__ClassInfo_" << defname << "_Initializer__() {\n";
|
||||
f << "\tif (_inited_) return;\n\t_inited_ = true;\n\n";
|
||||
if (meta) {
|
||||
@@ -409,13 +426,6 @@ void writeModel(PICodeParser & parser, PICLI & cli, const PIString out, bool met
|
||||
makeClassStream(f, e);
|
||||
}
|
||||
}
|
||||
if (getters) {
|
||||
f << "\n\n// Getter funtions\n";
|
||||
piForeachC (PICodeParser::Entity * e, parser.entities) {
|
||||
if (!e->has_name || e->name.startsWith("_PI")) continue;
|
||||
makeGetter(f, e);
|
||||
}
|
||||
}
|
||||
|
||||
f.close();
|
||||
|
||||
@@ -430,13 +440,7 @@ void writeModel(PICodeParser & parser, PICLI & cli, const PIString out, bool met
|
||||
f << "\n";
|
||||
f << "#ifndef " << defname << "\n#define " << defname << "\n\n";
|
||||
f << "#include \"pivariant.h\"\n#include \"picodeinfo.h\"";
|
||||
if (streams || texts || getters) {
|
||||
PIVector<PIString> incf = inc_files.toVector();
|
||||
piForeachC (PIString & i, incf) {
|
||||
if (i != parser.mainFile())
|
||||
f << "\n#include \"" << i << "\"";
|
||||
}
|
||||
}
|
||||
if (inc_h) f << inc_string;
|
||||
/*
|
||||
f << "\n\n";
|
||||
piForeachC (PICodeParser::Entity * e, ventities)
|
||||
@@ -454,14 +458,14 @@ const PIVariant & arg1 = PIVariant(), const PIVariant & arg2 = PIVariant(), cons
|
||||
makeClassStreamHeader(f, e);
|
||||
}
|
||||
}
|
||||
if (getters) {
|
||||
/*if (getters) {
|
||||
f << "\n\n// Getter funtions\n";
|
||||
piForeachC (PICodeParser::Entity * e, parser.entities) {
|
||||
if (!e->has_name || e->name.startsWith("_PI")) continue;
|
||||
makeGetterHeader(f, e);
|
||||
}
|
||||
f << "\n";
|
||||
}
|
||||
}*/
|
||||
if (meta || enums || getters) {
|
||||
f << "\n\n// Metainformation\n\nclass __ClassInfo_" << defname << "_Initializer__ {\n";
|
||||
f << "public:\n\t__ClassInfo_" << defname << "_Initializer__();\n\tstatic bool _inited_;\n};\n";
|
||||
|
||||
Reference in New Issue
Block a user