diff -r dace11211dc9 -r 03cd058c33ba streamlet/constants.cpp.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/streamlet/constants.cpp.sh Sat Jan 11 18:06:58 2020 +0100 @@ -0,0 +1,41 @@ +#!/bin/bash + +CSV="$(cat)"; + +echo "// This file was generated from the specification. + +#pragma once + +#include +#include + +namespace relpipe { +namespace in { +namespace filesystem { + +class StreamletMsg { +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 StreamletMsg::' || message || ' = ' || code || ';' FROM constants WHERE code > 0" | relpipe-out-nullbyte | xargs -0 -n1 echo + +echo " +} +} +}";