streamlet/constants.cpp.sh
author František Kučera <franta-hg@frantovo.cz>
Sat, 04 Dec 2021 21:14:49 +0100
branchv_0
changeset 8 a16db4c3caa1
parent 3 03cd058c33ba
permissions -rwxr-xr-x
Added tag v0.18 for changeset 3e9b7d1df976

#!/bin/bash

CSV="$(cat)";

echo "// This file was generated from the specification.

#pragma once

#include <map>
#include <string>

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<int, std::wstring> getMessageNames() {
		std::map<int, std::wstring> 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 "
}
}
}";