MCPcopy Create free account
hub / github.com/KDAB/codebrowser / main

Function main

indexgenerator/indexer.cpp:185–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185int main(int argc, char **argv) {
186
187 std::string root;
188 bool skipOptions = false;
189
190 for (int i = 1; i < argc; ++i) {
191 std::string arg = argv[i];
192 if (!skipOptions && arg[0]=='-') {
193 if (arg == "--") {
194 skipOptions = true;
195 } else if (arg=="-d") {
196 i++;
197 if (i < argc)
198 data_url = argv[i];
199 } else if (arg=="-p") {
200 i++;
201 if (i < argc) {
202 std::string s = argv[i];
203 auto colonPos = s.find(':');
204 if (colonPos >= s.size()) {
205 std::cerr << "fail to parse project option : " << s << std::endl;
206 continue;
207 }
208 auto secondColonPos = s.find(':', colonPos+1);
209 if (secondColonPos < s.size()) {
210 project_map[s.substr(0, colonPos)] = s.substr(secondColonPos + 1);
211 }
212 }
213 } else if (arg=="-e") {
214 i++;
215 // ignore -e XXX for compatibility with the generator project definitions
216 }
217 } else {
218 if (root.empty()) {
219 root = arg;
220 } else {
221 root = "";
222 break;
223 }
224 }
225 }
226
227 if (root.empty()) {
228 std::cerr << "Usage: " << argv[0] << " <path> [-d data_url] [-p project_definition]" << std::endl;
229 return -1;
230 }
231 std::ifstream fileIndex(root + "/" + "fileIndex");
232 std::string line;
233
234 FolderInfo rootInfo;
235 while (std::getline(fileIndex, line))
236 {
237 FolderInfo *parent = &rootInfo;
238
239 unsigned int pos = 0;
240 unsigned int next_pos;
241 while ((next_pos = line.find('/', pos)) < line.size()) {
242 auto &sub = parent->subfolders[line.substr(pos, next_pos - pos)];

Callers

nothing calls this directly

Calls 2

gererateRecursisivelyFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected