Ran clang-format across all files

This commit is contained in:
Pedro Pinto committed 2020-12-30 17:11:18 -05:00
1 parent a27321df2e
commit 8f21a77150
1123 files changed
+159414 -162346

No files matched your search

+68 -78
View File
@@ -1,87 +1,77 @@
#include "ParserExceptions.h"
#include <sstream>
#include <boost/lexical_cast.hpp>
#include <sstream>
namespace bts {
namespace expression {
//
// ParserException
//
ParserException::ParserException(const char* what)
: std::logic_error(""), _what(what)
{
//
// ParserException
//
ParserException::ParserException(const char *what)
: std::logic_error(""), _what(what) {}
ParserException::ParserException(const std::string &what)
: std::logic_error(""), _what(what) {}
ParserException::ParserException(const ParserException &other)
: std::logic_error(""), _what(other._what) {}
ParserException &ParserException::operator=(const ParserException &other) {
_what = other._what;
return *this;
}
const char *ParserException::what() const throw() { return _what.c_str(); }
ParserException::~ParserException() throw() {}
//
// ParseFailedException
//
ParseFailedException::ParseFailedException(
const std::string &context, size_t at)
: ParserException(
"Parse failed at position: " + boost::lexical_cast<std::string>(at) +
" in expression: " + context),
context(context) {}
//
// InvalidPropertyException
//
InvalidPropertyException::InvalidPropertyException(const std::string &prop_name)
: ParserException("Invalid property name: " + prop_name) {}
//
// InsuficientArgumentsException
//
InsuficientArgumentsException::InsuficientArgumentsException(
const std::string &op, const std::string &got, size_t expected)
: ParserException(""), expected_argument_count(expected), expression(got) {
std::ostringstream what;
what << "Bad argument count for operator " << op << std::endl
<< "expected " << expected_argument_count << " arguments. Got '"
<< expression << "'";
_what = what.str();
}
//
// RecursivePropertyGetException
//
RecursivePropertyGetException::RecursivePropertyGetException(
const std::string &property, const std::vector<std::string> &stack)
: ParserException("") {
std::ostringstream what;
what << "Error evaluating property '" << property
<< "': recursive property request at:" << std::endl;
std::vector<std::string>::const_reverse_iterator iter = stack.rbegin();
std::vector<std::string>::const_reverse_iterator end = stack.rend();
for (; iter != end; iter++) {
what << "> " << *iter << std::endl;
}
_what = what.str();
}
ParserException::ParserException(const std::string& what)
: std::logic_error(""), _what(what)
{
}
ParserException::ParserException(const ParserException& other)
: std::logic_error(""), _what(other._what)
{
}
ParserException& ParserException::operator=(const ParserException& other)
{
_what = other._what;
return *this;
}
const char* ParserException::what() const throw()
{
return _what.c_str();
}
ParserException::~ParserException() throw() { }
//
// ParseFailedException
//
ParseFailedException::ParseFailedException(const std::string& context, size_t at)
: ParserException("Parse failed at position: " + boost::lexical_cast<std::string>(at) + " in expression: " + context),
context(context)
{
}
//
// InvalidPropertyException
//
InvalidPropertyException::InvalidPropertyException(const std::string& prop_name)
: ParserException("Invalid property name: " + prop_name)
{}
//
// InsuficientArgumentsException
//
InsuficientArgumentsException::InsuficientArgumentsException(const std::string& op, const std::string& got, size_t expected)
: ParserException(""),
expected_argument_count(expected),
expression(got)
{
std::ostringstream what;
what << "Bad argument count for operator " << op << std::endl << "expected " << expected_argument_count << " arguments. Got '" << expression << "'";
_what = what.str();
}
//
// RecursivePropertyGetException
//
RecursivePropertyGetException::RecursivePropertyGetException(const std::string& property, const std::vector<std::string>& stack)
: ParserException("")
{
std::ostringstream what;
what << "Error evaluating property '" << property << "': recursive property request at:" << std::endl;
std::vector<std::string>::const_reverse_iterator iter = stack.rbegin ();
std::vector<std::string>::const_reverse_iterator end = stack.rend ();
for(; iter != end; iter++)
{
what << "> " << *iter << std::endl;
}
_what = what.str();
}
}}//namespace
} // namespace expression
} // namespace bts