Skip to content

Commit

Permalink
Tests for XmlRpcValue and XML conversion. (#1216)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepurvis committed Nov 3, 2017
1 parent 321e977 commit 06494a7
Show file tree
Hide file tree
Showing 7 changed files with 701 additions and 64 deletions.
63 changes: 0 additions & 63 deletions utilities/xmlrpcpp/include/xmlrpcpp/XmlRpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,67 +36,4 @@

#include <stdexcept>

namespace XmlRpc {


//! An interface allowing custom handling of error message reporting.
class XmlRpcErrorHandler {
public:
virtual ~XmlRpcErrorHandler() { }

//! Returns a pointer to the currently installed error handling object.
static XmlRpcErrorHandler* getErrorHandler()
{ return _errorHandler; }

//! Specifies the error handler.
static void setErrorHandler(XmlRpcErrorHandler* eh)
{ _errorHandler = eh; }

//! Report an error. Custom error handlers should define this method.
virtual void error(const char* msg) = 0;

protected:
static XmlRpcErrorHandler* _errorHandler;
};

//! An interface allowing custom handling of informational message reporting.
class XmlRpcLogHandler {
public:
virtual ~XmlRpcLogHandler() { }

//! Returns a pointer to the currently installed message reporting object.
static XmlRpcLogHandler* getLogHandler()
{ return _logHandler; }

//! Specifies the message handler.
static void setLogHandler(XmlRpcLogHandler* lh)
{ _logHandler = lh; }

//! Returns the level of verbosity of informational messages. 0 is no output, 5 is very verbose.
static int getVerbosity()
{ return _verbosity; }

//! Specify the level of verbosity of informational messages. 0 is no output, 5 is very verbose.
static void setVerbosity(int v)
{ _verbosity = v; }

//! Output a message. Custom error handlers should define this method.
virtual void log(int level, const char* msg) = 0;

protected:
static XmlRpcLogHandler* _logHandler;
static int _verbosity;
};

//! Returns log message verbosity. This is short for XmlRpcLogHandler::getVerbosity()
int getVerbosity();
//! Sets log message verbosity. This is short for XmlRpcLogHandler::setVerbosity(level)
void setVerbosity(int level);


//! Version identifier
extern const char XMLRPC_VERSION[];

} // namespace XmlRpc

#endif // _XMLRPC_H_
57 changes: 57 additions & 0 deletions utilities/xmlrpcpp/include/xmlrpcpp/XmlRpcUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,63 @@

namespace XmlRpc {

//! An interface allowing custom handling of error message reporting.
class XmlRpcErrorHandler {
public:
virtual ~XmlRpcErrorHandler() { }

//! Returns a pointer to the currently installed error handling object.
static XmlRpcErrorHandler* getErrorHandler()
{ return _errorHandler; }

//! Specifies the error handler.
static void setErrorHandler(XmlRpcErrorHandler* eh)
{ _errorHandler = eh; }

//! Report an error. Custom error handlers should define this method.
virtual void error(const char* msg) = 0;

protected:
static XmlRpcErrorHandler* _errorHandler;
};

//! An interface allowing custom handling of informational message reporting.
class XmlRpcLogHandler {
public:
virtual ~XmlRpcLogHandler() { }

//! Returns a pointer to the currently installed message reporting object.
static XmlRpcLogHandler* getLogHandler()
{ return _logHandler; }

//! Specifies the message handler.
static void setLogHandler(XmlRpcLogHandler* lh)
{ _logHandler = lh; }

//! Returns the level of verbosity of informational messages. 0 is no output, 5 is very verbose.
static int getVerbosity()
{ return _verbosity; }

//! Specify the level of verbosity of informational messages. 0 is no output, 5 is very verbose.
static void setVerbosity(int v)
{ _verbosity = v; }

//! Output a message. Custom error handlers should define this method.
virtual void log(int level, const char* msg) = 0;

protected:
static XmlRpcLogHandler* _logHandler;
static int _verbosity;
};

//! Returns log message verbosity. This is short for XmlRpcLogHandler::getVerbosity()
int getVerbosity();
//! Sets log message verbosity. This is short for XmlRpcLogHandler::setVerbosity(level)
void setVerbosity(int level);

//! Version identifier
extern const char XMLRPC_VERSION[];

//! Utilities for XML parsing, encoding, and decoding and message handlers.
class XMLRPCPP_DECL XmlRpcUtil {
public:
Expand Down
9 changes: 9 additions & 0 deletions utilities/xmlrpcpp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,12 @@ catkin_add_gtest(xmlrpcvalue_base64 xmlrpcvalue_base64.cpp)
if(TARGET xmlrpcvalue_base64)
target_link_libraries(xmlrpcvalue_base64 xmlrpcpp)
endif()

catkin_add_gtest(TestValues TestValues.cpp)
target_link_libraries(TestValues xmlrpcpp)

catkin_add_gtest(test_util test_util.cpp)
target_link_libraries(test_util xmlrpcpp)

catkin_add_gtest(TestXml TestXml.cpp)
target_link_libraries(TestXml xmlrpcpp)
Loading

0 comments on commit 06494a7

Please sign in to comment.