Expansion of utility functions

In order to keep things simple and easy to read, it's always a good idea to create utility-type functions out of any code that is going to be used frequently. When dealing with interface de-serialization, many elements have to read in parameters that have spaces in them. Our solution to this problem is to put the string in double quotes and define an inline function to read the data. The perfect spot for that is in the Utilities.h file:

inline void ReadQuotedString(std::stringstream& l_stream, std::string& l_string) { l_stream >> l_string; if (l_string.at(0) == '"'){ while (l_string.at(l_string.length() - 1) != '"' || !l_stream.eof()) { std::string str; l_stream >> str; l_string.append(" " + str); } } l_string.erase(std::remove(l_string.begin(), ...

Get SFML Game Development By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.