void CPPClientStubGenerator::generateAssignments(Procedure &proc) { string assignment; parameterNameList_t list = proc.GetParameters(); if(list.size() > 0) { for (parameterNameList_t::iterator it = list.begin(); it != list.end(); it++) { if(proc.GetParameterDeclarationType() == PARAMS_BY_NAME) { assignment = TEMPLATE_NAMED_ASSIGNMENT; } else { assignment = TEMPLATE_POSITION_ASSIGNMENT; } replaceAll2(assignment, "<paramname>", it->first); cg.writeLine(assignment); } } else { cg.writeLine("p = Json::nullValue;"); } }
string CPPHelper::generateParameterDeclarationList (Procedure &proc) { stringstream param_string; parameterNameList_t list = proc.GetParameters(); for (parameterNameList_t::iterator it = list.begin(); it != list.end();) { param_string << toCppParamType(it->second) << " " << it->first; if (++it != list.end()) { param_string << ", "; } } return param_string.str(); }
void SpecificationWriter::procedureToJsonValue (const Procedure &procedure, Json::Value &target) { target[KEY_SPEC_PROCEDURE_NAME] = procedure.GetProcedureName(); if(procedure.GetProcedureType() == RPC_METHOD) { target[KEY_SPEC_RETURN_TYPE] = toJsonLiteral(procedure.GetReturnType()); } for(parameterNameList_t::const_iterator it = procedure.GetParameters().begin(); it != procedure.GetParameters().end(); ++it) { if(procedure.GetParameterDeclarationType() == PARAMS_BY_NAME) { target[KEY_SPEC_PROCEDURE_PARAMETERS][it->first] = toJsonLiteral(it->second); } else { target[KEY_SPEC_PROCEDURE_PARAMETERS].append(toJsonLiteral(it->second)); } } }