MCPcopy Create free account
hub / github.com/Norbyte/ositools / ValidateParam

Method ValidateParam

OsiInterface/CustomFunctions.cpp:29–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27}
28
29bool CustomFunction::ValidateParam(CustomFunctionParam const & param, OsiArgumentValue const & value) const
30{
31 if (param.Type == ValueType::None
32 || param.Dir == FunctionArgumentDirection::Out) {
33 return true;
34 }
35
36 auto typeId = value.TypeId;
37 if (typeId == ValueType::CharacterGuid
38 || typeId == ValueType::ItemGuid
39 || typeId == ValueType::TriggerGuid
40 || typeId == ValueType::SplineGuid
41 || typeId == ValueType::LevelTemplateGuid) {
42 typeId = ValueType::GuidString;
43 }
44
45 auto paramTypeId = param.Type;
46 if (paramTypeId == ValueType::CharacterGuid
47 || paramTypeId == ValueType::ItemGuid
48 || paramTypeId == ValueType::TriggerGuid
49 || paramTypeId == ValueType::SplineGuid
50 || paramTypeId == ValueType::LevelTemplateGuid) {
51 paramTypeId = ValueType::GuidString;
52 }
53
54 if (typeId != paramTypeId) {
55 OsiError("Function " << name_ << "/" << params_.size() << ": Argument '" << param.Name
56 << "' type mismatch; expected " << (unsigned)paramTypeId << ", got " << (unsigned)typeId);
57 return false;
58 }
59
60 return true;
61}
62
63void CustomFunction::GenerateHeader(std::stringstream & ss) const
64{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected