
3 changed files with 46 additions and 5 deletions
@ -1,28 +1,63 @@ |
|||||
#include "types.hh" |
#include "types.hh" |
||||
|
|
||||
|
#include <pEp/status_to_string.hh> // from libpEpAdapter |
||||
/*
|
/*
|
||||
#include <pEp/pEpEngine.h> |
#include <pEp/pEpEngine.h> |
||||
#include <pEp/stringpair.h> |
#include <pEp/stringpair.h> |
||||
#include <pEp/message.h> |
#include <pEp/message.h> |
||||
*/ |
*/ |
||||
|
|
||||
|
#include <string> |
||||
|
|
||||
namespace pEp |
namespace pEp |
||||
{ |
{ |
||||
|
EngineError::EngineError(PEP_STATUS status, const char* message) |
||||
|
: std::runtime_error( |
||||
|
std::string{"EngineError: "} |
||||
|
+ (message ? '"' + std::string{message} + "\" " : std::string{} ) |
||||
|
+ status_to_string(status) |
||||
|
) |
||||
|
{} |
||||
|
|
||||
template class Wrapper<::pEp_identity>; |
|
||||
template class Wrapper<::stringpair_t>; |
|
||||
|
|
||||
template class Wrapper<::message>; |
|
||||
|
|
||||
template<> |
template<> |
||||
template<> |
template<> |
||||
message* Wrapper<::message*>::_new<PEP_msg_direction, char*>(PEP_msg_direction dir, char* s) |
message* Wrapper<::message*>::_new<PEP_msg_direction, char*>(PEP_msg_direction dir, char* s) |
||||
{ |
{ |
||||
message* m = new_message(dir); |
message* m = new_message(dir); |
||||
|
if(!m) |
||||
|
{ |
||||
|
throw EngineError(PEP_OUT_OF_MEMORY, "new_message()"); |
||||
|
} |
||||
return m; |
return m; |
||||
} |
} |
||||
|
|
||||
|
template<> |
||||
|
template<> |
||||
|
::stringpair_t* Wrapper<::stringpair_t*>::_new(const char* key, const char* value) |
||||
|
{ |
||||
|
stringpair_t* sp = new_stringpair(key, value); |
||||
|
if(!sp) |
||||
|
{ |
||||
|
throw EngineError(PEP_OUT_OF_MEMORY, "new_stringpair()"); |
||||
|
} |
||||
|
return sp; |
||||
|
} |
||||
|
|
||||
|
template<> |
||||
|
template<> |
||||
|
::stringpair_t* Wrapper<::stringpair_t*>::_new(const std::string& key, const std::string& value) |
||||
|
{ |
||||
|
return Wrapper<::stringpair_t*>::_new(key.c_str(), value.c_str()); |
||||
|
} |
||||
|
|
||||
|
|
||||
Message m(PEP_dir_incoming, "Foo"); |
Message m(PEP_dir_incoming, "Foo"); |
||||
|
StringPair sp(std::string("foo"), std::string("bar")); |
||||
|
|
||||
|
template class Wrapper<::pEp_identity>; |
||||
|
template class Wrapper<::stringpair_t>; |
||||
|
|
||||
|
template class Wrapper<::message>; |
||||
|
|
||||
} // end of namespace pEp
|
} // end of namespace pEp
|
||||
|
Loading…
Reference in new issue