| 46 | } |
| 47 | |
| 48 | void DocManager::load(wxString& path) |
| 49 | { |
| 50 | // TODO: Clear tips list |
| 51 | |
| 52 | std::ifstream fp; |
| 53 | fp.open(path, std::ios::in | std::ios::binary); |
| 54 | if(fp) |
| 55 | { |
| 56 | DataStreamPtr stream(new FileStreamDataStream(path.c_str(), &fp, false)); |
| 57 | |
| 58 | int index = -1; |
| 59 | String line; |
| 60 | String key; |
| 61 | while(!stream->eof()) |
| 62 | { |
| 63 | line = stream->getLine(); |
| 64 | |
| 65 | // Ignore comments |
| 66 | if(line.length() > 0 && line.at(0) == '#') continue; |
| 67 | |
| 68 | if(line.length() > 0 && line.at(0) == '[') |
| 69 | { |
| 70 | int endBrace = (int)line.find(']'); |
| 71 | if(endBrace != -1) |
| 72 | { |
| 73 | key = line.substr(1, endBrace - 1); |
| 74 | } |
| 75 | } |
| 76 | else |
| 77 | { |
| 78 | if(mDocs.find(key) != mDocs.end()) |
| 79 | mDocs[key] = mDocs[key] + "\n" + line; |
| 80 | else |
| 81 | mDocs[key] = line; |
| 82 | } |
| 83 | } |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | void DocManager::addDoc(wxString& key, wxString& doc) |
| 88 | { |
no test coverage detected