LCOV - code coverage report
Current view: top level - wibmod/src/WIB1 - conversions.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 19 0
Test Date: 2026-10-11 15:05:20 Functions: 0.0 % 1 0

            Line data    Source code
       1              : 
       2              : // Implementations of Item value conversions
       3              : //
       4              : // note that these are classes declared in a source file;
       5              : // ItemConversion::FromString is the one and only interface
       6              : //   for creating conversions
       7              : 
       8              : #include "wibmod/WIB1/ItemConversion.hh"
       9              : 
      10              : #include <boost/foreach.hpp>
      11              : #include <stdio.h> // sscanf
      12              : 
      13              : using boost::unordered_map;
      14              : 
      15              : namespace itemconv {
      16              : 
      17              : #define ARGS(...) __VA_ARGS__
      18              : #define EXPAND(x) x
      19              : #define STRIP(x) EXPAND(ARGS x)
      20              : #define DEFINE_CONVERSION_CLASS(name, body)                                                                            \
      21              :   class itemconv_##name : public ItemConversion                                                                        \
      22              :   {                                                                                                                    \
      23              :     STRIP(body)                                                                                                        \
      24              :   };
      25              : /*#define DEFINE_CONVERSION_CLASS_END                                           \
      26              : public:                                                                       \
      27              :   itemconv_##name (unordered_map<std::string, std::string> params) {          \
      28              :     init(params);                                                             \
      29              :   }                                                                           \
      30              : };*/
      31              : #include "wibmod/WIB1/conversions-impl.hh"
      32              : #undef DEFINE_CONVERSION_CLASS
      33              : #undef STRIP
      34              : #undef EXPAND
      35              : #undef STRIP
      36              : 
      37              : }
      38              : 
      39              : ItemConversion*
      40            0 : ItemConversion::FromString(std::string convstring)
      41              : {
      42            0 :   unordered_map<std::string, std::string> params;
      43            0 :   int i = 0;
      44            0 :   while (i < (int)convstring.size() && convstring[i] != ' ')
      45            0 :     i++;
      46            0 :   std::string fnname = std::string(convstring.c_str(), i);
      47            0 :   while (i < (int)convstring.size()) {
      48            0 :     while (i < (int)convstring.size() && convstring[i] == ' ')
      49            0 :       i++;
      50              :     int pair_start = i;
      51            0 :     while (i < (int)convstring.size() && convstring[i] != ' ')
      52            0 :       i++;
      53              :     int pair_end = i;
      54            0 :     int j = pair_start;
      55            0 :     while (j < (int)convstring.size() && convstring[j] != '=')
      56            0 :       j++;
      57            0 :     std::string key = std::string(convstring.c_str(), pair_start, j - pair_start);
      58            0 :     std::string value = std::string(convstring.c_str(), j + 1, pair_end - (j + 1));
      59            0 :     params[key] = value;
      60            0 :   }
      61              : 
      62              :   //  if (fnname==#name) return new itemconv::itemconv_##name(params);
      63              : 
      64              : #define DEFINE_CONVERSION_CLASS(name, body)                                                                            \
      65              :   if (fnname == #name) {                                                                                               \
      66              :     itemconv::itemconv_##name* c = new itemconv::itemconv_##name();                                                    \
      67              :     c->init(params);                                                                                                   \
      68              :     return c;                                                                                                          \
      69              :   }
      70              : #include "wibmod/WIB1/conversions-impl.hh"
      71              : #undef DEFINE_CONVERSION_CLASS
      72              : 
      73              :   return NULL;
      74            0 : }
        

Generated by: LCOV version 2.0-1