streamlet/constants.cpp.sh
branchv_0
changeset 3 03cd058c33ba
parent 2 dace11211dc9
equal deleted inserted replaced
2:dace11211dc9 3:03cd058c33ba
       
     1 #!/bin/bash
       
     2 
       
     3 CSV="$(cat)";
       
     4 
       
     5 echo "// This file was generated from the specification.
       
     6 
       
     7 #pragma once
       
     8 
       
     9 #include <map>
       
    10 #include <string>
       
    11 
       
    12 namespace relpipe {
       
    13 namespace in {
       
    14 namespace filesystem {
       
    15 
       
    16 class StreamletMsg {
       
    17 public:
       
    18 ";
       
    19 
       
    20 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
       
    21 
       
    22 echo "
       
    23 	static std::map<int, std::wstring> getMessageNames() {
       
    24 		std::map<int, std::wstring> m;
       
    25 ";
       
    26 
       
    27 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
       
    28 
       
    29 echo "
       
    30 		return m;
       
    31 	}
       
    32 
       
    33 };
       
    34 "
       
    35 
       
    36 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
       
    37 
       
    38 echo "
       
    39 }
       
    40 }
       
    41 }";