std::string GetVersion()

in src/dlr_treelite.cc [14:32]


std::string GetVersion(const std::string& json_path) {
  std::ifstream file(json_path);
  bool colon_flag = false;
  bool quote_flag = false;
  std::string version = "";
  if (file.is_open()) {
    char c;
    while (file.good()) {
      c = file.get();
      if (c == ':')
        colon_flag = true;
      else if (colon_flag && quote_flag && (c == '"'))
        return version;
      else if (colon_flag && quote_flag)
        version.push_back(c);
    }
  }
  return version;
}