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