30#ifndef PT_JSONRPC_PROCEDUREDECLARATION_H
31#define PT_JSONRPC_PROCEDUREDECLARATION_H
33#include <Pt/JsonRpc/Api.h>
60 if(index >= _names.size())
61 _names.resize(index + 1);
64 _indexByName[name] = index;
73 std::map<std::string, std::size_t>::const_iterator it = _indexByName.find(name);
74 if(it == _indexByName.end())
77 return static_cast<int>(it->second);
86 static const std::string empty;
87 if(index >= _names.size())
96 {
return _names.size(); }
101 {
return ! _names.empty(); }
104 std::vector<std::string> _names;
105 std::map<std::string, std::size_t> _indexByName;
const std::string & getParamName(std::size_t index) const
Lookup parameter name by positional index.
Definition ProcedureDeclaration.h:84
void setParamName(std::size_t index, const std::string &name)
Register a parameter name at a positional index.
Definition ProcedureDeclaration.h:58
ProcedureDeclaration()
Default constructor.
Definition ProcedureDeclaration.h:53
std::size_t paramCount() const
Returns the number of named parameters.
Definition ProcedureDeclaration.h:95
int getParamIndex(const std::string &name) const
Lookup positional index by parameter name.
Definition ProcedureDeclaration.h:71
bool hasNames() const
Returns true if any parameter names are registered.
Definition ProcedureDeclaration.h:100
JSON-RPC 2.0 services and clients.
Core module.
Definition Allocator.h:33