| 494 | } |
| 495 | |
| 496 | void cComponentManager::exportComponentList() |
| 497 | { |
| 498 | rapidjson::Document doc; |
| 499 | rapidjson::MemoryPoolAllocator<> &allocator = doc.GetAllocator(); |
| 500 | doc.SetObject(); |
| 501 | |
| 502 | rapidjson::Value components(rapidjson::kArrayType); |
| 503 | |
| 504 | for (int i = 0; i < getNtypes(); i++) { |
| 505 | const char * tp = getComponentType(i, 0); |
| 506 | if (tp != NULL) { |
| 507 | rapidjson::Value component(rapidjson::kObjectType); |
| 508 | |
| 509 | component.AddMember("name", rapidjson::Value(tp, allocator), allocator); |
| 510 | |
| 511 | if (compTs[i].abstract) { |
| 512 | component.AddMember("abstract", rapidjson::Value(rapidjson::kTrueType), allocator); |
| 513 | } |
| 514 | if (compTs[i].noDmem) { |
| 515 | component.AddMember("noDmem", rapidjson::Value(rapidjson::kTrueType), allocator); |
| 516 | } |
| 517 | if (compTs[i].description != NULL) { |
| 518 | component.AddMember("description", rapidjson::Value(compTs[i].description, allocator), allocator); |
| 519 | } else { |
| 520 | component.AddMember("description", rapidjson::Value(rapidjson::kNullType), allocator); |
| 521 | } |
| 522 | |
| 523 | components.PushBack(component, allocator); |
| 524 | } |
| 525 | } |
| 526 | |
| 527 | doc.AddMember("components", components, allocator); |
| 528 | |
| 529 | rapidjson::Value configTypes = confman->exportTypeInfo(allocator); |
| 530 | doc.AddMember("configTypes", configTypes, allocator); |
| 531 | |
| 532 | // serialize JSON to string and print it |
| 533 | rapidjson::StringBuffer buffer; |
| 534 | rapidjson::Writer<rapidjson::StringBuffer> writer(buffer); |
| 535 | doc.Accept(writer); |
| 536 | printf("%s\n", buffer.GetString()); |
| 537 | } |
| 538 | |
| 539 | cComponentManager::cComponentManager(cConfigManager *_confman, const registerFunction _clist[]) : |
| 540 | nComponents(0), |
no test coverage detected