MCPcopy Create free account
hub / github.com/Kitware/CMake / BuildClientRequest

Method BuildClientRequest

Source/cmFileAPI.cxx:611–681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

609}
610
611cmFileAPI::ClientRequest cmFileAPI::BuildClientRequest(
612 Json::Value const& request)
613{
614 ClientRequest r;
615
616 if (!request.isObject()) {
617 r.Error = "request is not an object";
618 return r;
619 }
620
621 Json::Value const& kind = request["kind"];
622 if (kind.isNull()) {
623 r.Error = "'kind' member missing";
624 return r;
625 }
626 if (!kind.isString()) {
627 r.Error = "'kind' member is not a string";
628 return r;
629 }
630 std::string const& kindName = kind.asString();
631
632 if (kindName == this->ObjectKindName(ObjectKind::CodeModel)) {
633 r.Kind = ObjectKind::CodeModel;
634 } else if (kindName == this->ObjectKindName(ObjectKind::ConfigureLog)) {
635 r.Kind = ObjectKind::ConfigureLog;
636 } else if (kindName == this->ObjectKindName(ObjectKind::Cache)) {
637 r.Kind = ObjectKind::Cache;
638 } else if (kindName == this->ObjectKindName(ObjectKind::CMakeFiles)) {
639 r.Kind = ObjectKind::CMakeFiles;
640 } else if (kindName == this->ObjectKindName(ObjectKind::Toolchains)) {
641 r.Kind = ObjectKind::Toolchains;
642 } else if (kindName == this->ObjectKindName(ObjectKind::InternalTest)) {
643 r.Kind = ObjectKind::InternalTest;
644 } else {
645 r.Error = cmStrCat("unknown request kind '", kindName, '\'');
646 return r;
647 }
648
649 Json::Value const& version = request["version"];
650 if (version.isNull()) {
651 r.Error = "'version' member missing";
652 return r;
653 }
654 std::vector<RequestVersion> versions;
655 if (!cmFileAPI::ReadRequestVersions(version, versions, r.Error)) {
656 return r;
657 }
658
659 switch (r.Kind) {
660 case ObjectKind::CodeModel:
661 this->BuildClientRequestCodeModel(r, versions);
662 break;
663 case ObjectKind::ConfigureLog:
664 this->BuildClientRequestConfigureLog(r, versions);
665 break;
666 case ObjectKind::Cache:
667 this->BuildClientRequestCache(r, versions);
668 break;

Callers 1

BuildClientRequestsMethod · 0.95

Calls 12

ObjectKindNameMethod · 0.95
isObjectMethod · 0.80
isNullMethod · 0.80
isStringMethod · 0.80
asStringMethod · 0.80
cmStrCatFunction · 0.70

Tested by

no test coverage detected