--------------------------------- FileUtil::ParseLine Removes one line from the input string and places it in the referenced extractedLine - returns false if no line could be extracted
| 92 | // - returns false if no line could be extracted |
| 93 | // |
| 94 | bool FileUtil::ParseLine(std::string &input, std::string &extractedLine) |
| 95 | { |
| 96 | if (input.size() == 0) |
| 97 | { |
| 98 | return false; |
| 99 | } |
| 100 | |
| 101 | int32 closestIdx = std::numeric_limits<int32>::max(); |
| 102 | uint32 tokenSize = 0; |
| 103 | for (auto token : newLineTokens) |
| 104 | { |
| 105 | int32 index = (int32)input.find(token); |
| 106 | if (index != std::string::npos && index < closestIdx) |
| 107 | { |
| 108 | closestIdx = index; |
| 109 | tokenSize = (uint32)token.size(); |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | if (closestIdx != std::string::npos && static_cast<uint32>(closestIdx) < input.size()) |
| 114 | { |
| 115 | extractedLine = input.substr(0, closestIdx); |
| 116 | input = input.substr(closestIdx + tokenSize); |
| 117 | if (input.size() == 0) input = ""; |
| 118 | return true; |
| 119 | } |
| 120 | extractedLine = input; |
| 121 | input = ""; |
| 122 | return true; |
| 123 | } |
| 124 | |
| 125 | //--------------------------------- |
| 126 | // FileUtil::ParseLines |
nothing calls this directly
no outgoing calls
no test coverage detected