|
|
@ -52,7 +52,17 @@ namespace pEp |
|
|
|
} |
|
|
|
return sp; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template<> |
|
|
|
template<> |
|
|
|
::stringpair_t* Wrapper<::stringpair_t*>::_new(char* key, char* value) |
|
|
|
{ |
|
|
|
return _new<const char*, const char*>( |
|
|
|
const_cast<const char*>(key), |
|
|
|
const_cast<const char*>(value) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
template<> |
|
|
|
template<> |
|
|
|
::stringpair_t* Wrapper<::stringpair_t*>::_new(const std::string& key, const std::string& value) |
|
|
@ -117,6 +127,23 @@ namespace pEp |
|
|
|
{ |
|
|
|
stringpair_list_add(value, sp.move_out()); |
|
|
|
} |
|
|
|
|
|
|
|
template<> |
|
|
|
ListWrapper<::stringpair_list_t*, stringpair_t*>::ListWrapper(const std::initializer_list<StringPair>& il) |
|
|
|
: StringPairList{} |
|
|
|
{ |
|
|
|
::stringpair_list_t* last = nullptr; |
|
|
|
for(const StringPair& sp : il) |
|
|
|
{ |
|
|
|
last = stringpair_list_add(last, stringpair_dup(sp.get())); |
|
|
|
if(last==nullptr) |
|
|
|
{ |
|
|
|
throw std::runtime_error("Cannot create StringPairList from {}: Out Of Memory."); |
|
|
|
} |
|
|
|
if(value==nullptr) |
|
|
|
value = last; // save the head of linked list.
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
////////////////
|
|
|
|
|
|
|
@ -124,5 +151,6 @@ namespace pEp |
|
|
|
template class Wrapper<::stringpair_t>; |
|
|
|
|
|
|
|
template class Wrapper<::message>; |
|
|
|
template class ListWrapper<::stringpair_list_t*, ::stringpair_t*>; |
|
|
|
|
|
|
|
} // end of namespace pEp
|
|
|
|