mirror of
https://github.com/minetest/minetestmapper.git
synced 2025-07-02 00:20:22 +02:00
Refactoring (1)
This commit is contained in:
15
util.cpp
15
util.cpp
@ -1,3 +1,6 @@
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
inline std::string trim(const std::string &s)
|
||||
@ -23,11 +26,15 @@ inline std::string trim(const std::string &s)
|
||||
return s.substr(front, back - front);
|
||||
}
|
||||
|
||||
#define EOFCHECK() \
|
||||
if(is.eof()) \
|
||||
throw std::runtime_error(((std::string) "Setting '") + name + "' not found");
|
||||
#define EOFCHECK() do { \
|
||||
if (is.eof()) { \
|
||||
std::ostringstream oss; \
|
||||
oss << "Setting '" << name << "' not found."; \
|
||||
throw std::runtime_error(oss.str()); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
std::string get_setting(std::string name, std::istream &is)
|
||||
std::string read_setting(const std::string &name, std::istream &is)
|
||||
{
|
||||
char c;
|
||||
char s[256];
|
||||
|
Reference in New Issue
Block a user