mirror of https://gitee.com/bigwinds/arangodb
cppcheck
This commit is contained in:
parent
55608ceae2
commit
45d5d0f53a
|
@ -284,8 +284,8 @@ ArangoServer::ArangoServer (int argc, char** argv)
|
||||||
_defaultMaximalSize(TRI_JOURNAL_DEFAULT_MAXIMAL_SIZE),
|
_defaultMaximalSize(TRI_JOURNAL_DEFAULT_MAXIMAL_SIZE),
|
||||||
_defaultWaitForSync(false),
|
_defaultWaitForSync(false),
|
||||||
_disableReplicationApplier(false),
|
_disableReplicationApplier(false),
|
||||||
_server(nullptr),
|
_developmentMode(false),
|
||||||
_developmentMode(false) {
|
_server(nullptr) {
|
||||||
|
|
||||||
char* p = TRI_GetTempPath();
|
char* p = TRI_GetTempPath();
|
||||||
// copy the string
|
// copy the string
|
||||||
|
|
|
@ -73,7 +73,13 @@ Exception::~Exception () throw () {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
char const* Exception::what () const throw () {
|
char const* Exception::what () const throw () {
|
||||||
string message("exception in '");
|
// we have to use an instance member here because we should not return a
|
||||||
|
// pointer (c_str()) to the internals of a stack object (stack object will
|
||||||
|
// be destroyed when function is left...)
|
||||||
|
// additionally, we should not create new string values here as this might
|
||||||
|
// throw exceptions - but this function is marked to throw no exceptions!
|
||||||
|
/*
|
||||||
|
std::string message = "exception in '";
|
||||||
message.append(_file);
|
message.append(_file);
|
||||||
message.append("' at line ");
|
message.append("' at line ");
|
||||||
message.append(basics::StringUtils::itoa(_line));
|
message.append(basics::StringUtils::itoa(_line));
|
||||||
|
@ -81,22 +87,9 @@ char const* Exception::what () const throw () {
|
||||||
message += this->message();
|
message += this->message();
|
||||||
|
|
||||||
return message.c_str();
|
return message.c_str();
|
||||||
}
|
*/
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
return _errorMessage.c_str();
|
||||||
/// @brief return exception message
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
string Exception::message () const throw () {
|
|
||||||
return _errorMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief return exception code
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
int Exception::code () const throw () {
|
|
||||||
return _code;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -73,7 +73,9 @@ namespace triagens {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class Exception : public virtual std::exception {
|
class Exception : public virtual std::exception {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Exception (int code,
|
Exception (int code,
|
||||||
char const* file,
|
char const* file,
|
||||||
int line);
|
int line);
|
||||||
|
@ -86,19 +88,24 @@ namespace triagens {
|
||||||
~Exception () throw ();
|
~Exception () throw ();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
char const * what () const throw ();
|
|
||||||
|
|
||||||
std::string message () const throw ();
|
char const * what () const throw ();
|
||||||
|
|
||||||
|
std::string message () const throw () {
|
||||||
|
return _errorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
int code () const throw();
|
int code () const throw () {
|
||||||
|
return _code;
|
||||||
|
}
|
||||||
|
|
||||||
static std::string FillExceptionString (int, ...);
|
static std::string FillExceptionString (int, ...);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string const _errorMessage;
|
std::string const _errorMessage;
|
||||||
char const* _file;
|
char const* _file;
|
||||||
int const _line;
|
int const _line;
|
||||||
int const _code;
|
int const _code;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,35 +35,46 @@
|
||||||
|
|
||||||
namespace triagens {
|
namespace triagens {
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @addtogroup Shell
|
|
||||||
/// @{
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
class Completer {
|
class Completer {
|
||||||
|
|
||||||
public:
|
// -----------------------------------------------------------------------------
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
// --SECTION-- constructors / destructors
|
||||||
/// @brief public constructors destructors
|
// -----------------------------------------------------------------------------
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
virtual ~Completer() {};
|
public:
|
||||||
|
|
||||||
|
Completer () {
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~Completer () {
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- public methods
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief check if line is complete
|
/// @brief check if line is complete
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
virtual bool isComplete(std::string const&, size_t lineno, size_t column) = 0;
|
virtual bool isComplete (std::string const&,
|
||||||
|
size_t lineno,
|
||||||
|
size_t column) = 0;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief computes all strings which begins with the given text
|
/// @brief computes all strings which begins with the given text
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
virtual void getAlternatives(char const *, std::vector<std::string> &) = 0;
|
virtual void getAlternatives (char const*,
|
||||||
|
std::vector<std::string>&) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- END-OF-FILE
|
// --SECTION-- END-OF-FILE
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
|
@ -58,9 +58,12 @@ class V8Completer : public Completer {
|
||||||
}
|
}
|
||||||
state;
|
state;
|
||||||
|
|
||||||
virtual bool isComplete(std::string const&, size_t lineno, size_t column);
|
virtual bool isComplete (std::string const&,
|
||||||
|
size_t lineno,
|
||||||
|
size_t column);
|
||||||
|
|
||||||
virtual void getAlternatives(char const *, vector<string> &);
|
virtual void getAlternatives (char const*,
|
||||||
|
std::vector<string>&);
|
||||||
};
|
};
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
@ -71,10 +74,10 @@ class V8Completer : public Completer {
|
||||||
/// @brief line editor
|
/// @brief line editor
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
class V8LineEditor : public LineEditor {
|
class V8LineEditor : public LineEditor {
|
||||||
V8LineEditor (LineEditor const&);
|
|
||||||
V8LineEditor& operator= (LineEditor const&);
|
V8LineEditor (LineEditor const&) = delete;
|
||||||
|
V8LineEditor& operator= (LineEditor const&) = delete;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- constructors and destructors
|
// --SECTION-- constructors and destructors
|
||||||
|
@ -94,20 +97,16 @@ class V8LineEditor : public LineEditor {
|
||||||
|
|
||||||
~V8LineEditor ();
|
~V8LineEditor ();
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// --SECTION-- public methods
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- protected methods
|
// --SECTION-- protected methods
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief creates a concrete Shell with the correct parameter (Completer!!)
|
/// @brief creates a concrete Shell with the correct parameter (Completer!!)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void initializeShell();
|
virtual void initializeShell();
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue