| 158 | } |
| 159 | |
| 160 | bool read_FileInfo(const std::string& line, FileInfo& file) |
| 161 | // Attempt to deserialise a FileInfo object from the provided string. |
| 162 | // Returns true and populates file if this is possible, otherwise returns |
| 163 | // false. |
| 164 | { |
| 165 | std::istringstream ss(line); |
| 166 | std::string tok; |
| 167 | |
| 168 | if(ss >> tok && tok == "File" && ss >> tok) { |
| 169 | FileInfo f; |
| 170 | f.set_filename(tok); |
| 171 | while(ss >> tok) { |
| 172 | if(tok == "Type") { |
| 173 | if(!(ss >> tok)) return false; |
| 174 | f.set_type(tok); |
| 175 | |
| 176 | } else if(tok == "PageSize") { |
| 177 | size_t pagesize; |
| 178 | if(!(ss >> pagesize)) return false; |
| 179 | f.set_pagesize(pagesize); |
| 180 | |
| 181 | } else if (tok == "FileSize") { |
| 182 | size_t filesize; |
| 183 | if(!(ss >> filesize)) return false; |
| 184 | f.set_filesize(filesize); |
| 185 | } else if(tok == "Checksums") { |
| 186 | f.set_checksums(); |
| 187 | |
| 188 | } else if(tok == "Sparse") { |
| 189 | fprintf(stderr, "tok=Sparse, calling set_sparse\n"); |
| 190 | f.set_sparse(); |
| 191 | |
| 192 | } else if(tok == "New") { |
| 193 | continue; |
| 194 | |
| 195 | } else { |
| 196 | return false; |
| 197 | } |
| 198 | } |
| 199 | file = f; |
| 200 | return true; |
| 201 | } |
| 202 | return false; |
| 203 | } |
| 204 | |
| 205 | bool read_incr_FileInfo(const std::string& line, FileInfo& file, |
| 206 | std::vector<uint32_t>& incr_pages) |
no test coverage detected