Browse Source

Removed: duplicate module 'slurp' (use std_utils in libpEpCxx11)

pull/15/head
heck 3 years ago
parent
commit
24e5e4370b
  1. 21
      src/slurp.cc
  2. 16
      src/slurp.hh

21
src/slurp.cc

@ -1,21 +0,0 @@
// This file is under GNU General Public License 3.0
// see LICENSE.txt
#include "slurp.hh"
#include <fstream>
#include <sstream>
#include <stdexcept>
namespace pEp {
std::string slurp(const std::string& filename)
{
std::ifstream input(filename.c_str(), std::ios_base::binary);
if (!input) {
throw std::runtime_error("Cannot read file \"" + filename + "\"! ");
}
std::stringstream sstr;
sstr << input.rdbuf();
return sstr.str();
}
} // end of namespace pEp

16
src/slurp.hh

@ -1,16 +0,0 @@
// This file is under GNU General Public License 3.0
// see LICENSE.txt
#ifndef LIBPEPADAPTER_LIB_SLURP_HH
#define LIBPEPADAPTER_LIB_SLURP_HH
#include <string>
namespace pEp {
// reads a whole file and returns it as std::string
// throws std::runtime_error() if the file cannot be read. Empty file is not an error.
std::string slurp(const std::string& filename);
} // end of namespace pEp
#endif // LIBPEPADAPTER_LIB_SLURP_HH
Loading…
Cancel
Save