version 2.92
pip_cmg
This commit is contained in:
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0)
|
|||||||
cmake_policy(SET CMP0017 NEW) # need include() with .cmake
|
cmake_policy(SET CMP0017 NEW) # need include() with .cmake
|
||||||
project(pip)
|
project(pip)
|
||||||
set(pip_MAJOR 2)
|
set(pip_MAJOR 2)
|
||||||
set(pip_MINOR 91)
|
set(pip_MINOR 92)
|
||||||
set(pip_REVISION 0)
|
set(pip_REVISION 0)
|
||||||
set(pip_SUFFIX )
|
set(pip_SUFFIX )
|
||||||
set(pip_COMPANY SHS)
|
set(pip_COMPANY SHS)
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ bool PICodeParser::parseFileContent(PIString & fc, bool main) {
|
|||||||
PIString prev_namespace = cur_namespace, ccmn;
|
PIString prev_namespace = cur_namespace, ccmn;
|
||||||
cur_namespace += pfc.takeCWord() + s_ns;
|
cur_namespace += pfc.takeCWord() + s_ns;
|
||||||
ccmn = pfc.takeRange('{', '}');
|
ccmn = pfc.takeRange('{', '}');
|
||||||
parseClass(0, ccmn);
|
parseClass(0, ccmn, true);
|
||||||
cur_namespace = prev_namespace;
|
cur_namespace = prev_namespace;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -340,7 +340,7 @@ bool PICodeParser::parseFileContent(PIString & fc, bool main) {
|
|||||||
if (dind < 0 || find < dind) {pfc.cutLeft(6); continue;}
|
if (dind < 0 || find < dind) {pfc.cutLeft(6); continue;}
|
||||||
ccmn = pfc.left(dind) + s_bo + pfc.mid(dind).takeRange('{', '}') + s_bc;
|
ccmn = pfc.left(dind) + s_bo + pfc.mid(dind).takeRange('{', '}') + s_bc;
|
||||||
pfc.remove(0, ccmn.size());
|
pfc.remove(0, ccmn.size());
|
||||||
parseClass(0, ccmn);
|
parseClass(0, ccmn, false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (pfc.left(4) == s_enum) {
|
if (pfc.left(4) == s_enum) {
|
||||||
@@ -425,7 +425,7 @@ PICodeParser::Entity * PICodeParser::parseClassDeclaration(const PIString & fc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PIString PICodeParser::parseClass(Entity * parent, PIString & fc) {
|
void PICodeParser::parseClass(Entity * parent, PIString & fc, bool is_namespace) {
|
||||||
static const PIString s_ns = PIStringAscii("::");
|
static const PIString s_ns = PIStringAscii("::");
|
||||||
static const PIString s_public = PIStringAscii("public");
|
static const PIString s_public = PIStringAscii("public");
|
||||||
static const PIString s_protected = PIStringAscii("protected");
|
static const PIString s_protected = PIStringAscii("protected");
|
||||||
@@ -436,22 +436,31 @@ PIString PICodeParser::parseClass(Entity * parent, PIString & fc) {
|
|||||||
static const PIString s_enum = PIStringAscii("enum");
|
static const PIString s_enum = PIStringAscii("enum");
|
||||||
static const PIString s_friend = PIStringAscii("friend");
|
static const PIString s_friend = PIStringAscii("friend");
|
||||||
static const PIString s_typedef = PIStringAscii("typedef");
|
static const PIString s_typedef = PIStringAscii("typedef");
|
||||||
|
static const PIString s_namespace = PIStringAscii("namespace");
|
||||||
static const PIString s_template = PIStringAscii("template");
|
static const PIString s_template = PIStringAscii("template");
|
||||||
Visibility prev_vis = cur_def_vis;
|
Visibility prev_vis = cur_def_vis;
|
||||||
int dind = fc.find('{'), find = fc.find(';'), end = 0;
|
int dind = fc.find('{'), find = fc.find(';'), end = 0;
|
||||||
if (dind < 0 && find < 0) return PIString();
|
if (dind < 0 && find < 0) return;
|
||||||
if (dind < 0 || find < dind) return fc.left(find);
|
if (dind < 0 || find < dind) {
|
||||||
//piCout << "parse class <****\n" << fc.left(20) << "\n****>";
|
fc.left(find);
|
||||||
Entity * ce = parseClassDeclaration(fc.takeLeft(dind));
|
return;
|
||||||
fc.trim().cutLeft(1).cutRight(1).trim();
|
}
|
||||||
|
//piCout << "parse class <****\n" << fc << "\n****>";
|
||||||
|
Entity * ce = parent;
|
||||||
|
if (!is_namespace) {
|
||||||
|
ce = parseClassDeclaration(fc.takeLeft(dind));
|
||||||
|
fc.trim().cutLeft(1).cutRight(1).trim();
|
||||||
|
}
|
||||||
//piCout << "found class <****\n" << fc << "\n****>";
|
//piCout << "found class <****\n" << fc << "\n****>";
|
||||||
if (!ce) return PIString();
|
///if (!ce) return PIString();
|
||||||
if (parent) parent->children << ce;
|
if (ce) {
|
||||||
ce->parent_scope = parent;
|
if (parent) parent->children << ce;
|
||||||
|
ce->parent_scope = parent;
|
||||||
|
}
|
||||||
int ps = -1;
|
int ps = -1;
|
||||||
bool def = false;
|
bool def = false;
|
||||||
PIString prev_namespace = cur_namespace, stmp;
|
PIString prev_namespace = cur_namespace, stmp;
|
||||||
cur_namespace += ce->name + s_ns;
|
if (ce) cur_namespace += ce->name + s_ns;
|
||||||
//piCout << "parse class" << ce->name << "namespace" << cur_namespace;
|
//piCout << "parse class" << ce->name << "namespace" << cur_namespace;
|
||||||
//piCout << "\nparse class" << ce->name << "namespace" << cur_namespace;
|
//piCout << "\nparse class" << ce->name << "namespace" << cur_namespace;
|
||||||
while (!fc.isEmpty()) {
|
while (!fc.isEmpty()) {
|
||||||
@@ -460,6 +469,14 @@ PIString PICodeParser::parseClass(Entity * parent, PIString & fc) {
|
|||||||
if (cw == s_public ) {cur_def_vis = Public; fc.cutLeft(1); continue;}
|
if (cw == s_public ) {cur_def_vis = Public; fc.cutLeft(1); continue;}
|
||||||
if (cw == s_protected) {cur_def_vis = Protected; fc.cutLeft(1); continue;}
|
if (cw == s_protected) {cur_def_vis = Protected; fc.cutLeft(1); continue;}
|
||||||
if (cw == s_private ) {cur_def_vis = Private; fc.cutLeft(1); continue;}
|
if (cw == s_private ) {cur_def_vis = Private; fc.cutLeft(1); continue;}
|
||||||
|
if (cw == s_namespace) {
|
||||||
|
PIString prev_namespace = cur_namespace, ccmn;
|
||||||
|
cur_namespace += fc.takeCWord() + s_ns;
|
||||||
|
ccmn = fc.takeRange('{', '}');
|
||||||
|
parseClass(ce, ccmn, true);
|
||||||
|
cur_namespace = prev_namespace;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (cw == s_class || cw == s_struct || cw == s_union) {
|
if (cw == s_class || cw == s_struct || cw == s_union) {
|
||||||
if (isDeclaration(fc, 0, &end)) {
|
if (isDeclaration(fc, 0, &end)) {
|
||||||
fc.cutLeft(end);
|
fc.cutLeft(end);
|
||||||
@@ -470,7 +487,7 @@ PIString PICodeParser::parseClass(Entity * parent, PIString & fc) {
|
|||||||
stmp = fc.takeRange('{', '}');
|
stmp = fc.takeRange('{', '}');
|
||||||
fc.takeSymbol();
|
fc.takeSymbol();
|
||||||
stmp = cw + ' ' + tmp + '{' + stmp + '}';
|
stmp = cw + ' ' + tmp + '{' + stmp + '}';
|
||||||
parseClass(ce, stmp);
|
parseClass(ce, stmp, false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (cw == s_enum) {
|
if (cw == s_enum) {
|
||||||
@@ -483,11 +500,13 @@ PIString PICodeParser::parseClass(Entity * parent, PIString & fc) {
|
|||||||
}
|
}
|
||||||
if (cw == s_friend) {fc.cutLeft(fc.find(';') + 1); continue;}
|
if (cw == s_friend) {fc.cutLeft(fc.find(';') + 1); continue;}
|
||||||
if (cw == s_typedef) {
|
if (cw == s_typedef) {
|
||||||
ce->typedefs << parseTypedef(fc.takeLeft(fc.find(';')));
|
if (ce) {
|
||||||
typedefs << ce->typedefs.back();
|
ce->typedefs << parseTypedef(fc.takeLeft(fc.find(';')));
|
||||||
typedefs.back().first.insert(0, cur_namespace);
|
typedefs << ce->typedefs.back();
|
||||||
if (ce->typedefs.back().first.isEmpty())
|
typedefs.back().first.insert(0, cur_namespace);
|
||||||
ce->typedefs.pop_back();
|
if (ce->typedefs.back().first.isEmpty())
|
||||||
|
ce->typedefs.pop_back();
|
||||||
|
}
|
||||||
fc.takeSymbol();
|
fc.takeSymbol();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -501,7 +520,7 @@ PIString PICodeParser::parseClass(Entity * parent, PIString & fc) {
|
|||||||
}
|
}
|
||||||
def = !isDeclaration(fc, 0, &end);
|
def = !isDeclaration(fc, 0, &end);
|
||||||
tmp = (cw + fc.takeLeft(end)).trim();
|
tmp = (cw + fc.takeLeft(end)).trim();
|
||||||
if (!tmp.isEmpty())
|
if (!tmp.isEmpty() && ce)
|
||||||
parseMember(ce, tmp);
|
parseMember(ce, tmp);
|
||||||
if (def) fc.takeRange('{', '}');
|
if (def) fc.takeRange('{', '}');
|
||||||
else fc.takeSymbol();
|
else fc.takeSymbol();
|
||||||
@@ -510,7 +529,6 @@ PIString PICodeParser::parseClass(Entity * parent, PIString & fc) {
|
|||||||
}
|
}
|
||||||
cur_def_vis = prev_vis;
|
cur_def_vis = prev_vis;
|
||||||
cur_namespace = prev_namespace;
|
cur_namespace = prev_namespace;
|
||||||
return ce->name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ private:
|
|||||||
bool parseFileContent(PIString & fc, bool main);
|
bool parseFileContent(PIString & fc, bool main);
|
||||||
bool parseDirective(PIString d);
|
bool parseDirective(PIString d);
|
||||||
Entity * parseClassDeclaration(const PIString & fc);
|
Entity * parseClassDeclaration(const PIString & fc);
|
||||||
PIString parseClass(Entity * parent, PIString & fc);
|
void parseClass(Entity * parent, PIString & fc, bool is_namespace);
|
||||||
MetaMap parseMeta(PIString & fc);
|
MetaMap parseMeta(PIString & fc);
|
||||||
bool parseEnum(Entity * parent, const PIString & name, PIString fc, const MetaMap & meta);
|
bool parseEnum(Entity * parent, const PIString & name, PIString fc, const MetaMap & meta);
|
||||||
Typedef parseTypedef(PIString fc);
|
Typedef parseTypedef(PIString fc);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include "pimap.h"
|
#include "pimap.h"
|
||||||
#include "pivector2d.h"
|
#include "pivector2d.h"
|
||||||
|
|
||||||
|
#define PIP_BINARY_STREAM
|
||||||
|
|
||||||
#define BINARY_STREAM_FRIEND(T) \
|
#define BINARY_STREAM_FRIEND(T) \
|
||||||
template<typename P> friend PIBinaryStream<P> & operator <<(PIBinaryStream<P> & s, const T & v); \
|
template<typename P> friend PIBinaryStream<P> & operator <<(PIBinaryStream<P> & s, const T & v); \
|
||||||
|
|||||||
@@ -336,12 +336,12 @@ inline bool operator !=(const PISerial::DeviceInfo & v0, const PISerial::DeviceI
|
|||||||
//! \relatesalso PIByteArray
|
//! \relatesalso PIByteArray
|
||||||
//! \~english Store operator
|
//! \~english Store operator
|
||||||
//! \~russian Оператор сохранения
|
//! \~russian Оператор сохранения
|
||||||
inline PIByteArray & operator <<(PIByteArray & s, const PISerial::DeviceInfo & v) {s << v.vID << v.pID << v.path << v.description << v.manufacturer; return s;}
|
BINARY_STREAM_WRITE(PISerial::DeviceInfo) {s << v.vID << v.pID << v.path << v.description << v.manufacturer; return s;}
|
||||||
|
|
||||||
//! \relatesalso PIByteArray
|
//! \relatesalso PIByteArray
|
||||||
//! \~english Restore operator
|
//! \~english Restore operator
|
||||||
//! \~russian Оператор извлечения
|
//! \~russian Оператор извлечения
|
||||||
inline PIByteArray & operator >>(PIByteArray & s, PISerial::DeviceInfo & v) {s >> v.vID >> v.pID >> v.path >> v.description >> v.manufacturer; return s;}
|
BINARY_STREAM_READ (PISerial::DeviceInfo) {s >> v.vID >> v.pID >> v.path >> v.description >> v.manufacturer; return s;}
|
||||||
|
|
||||||
|
|
||||||
#endif // PISERIAL_H
|
#endif // PISERIAL_H
|
||||||
|
|||||||
24
main.cpp
24
main.cpp
@@ -3,11 +3,11 @@
|
|||||||
#include "pitextstream.h"
|
#include "pitextstream.h"
|
||||||
#include "piiostream.h"
|
#include "piiostream.h"
|
||||||
//#include "stream.h"
|
//#include "stream.h"
|
||||||
//#include "ccm.h"
|
//#include "ccm_.h"
|
||||||
//#include "pisystemmonitor_.h"
|
//#include "pisystemmonitor_.h"
|
||||||
|
|
||||||
using namespace PICoutManipulators;
|
using namespace PICoutManipulators;
|
||||||
|
/*
|
||||||
class File: public PIBinaryStream<File> {
|
class File: public PIBinaryStream<File> {
|
||||||
public:
|
public:
|
||||||
PIFile file;
|
PIFile file;
|
||||||
@@ -25,7 +25,9 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
struct TS {
|
struct TS {
|
||||||
TS(int v0 = -1, float v1 = -1, PIString v2 = "") {i = v0; f = v1;/* s = v2;*/}
|
TS(int v0 = -1, float v1 = -1, PIString v2 = "") {i = v0; f = v1;
|
||||||
|
// s = v2;
|
||||||
|
}
|
||||||
int i;
|
int i;
|
||||||
float f;
|
float f;
|
||||||
//PIString s;
|
//PIString s;
|
||||||
@@ -35,8 +37,20 @@ PICout operator << (PICout c, const TS & v) {c << '{' << v.i << ", " << v.f << '
|
|||||||
template<typename P> inline PIBinaryStream<P> & operator <<(PIBinaryStream<P> & s, const TS & v) {s << v.i; return s;}
|
template<typename P> inline PIBinaryStream<P> & operator <<(PIBinaryStream<P> & s, const TS & v) {s << v.i; return s;}
|
||||||
template<typename P> inline PIBinaryStream<P> & operator >>(PIBinaryStream<P> & s, TS & v) {s >> v.i; return s;}
|
template<typename P> inline PIBinaryStream<P> & operator >>(PIBinaryStream<P> & s, TS & v) {s >> v.i; return s;}
|
||||||
|
|
||||||
|
*/
|
||||||
int main(int argc, char * argv[]) {
|
int main(int argc, char * argv[]) {
|
||||||
PIFile f;
|
/*KMM::NS::Project p, p1;
|
||||||
|
p.sms_path = "mypath";
|
||||||
|
p.time_0 = "0.05";
|
||||||
|
p.time_1 = "10e + 3";
|
||||||
|
PIByteArray ba;
|
||||||
|
ba << p;
|
||||||
|
piCout << ba;
|
||||||
|
piCout << p1.sms_path << p1.time_0 << p1.time_1;
|
||||||
|
ba >> p1;
|
||||||
|
piCout << p1.sms_path << p1.time_0 << p1.time_1;*/
|
||||||
|
|
||||||
|
/*PIFile f;
|
||||||
f.open("_test.h", PIIODevice::ReadOnly);
|
f.open("_test.h", PIIODevice::ReadOnly);
|
||||||
PIIOTextStream ts(&f);
|
PIIOTextStream ts(&f);
|
||||||
ts.setEncoding(PIIOTextStream::System);
|
ts.setEncoding(PIIOTextStream::System);
|
||||||
@@ -45,7 +59,7 @@ int main(int argc, char * argv[]) {
|
|||||||
ts >> v;
|
ts >> v;
|
||||||
piCout << v;
|
piCout << v;
|
||||||
//piCout << ts.takeCWord();
|
//piCout << ts.takeCWord();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/*PIByteArray ba;
|
/*PIByteArray ba;
|
||||||
PIIOByteArray ioba(&ba);
|
PIIOByteArray ioba(&ba);
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ const char help_string[] =
|
|||||||
"\n"
|
"\n"
|
||||||
"-S (Stream operators)\n"
|
"-S (Stream operators)\n"
|
||||||
"Generate store/restore operators with format\n"
|
"Generate store/restore operators with format\n"
|
||||||
"PIByteArray & operator <<(PIByteArray & s, const <type> & v);\n"
|
"BINARY_STREAM_WRITE(<type>);\n"
|
||||||
"PIByteArray & operator >>(PIByteArray & s, <type> & v);\n"
|
"BINARY_STREAM_READ (<type>);\n"
|
||||||
"Only public variables used. All variables stored/restored\n"
|
"Only public variables used. All variables stored/restored\n"
|
||||||
"using PIChunkStream. IDs are variable number, starting from 1.\n"
|
"using PIChunkStream. IDs are variable number, starting from 1.\n"
|
||||||
"You can override ID with PIMETA(id=<ID>). If in class or struct\n"
|
"You can override ID with PIMETA(id=<ID>). If in class or struct\n"
|
||||||
@@ -354,7 +354,7 @@ bool needClassStream(const PICodeParser::Entity * e) {
|
|||||||
void makeClassStream(PIIOTextStream & ts, const PICodeParser::Entity * e) {
|
void makeClassStream(PIIOTextStream & ts, const PICodeParser::Entity * e) {
|
||||||
if (!needClassStream(e)) return;
|
if (!needClassStream(e)) return;
|
||||||
bool simple = e->meta.contains("simple-stream");
|
bool simple = e->meta.contains("simple-stream");
|
||||||
ts << "\nPIByteArray & operator <<(PIByteArray & s, const " << e->name << " & v) {\n";
|
ts << "\nBINARY_STREAM_WRITE(" << e->name << ") {\n";
|
||||||
if (!simple)
|
if (!simple)
|
||||||
ts << "\tPIChunkStream cs;\n";
|
ts << "\tPIChunkStream cs;\n";
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
@@ -362,9 +362,9 @@ void makeClassStream(PIIOTextStream & ts, const PICodeParser::Entity * e) {
|
|||||||
if (!simple)
|
if (!simple)
|
||||||
ts << "\ts << cs.data();\n";
|
ts << "\ts << cs.data();\n";
|
||||||
ts << "\treturn s;\n}\n";
|
ts << "\treturn s;\n}\n";
|
||||||
ts << "PIByteArray & operator >>(PIByteArray & s, " << e->name << " & v) {\n";
|
ts << "BINARY_STREAM_READ (" << e->name << ") {\n";
|
||||||
if (!simple) {
|
if (!simple) {
|
||||||
ts << "\tif (s.size_s() < 4) return s;\n";
|
//ts << "\tif (s.size_s() < 4) return s;\n";
|
||||||
ts << "\tPIByteArray csba; s >> csba;\n";
|
ts << "\tPIByteArray csba; s >> csba;\n";
|
||||||
ts << "\tPIChunkStream cs(csba);\n";
|
ts << "\tPIChunkStream cs(csba);\n";
|
||||||
ts << "\twhile (!cs.atEnd()) {\n";
|
ts << "\twhile (!cs.atEnd()) {\n";
|
||||||
@@ -378,20 +378,6 @@ void makeClassStream(PIIOTextStream & ts, const PICodeParser::Entity * e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void makeClassStreamHeader(PIIOTextStream & ts, const PICodeParser::Entity * e) {
|
|
||||||
if (!needClassStream(e)) return;
|
|
||||||
ts << "\n";
|
|
||||||
PIStringList sl = e->name.split("::");
|
|
||||||
for (int i = 0; i < sl.size_s() - 1; ++i)
|
|
||||||
ts << "namespace " << sl[i] << " {";
|
|
||||||
ts << e->type << " " << sl.back() << ";";
|
|
||||||
if (sl.size_s() > 1) ts << PIString('}').repeat(sl.size_s() - 1);
|
|
||||||
|
|
||||||
ts << "\nPIByteArray & operator <<(PIByteArray & s, const " << e->name << " & v);";
|
|
||||||
ts << "\nPIByteArray & operator >>(PIByteArray & s, " << e->name << " & v);\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void makeGetterType(PIIOTextStream & ts, const PICodeParser::Entity * e) {
|
void makeGetterType(PIIOTextStream & ts, const PICodeParser::Entity * e) {
|
||||||
if (!needClassStream(e)) return;
|
if (!needClassStream(e)) return;
|
||||||
ts << "\nconst char * getterType" << toCName(e->name) << "(const char * name) {\n";
|
ts << "\nconst char * getterType" << toCName(e->name) << "(const char * name) {\n";
|
||||||
@@ -424,7 +410,7 @@ bool writeModel(PICodeParser & parser, PICLI & cli, const PIString out, bool met
|
|||||||
PIString defname = "CCM_" + PIString::fromNumber(out.hash()) + "_H";
|
PIString defname = "CCM_" + PIString::fromNumber(out.hash()) + "_H";
|
||||||
PISet<PIString> inc_files;
|
PISet<PIString> inc_files;
|
||||||
piForeachC (PICodeParser::Entity * e, parser.entities)
|
piForeachC (PICodeParser::Entity * e, parser.entities)
|
||||||
if (e->name.find("::") < 0 && !e->name.startsWith("_PI"))
|
if (!e->name.startsWith("_PI"))
|
||||||
inc_files << e->file;
|
inc_files << e->file;
|
||||||
PIString inc_string;
|
PIString inc_string;
|
||||||
PIVector<PIString> incf = inc_files.toVector();
|
PIVector<PIString> incf = inc_files.toVector();
|
||||||
@@ -442,11 +428,8 @@ bool writeModel(PICodeParser & parser, PICLI & cli, const PIString out, bool met
|
|||||||
PIIOTextStream ts(&f);
|
PIIOTextStream ts(&f);
|
||||||
ts << "// Generated by \"PIP Code model generator\" " << PIDateTime::current().toString("dd.MM.yyyy hh:mm:ss\n\n");
|
ts << "// Generated by \"PIP Code model generator\" " << PIDateTime::current().toString("dd.MM.yyyy hh:mm:ss\n\n");
|
||||||
ts << "#include <string.h>\n";
|
ts << "#include <string.h>\n";
|
||||||
if (streams || texts)
|
ts << "#include \"" << out << ".h\"\n";
|
||||||
ts << "#include <pichunkstream.h>\n";
|
ts << "\nusing namespace PICodeInfo;\n";
|
||||||
ts << "#include \"" << out << ".h\"";
|
|
||||||
ts << inc_string << "\n";
|
|
||||||
ts << "\nusing namespace PICodeInfo;\n\n";
|
|
||||||
|
|
||||||
if (meta || enums || getters) {
|
if (meta || enums || getters) {
|
||||||
if (getters) {
|
if (getters) {
|
||||||
@@ -491,13 +474,6 @@ bool writeModel(PICodeParser & parser, PICLI & cli, const PIString out, bool met
|
|||||||
ts << "}\n";
|
ts << "}\n";
|
||||||
ts << "\n\nbool __ClassInfo_" << defname << "_Initializer__::_inited_ = false;\n";
|
ts << "\n\nbool __ClassInfo_" << defname << "_Initializer__::_inited_ = false;\n";
|
||||||
}
|
}
|
||||||
if (streams) {
|
|
||||||
ts << "\n\n// Stream operators\n";
|
|
||||||
piForeachC (PICodeParser::Entity * e, parser.entities) {
|
|
||||||
if (!e->has_name || e->name.startsWith("_PI")) continue;
|
|
||||||
makeClassStream(ts, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
f.close();
|
f.close();
|
||||||
|
|
||||||
@@ -515,11 +491,14 @@ bool writeModel(PICodeParser & parser, PICLI & cli, const PIString out, bool met
|
|||||||
ts << "\n";
|
ts << "\n";
|
||||||
ts << "#ifndef " << defname << "\n#define " << defname << "\n\n";
|
ts << "#ifndef " << defname << "\n#define " << defname << "\n\n";
|
||||||
ts << "#include <pivariant.h>\n#include <picodeinfo.h>";
|
ts << "#include <pivariant.h>\n#include <picodeinfo.h>";
|
||||||
|
if (streams || texts)
|
||||||
|
ts << "\n#include <pichunkstream.h>";
|
||||||
|
ts << inc_string << "\n";
|
||||||
if (streams) {
|
if (streams) {
|
||||||
ts << "\n\n// Stream operators\n";
|
ts << "\n\n// Stream operators\n";
|
||||||
piForeachC (PICodeParser::Entity * e, parser.entities) {
|
piForeachC (PICodeParser::Entity * e, parser.entities) {
|
||||||
if (!e->has_name || e->name.startsWith("_PI")) continue;
|
if (!e->has_name || e->name.startsWith("_PI")) continue;
|
||||||
makeClassStreamHeader(ts, e);
|
makeClassStream(ts, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (meta || enums || getters) {
|
if (meta || enums || getters) {
|
||||||
|
|||||||
Reference in New Issue
Block a user