| 162 | } |
| 163 | |
| 164 | bool readFileWithoutComments(const std::string& fileName, std::stringstream& stream) |
| 165 | { |
| 166 | // Try to open the input file for reading and throw an error if we can't. |
| 167 | std::ifstream baseLevelFile(fileName.c_str(), std::ifstream::in); |
| 168 | if (!baseLevelFile.good()) |
| 169 | { |
| 170 | OD_LOG_WRN("File not found=" + fileName); |
| 171 | return false; |
| 172 | } |
| 173 | |
| 174 | // Read in the whole baseLevelFile, strip it of comments and feed it into |
| 175 | // the stream. |
| 176 | std::string nextParam; |
| 177 | while (baseLevelFile.good()) |
| 178 | { |
| 179 | std::getline(baseLevelFile, nextParam); |
| 180 | /* Find the first occurrence of the comment symbol on the |
| 181 | * line and return everything before that character. |
| 182 | */ |
| 183 | stream << nextParam.substr(0, nextParam.find('#')) << "\n"; |
| 184 | } |
| 185 | |
| 186 | baseLevelFile.close(); |
| 187 | |
| 188 | return true; |
| 189 | } |
| 190 | |
| 191 | bool readNextLineNotEmpty(std::istream& is, std::string& line) |
| 192 | { |
no outgoing calls
no test coverage detected