interface: fix the substring search

This commit is contained in:
Yoichi Hirai committed 2016-11-23 17:38:41 +01:00
1 parent cace51fc47
commit 2faaddca05
3 files changed
+10 -10

No files matched your search

+7
View File
@@ -56,3 +56,10 @@ Error::Error(Type _type): m_type(_type)
break;
}
}
bool Error::searchForSubstring(const std::string& _substr) const
{
if (const std::string* str = boost::get_error_info<errinfo_comment>(*this))
return str->find(_substr) != std::string::npos;
return _substr.empty();
}
+1 -8
View File
@@ -23,7 +23,6 @@
#pragma once
#include <string>
#include <regex>
#include <utility>
#include <libdevcore/Exceptions.h>
#include <libevmasm/SourceLocation.h>
@@ -58,13 +57,7 @@ public:
Type type() const { return m_type; }
std::string const& typeName() const { return m_typeName; }
bool regex_search(const std::string& _reg) const
{
if (std::string const* str = boost::get_error_info<errinfo_comment>(*this))
return std::regex_search(*str, std::regex(_reg));
else
return false;
}
bool searchForSubstring(const std::string& _substr) const;
/// helper functions
static Error const* containsErrorOfType(ErrorList const& _list, Error::Type _type)