1
0
Fork 0
This commit is contained in:
Jan Steemann 2014-08-22 13:53:21 +02:00
parent 55608ceae2
commit 45d5d0f53a
5 changed files with 58 additions and 48 deletions

View File

@ -284,8 +284,8 @@ ArangoServer::ArangoServer (int argc, char** argv)
_defaultMaximalSize(TRI_JOURNAL_DEFAULT_MAXIMAL_SIZE),
_defaultWaitForSync(false),
_disableReplicationApplier(false),
_server(nullptr),
_developmentMode(false) {
_developmentMode(false),
_server(nullptr) {
char* p = TRI_GetTempPath();
// copy the string

View File

@ -73,7 +73,13 @@ Exception::~Exception () 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("' at line ");
message.append(basics::StringUtils::itoa(_line));
@ -81,22 +87,9 @@ char const* Exception::what () const throw () {
message += this->message();
return message.c_str();
}
*/
////////////////////////////////////////////////////////////////////////////////
/// @brief return exception message
////////////////////////////////////////////////////////////////////////////////
string Exception::message () const throw () {
return _errorMessage;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief return exception code
////////////////////////////////////////////////////////////////////////////////
int Exception::code () const throw () {
return _code;
return _errorMessage.c_str();
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -73,7 +73,9 @@ namespace triagens {
////////////////////////////////////////////////////////////////////////////////
class Exception : public virtual std::exception {
public:
Exception (int code,
char const* file,
int line);
@ -86,19 +88,24 @@ namespace triagens {
~Exception () throw ();
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, ...);
protected:
std::string const _errorMessage;
char const* _file;
int const _line;
int const _code;
char const* _file;
int const _line;
int const _code;
};
}

View File

@ -35,35 +35,46 @@
namespace triagens {
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup Shell
/// @{
////////////////////////////////////////////////////////////////////////////////
class Completer {
public:
////////////////////////////////////////////////////////////////////////////////
/// @brief public constructors destructors
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- constructors / destructors
// -----------------------------------------------------------------------------
virtual ~Completer() {};
public:
Completer () {
}
virtual ~Completer () {
}
// -----------------------------------------------------------------------------
// --SECTION-- public methods
// -----------------------------------------------------------------------------
public:
////////////////////////////////////////////////////////////////////////////////
/// @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
////////////////////////////////////////////////////////////////////////////////
virtual void getAlternatives(char const *, std::vector<std::string> &) = 0;
virtual void getAlternatives (char const*,
std::vector<std::string>&) = 0;
};
}
#endif
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------

View File

@ -58,9 +58,12 @@ class V8Completer : public Completer {
}
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
////////////////////////////////////////////////////////////////////////////////
class V8LineEditor : public LineEditor {
V8LineEditor (LineEditor const&);
V8LineEditor& operator= (LineEditor const&);
V8LineEditor (LineEditor const&) = delete;
V8LineEditor& operator= (LineEditor const&) = delete;
// -----------------------------------------------------------------------------
// --SECTION-- constructors and destructors
@ -94,20 +97,16 @@ class V8LineEditor : public LineEditor {
~V8LineEditor ();
// -----------------------------------------------------------------------------
// --SECTION-- public 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();
// -----------------------------------------------------------------------------