diff options
Diffstat (limited to 'InterfaceHandler.cpp')
-rw-r--r-- | InterfaceHandler.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/InterfaceHandler.cpp b/InterfaceHandler.cpp index 224234cb..0843c363 100644 --- a/InterfaceHandler.cpp +++ b/InterfaceHandler.cpp @@ -35,8 +35,9 @@ std::unique_ptr<std::string> InterfaceHandler::getDocumentation(ContractDefiniti std::unique_ptr<std::string> InterfaceHandler::getABIInterface(ContractDefinition const& _contractDef) { Json::Value methods(Json::arrayValue); + auto interfaceFunctions = _contractDef.getInterfaceFunctions(); - for (FunctionDefinition const* f: _contractDef.getInterfaceFunctions()) + for (auto it = interfaceFunctions.cbegin(); it != interfaceFunctions.cend(); ++it) { Json::Value method; Json::Value inputs(Json::arrayValue); @@ -55,10 +56,10 @@ std::unique_ptr<std::string> InterfaceHandler::getABIInterface(ContractDefinitio return params; }; - method["name"] = f->getName(); - method["constant"] = f->isDeclaredConst(); - method["inputs"] = populateParameters(f->getParameters()); - method["outputs"] = populateParameters(f->getReturnParameters()); + method["name"] = it->second->getName(); + method["constant"] = it->second->isDeclaredConst(); + method["inputs"] = populateParameters(it->second->getParameters()); + method["outputs"] = populateParameters(it->second->getReturnParameters()); methods.append(method); } return std::unique_ptr<std::string>(new std::string(m_writer.write(methods))); @@ -68,11 +69,12 @@ std::unique_ptr<std::string> InterfaceHandler::getUserDocumentation(ContractDefi { Json::Value doc; Json::Value methods(Json::objectValue); + auto interfaceFunctions = _contractDef.getInterfaceFunctions(); - for (FunctionDefinition const* f: _contractDef.getInterfaceFunctions()) + for (auto it = interfaceFunctions.cbegin(); it != interfaceFunctions.cend(); ++it) { Json::Value user; - auto strPtr = f->getDocumentation(); + auto strPtr = it->second->getDocumentation(); if (strPtr) { resetUser(); @@ -80,7 +82,7 @@ std::unique_ptr<std::string> InterfaceHandler::getUserDocumentation(ContractDefi if (!m_notice.empty()) {// since @notice is the only user tag if missing function should not appear user["notice"] = Json::Value(m_notice); - methods[f->getName()] = user; + methods[it->second->getName()] = user; } } } @@ -110,10 +112,11 @@ std::unique_ptr<std::string> InterfaceHandler::getDevDocumentation(ContractDefin doc["title"] = m_title; } - for (FunctionDefinition const* f: _contractDef.getInterfaceFunctions()) + auto interfaceFunctions = _contractDef.getInterfaceFunctions(); + for (auto it = interfaceFunctions.cbegin(); it != interfaceFunctions.cend(); ++it) { Json::Value method; - auto strPtr = f->getDocumentation(); + auto strPtr = it->second->getDocumentation(); if (strPtr) { resetDev(); @@ -136,7 +139,7 @@ std::unique_ptr<std::string> InterfaceHandler::getDevDocumentation(ContractDefin method["return"] = m_return; if (!method.empty()) // add the function, only if we have any documentation to add - methods[f->getName()] = method; + methods[it->second->getName()] = method; } } doc["methods"] = methods; |