diff -r fd9a33a86532 -r dace11211dc9 exec/constants.cpp.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/exec/constants.cpp.sh Sat Jan 11 01:02:01 2020 +0100 @@ -0,0 +1,39 @@ +#!/bin/bash + +CSV="$(cat)"; + +echo "// This file was generated from the specification. + +#include +#include + +namespace relpipe { +namespace in { +namespace filesystem { + +class ExecMsg { +public: +"; + +echo "$CSV" | relpipe-in-csv constants | relpipe-tr-sql --relation 'constants' "SELECT ' static const int ' || message || ';' FROM constants WHERE code > 0" | relpipe-out-nullbyte | xargs -0 -n1 echo + +echo " + static std::map getMessageNames() { + std::map m; +"; + +echo "$CSV" | relpipe-in-csv constants | relpipe-tr-sql --relation 'constants' "SELECT ' m[' || message || '] = L\"' || message || '\";' FROM constants WHERE code > 0" | relpipe-out-nullbyte | xargs -0 -n1 echo + +echo " + return m; + } + +}; +" + +echo "$CSV" | relpipe-in-csv constants | relpipe-tr-sql --relation 'constants' "SELECT 'const int ExecMsg::' || message || ' = ' || code || ';' FROM constants WHERE code > 0" | relpipe-out-nullbyte | xargs -0 -n1 echo + +echo " +} +} +}"; \ No newline at end of file