aboutsummaryrefslogtreecommitdiffstats
path: root/InterfaceHandler.cpp
diff options
context:
space:
mode:
authorLiana Husikyan <liana@ethdev.com>2015-06-09 19:20:42 +0800
committerLiana Husikyan <liana@ethdev.com>2015-06-09 19:25:09 +0800
commit13a64777dea5aaf65fc176bfdf839e08ffec0f4d (patch)
treebb993cae68f9322f41fc14663edad950585344a0 /InterfaceHandler.cpp
parentc2a9419e495e931a825e8146aec49ffc34e44954 (diff)
downloaddexon-solidity-13a64777dea5aaf65fc176bfdf839e08ffec0f4d.tar.gz
dexon-solidity-13a64777dea5aaf65fc176bfdf839e08ffec0f4d.tar.zst
dexon-solidity-13a64777dea5aaf65fc176bfdf839e08ffec0f4d.zip
style fixes
Diffstat (limited to 'InterfaceHandler.cpp')
-rw-r--r--InterfaceHandler.cpp109
1 files changed, 62 insertions, 47 deletions
diff --git a/InterfaceHandler.cpp b/InterfaceHandler.cpp
index 9a2acd5b..8ad7b7c6 100644
--- a/InterfaceHandler.cpp
+++ b/InterfaceHandler.cpp
@@ -16,8 +16,10 @@ InterfaceHandler::InterfaceHandler()
m_lastTag = DocTagType::None;
}
-std::unique_ptr<std::string> InterfaceHandler::getDocumentation(ContractDefinition const& _contractDef,
- DocumentationType _type)
+unique_ptr<string> InterfaceHandler::getDocumentation(
+ ContractDefinition const& _contractDef,
+ DocumentationType _type
+)
{
switch(_type)
{
@@ -35,7 +37,7 @@ std::unique_ptr<std::string> InterfaceHandler::getDocumentation(ContractDefiniti
return nullptr;
}
-std::unique_ptr<std::string> InterfaceHandler::getABIInterface(ContractDefinition const& _contractDef)
+unique_ptr<string> InterfaceHandler::getABIInterface(ContractDefinition const& _contractDef)
{
Json::Value abi(Json::arrayValue);
@@ -101,7 +103,7 @@ std::unique_ptr<std::string> InterfaceHandler::getABIInterface(ContractDefinitio
event["inputs"] = params;
abi.append(event);
}
- return std::unique_ptr<std::string>(new std::string(Json::FastWriter().write(abi)));
+ return unique_ptr<string>(new string(Json::FastWriter().write(abi)));
}
unique_ptr<string> InterfaceHandler::getABISolidityInterface(ContractDefinition const& _contractDef)
@@ -141,7 +143,7 @@ unique_ptr<string> InterfaceHandler::getABISolidityInterface(ContractDefinition
return unique_ptr<string>(new string(ret + "}"));
}
-std::unique_ptr<std::string> InterfaceHandler::getUserDocumentation(ContractDefinition const& _contractDef)
+unique_ptr<string> InterfaceHandler::getUserDocumentation(ContractDefinition const& _contractDef)
{
Json::Value doc;
Json::Value methods(Json::objectValue);
@@ -163,10 +165,10 @@ std::unique_ptr<std::string> InterfaceHandler::getUserDocumentation(ContractDefi
}
doc["methods"] = methods;
- return std::unique_ptr<std::string>(new std::string(Json::FastWriter().write(doc)));
+ return unique_ptr<string>(new string(Json::FastWriter().write(doc)));
}
-std::unique_ptr<std::string> InterfaceHandler::getDevDocumentation(ContractDefinition const& _contractDef)
+unique_ptr<string> InterfaceHandler::getDevDocumentation(ContractDefinition const& _contractDef)
{
// LTODO: Somewhere in this function warnings for mismatch of param names
// should be thrown
@@ -203,7 +205,7 @@ std::unique_ptr<std::string> InterfaceHandler::getDevDocumentation(ContractDefin
method["author"] = m_author;
Json::Value params(Json::objectValue);
- std::vector<std::string> paramNames = it.second->getParameterNames();
+ vector<string> paramNames = it.second->getParameterNames();
for (auto const& pair: m_params)
{
if (find(paramNames.begin(), paramNames.end(), pair.first) == paramNames.end())
@@ -227,7 +229,7 @@ std::unique_ptr<std::string> InterfaceHandler::getDevDocumentation(ContractDefin
}
doc["methods"] = methods;
- return std::unique_ptr<std::string>(new std::string(Json::FastWriter().write(doc)));
+ return unique_ptr<string>(new string(Json::FastWriter().write(doc)));
}
/* -- private -- */
@@ -244,48 +246,54 @@ void InterfaceHandler::resetDev()
m_params.clear();
}
-static inline std::string::const_iterator skipLineOrEOS(std::string::const_iterator _nlPos,
- std::string::const_iterator _end)
+static inline string::const_iterator skipLineOrEOS(string::const_iterator _nlPos,
+ string::const_iterator _end)
{
return (_nlPos == _end) ? _end : ++_nlPos;
}
-std::string::const_iterator InterfaceHandler::parseDocTagLine(std::string::const_iterator _pos,
- std::string::const_iterator _end,
- std::string& _tagString,
- DocTagType _tagType,
- bool _appending)
+string::const_iterator InterfaceHandler::parseDocTagLine(
+ string::const_iterator _pos,
+ string::const_iterator _end,
+ string& _tagString,
+ DocTagType _tagType,
+ bool _appending
+)
{
- auto nlPos = std::find(_pos, _end, '\n');
+ auto nlPos = find(_pos, _end, '\n');
if (_appending && _pos < _end && *_pos != ' ')
_tagString += " ";
- std::copy(_pos, nlPos, back_inserter(_tagString));
+ copy(_pos, nlPos, back_inserter(_tagString));
m_lastTag = _tagType;
return skipLineOrEOS(nlPos, _end);
}
-std::string::const_iterator InterfaceHandler::parseDocTagParam(std::string::const_iterator _pos,
- std::string::const_iterator _end)
+string::const_iterator InterfaceHandler::parseDocTagParam(
+ string::const_iterator _pos,
+ string::const_iterator _end
+)
{
// find param name
- auto currPos = std::find(_pos, _end, ' ');
+ auto currPos = find(_pos, _end, ' ');
if (currPos == _end)
- BOOST_THROW_EXCEPTION(DocstringParsingError() << errinfo_comment("End of param name not found" + std::string(_pos, _end)));
+ BOOST_THROW_EXCEPTION(DocstringParsingError() << errinfo_comment("End of param name not found" + string(_pos, _end)));
- auto paramName = std::string(_pos, currPos);
+ auto paramName = string(_pos, currPos);
currPos += 1;
- auto nlPos = std::find(currPos, _end, '\n');
- auto paramDesc = std::string(currPos, nlPos);
- m_params.push_back(std::make_pair(paramName, paramDesc));
+ auto nlPos = find(currPos, _end, '\n');
+ auto paramDesc = string(currPos, nlPos);
+ m_params.push_back(make_pair(paramName, paramDesc));
m_lastTag = DocTagType::Param;
return skipLineOrEOS(nlPos, _end);
}
-std::string::const_iterator InterfaceHandler::appendDocTagParam(std::string::const_iterator _pos,
- std::string::const_iterator _end)
+string::const_iterator InterfaceHandler::appendDocTagParam(
+ string::const_iterator _pos,
+ string::const_iterator _end
+)
{
// Should never be called with an empty vector
solAssert(!m_params.empty(), "Internal: Tried to append to empty parameter");
@@ -293,18 +301,20 @@ std::string::const_iterator InterfaceHandler::appendDocTagParam(std::string::con
auto pair = m_params.back();
if (_pos < _end && *_pos != ' ')
pair.second += " ";
- auto nlPos = std::find(_pos, _end, '\n');
- std::copy(_pos, nlPos, back_inserter(pair.second));
+ auto nlPos = find(_pos, _end, '\n');
+ copy(_pos, nlPos, back_inserter(pair.second));
m_params.at(m_params.size() - 1) = pair;
return skipLineOrEOS(nlPos, _end);
}
-std::string::const_iterator InterfaceHandler::parseDocTag(std::string::const_iterator _pos,
- std::string::const_iterator _end,
- std::string const& _tag,
- CommentOwner _owner)
+string::const_iterator InterfaceHandler::parseDocTag(
+ string::const_iterator _pos,
+ string::const_iterator _end,
+ string const& _tag,
+ CommentOwner _owner
+)
{
// LTODO: need to check for @(start of a tag) between here and the end of line
// for all cases. Also somehow automate list of acceptable tags for each
@@ -345,9 +355,11 @@ std::string::const_iterator InterfaceHandler::parseDocTag(std::string::const_ite
return appendDocTag(_pos, _end, _owner);
}
-std::string::const_iterator InterfaceHandler::appendDocTag(std::string::const_iterator _pos,
- std::string::const_iterator _end,
- CommentOwner _owner)
+string::const_iterator InterfaceHandler::appendDocTag(
+ string::const_iterator _pos,
+ string::const_iterator _end,
+ CommentOwner _owner
+)
{
switch (m_lastTag)
{
@@ -379,33 +391,36 @@ std::string::const_iterator InterfaceHandler::appendDocTag(std::string::const_it
}
}
-static inline std::string::const_iterator getFirstSpaceOrNl(std::string::const_iterator _pos,
- std::string::const_iterator _end)
+static inline string::const_iterator getFirstSpaceOrNl(
+ string::const_iterator _pos,
+ string::const_iterator _end
+)
{
- auto spacePos = std::find(_pos, _end, ' ');
- auto nlPos = std::find(_pos, _end, '\n');
+ auto spacePos = find(_pos, _end, ' ');
+ auto nlPos = find(_pos, _end, '\n');
return (spacePos < nlPos) ? spacePos : nlPos;
}
-void InterfaceHandler::parseDocString(std::string const& _string, CommentOwner _owner)
+void InterfaceHandler::parseDocString(string const& _string, CommentOwner _owner)
{
auto currPos = _string.begin();
auto end = _string.end();
while (currPos != end)
{
- auto tagPos = std::find(currPos, end, '@');
- auto nlPos = std::find(currPos, end, '\n');
+ auto tagPos = find(currPos, end, '@');
+ auto nlPos = find(currPos, end, '\n');
if (tagPos != end && tagPos < nlPos)
{
// we found a tag
auto tagNameEndPos = getFirstSpaceOrNl(tagPos, end);
if (tagNameEndPos == end)
- BOOST_THROW_EXCEPTION(DocstringParsingError() <<
- errinfo_comment("End of tag " + std::string(tagPos, tagNameEndPos) + "not found"));
+ BOOST_THROW_EXCEPTION(
+ DocstringParsingError() <<
+ errinfo_comment("End of tag " + string(tagPos, tagNameEndPos) + "not found"));
- currPos = parseDocTag(tagNameEndPos + 1, end, std::string(tagPos + 1, tagNameEndPos), _owner);
+ currPos = parseDocTag(tagNameEndPos + 1, end, string(tagPos + 1, tagNameEndPos), _owner);
}
else if (m_lastTag != DocTagType::None) // continuation of the previous tag
currPos = appendDocTag(currPos, end, _owner);