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

Method GenerateHeader

OsiInterface/CustomFunctions.cpp:63–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63void CustomFunction::GenerateHeader(std::stringstream & ss) const
64{
65 switch (handle_.type()) {
66 case EoCFunctionType::Call: ss << "call "; break;
67 case EoCFunctionType::Query: ss << "query "; break;
68 case EoCFunctionType::Event: ss << "event "; break;
69 default: throw new std::runtime_error("EoC function not supported");
70 }
71
72 ss << name_ << "(";
73 for (unsigned i = 0; i < params_.size(); i++) {
74 if (i > 0) {
75 ss << ", ";
76 }
77
78 auto const & param = params_[i];
79 if (handle_.type() == EoCFunctionType::Query) {
80 if (param.Dir == FunctionArgumentDirection::In) {
81 ss << "[in]";
82 } else {
83 ss << "[out]";
84 }
85 }
86
87 switch (param.Type) {
88 case ValueType::None: ss << "(STRING)"; break; // "ANY" type passed from Osiris as string
89 case ValueType::Integer: ss << "(INTEGER)"; break;
90 case ValueType::Integer64: ss << "(INTEGER64)"; break;
91 case ValueType::Real: ss << "(REAL)"; break;
92 case ValueType::String: ss << "(STRING)"; break;
93 case ValueType::GuidString: ss << "(GUIDSTRING)"; break;
94 case ValueType::CharacterGuid: ss << "(CHARACTERGUID)"; break;
95 case ValueType::ItemGuid: ss << "(ITEMGUID)"; break;
96 case ValueType::TriggerGuid: ss << "(TRIGGERGUID)"; break;
97 default: throw new std::runtime_error("Type not supported");
98 }
99
100 ss << "_" << param.Name;
101 }
102
103 ss << ") (" << (unsigned)handle_.type() << "," << handle_.classIndex() << "," << handle_.functionIndex() << ",1)\r\n";
104}
105
106
107bool CustomCall::Call(OsiArgumentDesc const & params)

Callers 1

GenerateHeadersMethod · 0.80

Calls 3

typeMethod · 0.80
classIndexMethod · 0.80
functionIndexMethod · 0.80

Tested by

no test coverage detected