implement the wrapper for certain types.

master
roker 2 years ago
parent 68052a3c78
commit fe88301c3b

@ -10,12 +10,12 @@ all: src
src:
$(MAKE) -C src
#test: src
# $(MAKE) -C test
test: src
$(MAKE) -C test
clean:
$(MAKE) -C src clean
# $(MAKE) -C test clean
$(MAKE) -C test clean
install:
$(MAKE) -C src install

@ -11,7 +11,7 @@ namespace pEp
// creates a string where \n ("linefeed" a.k.a. LF) are replaced
// by \r\n ("carriage return + linefeed" a.k.a. CRLF).
// Useful to define strings in NET-ASCII or Net-Unicode (RFC5198) format
// from string literals.
// from string literals.
std::string operator""_CRLF(const char* str, size_t length);
} // end of namespace pEp

@ -0,0 +1,27 @@
#include "types.hh"
/*
#include <pEp/pEpEngine.h>
#include <pEp/stringpair.h>
#include <pEp/message.h>
*/
namespace pEp
{
template class Wrapper<::pEp_identity>;
template class Wrapper<::stringpair_t>;
template class Wrapper<::message>;
template<>
message* Wrapper<::message>::_new(PEP_msg_direction dir, char* s)
{
message* m = new_message(dir);
return m;
}
Message m(PEP_dir_incoming, "Foo");
} // end of namespace pEp

@ -0,0 +1,23 @@
// This file is under GNU General Public License 3.0
// see LICENSE.txt
#ifndef LIBPEPDATATYPES_TYPES_HH
#define LIBPEPDATATYPES_TYPES_HH
#include "wrapper.hh"
#include <pEp/pEpEngine.h>
#include <pEp/stringpair.h>
#include <pEp/message.h>
namespace pEp
{
using Identity = Wrapper<::pEp_identity>;
using StringPair = Wrapper<::stringpair_t>;
using Message = Wrapper<::message>;
} // end of namespace pEp
#endif // LIBPEPDATATYPES_TYPES_HH

@ -12,7 +12,7 @@ class Wrapper
{
public:
template<class... Args>
Wrapper(Args... args) : value{ _new(args...) } {}
Wrapper(Args... args) : value{ this->_new(args...) } {}
// no implicit copying... (yet?)
Wrapper(const Wrapper<T>&) = delete;
@ -43,7 +43,7 @@ public:
Wrapper() : value{nullptr} {}
template<class... Args>
Wrapper(Args... args) : value{ _new(args...) } {}
Wrapper(Args... args) : value{ this->_new(args...) } {}
// no implicit copying... (yet?)
Wrapper(const Wrapper<T*>&) = delete;

Loading…
Cancel
Save