move to PIIOTextStream

This commit is contained in:
2022-05-13 13:24:09 +03:00
parent 1028233553
commit f67e3030b9
6 changed files with 217 additions and 188 deletions

View File

@@ -20,6 +20,7 @@
#include "parser.h"
#include "generator.h"
#include "picli.h"
#include "piiostream.h"
using namespace PICoutManipulators;
@@ -76,12 +77,16 @@ int main (int argc, char * argv[]) {
if (!out_file.isEmpty()) {
if (outf.open(out_file, PIIODevice::ReadWrite)) {
outf.clear();
} else piCout << "Error: can`t open out file";
outf << "// Generated by \"PIP Resources Compiler\" " << PIDateTime::current().toString("dd.MM.yyyy hh:mm:ss\n");
outf << "// Execute command:\n";
} else {
piCout << "Error: can`t open out file" << out_file;
return 1;
}
PIIOTextStream ts(&outf);
ts << "// Generated by \"PIP Resources Compiler\" " << PIDateTime::current().toString("dd.MM.yyyy hh:mm:ss\n");
ts << "// Execute command:\n";
piForeachC (PIString & _a, cli.rawArguments())
outf << "// \"" << _a << "\"\n";
outf << "\n";
ts << "// \"" << _a << "\"\n";
ts << "\n";
if (!generate(init_name, outf, files)) {
piCout << "Error: generate fail";
return 1;