A C++ wrapper for the basic C datatypes defined by the pEpEngine.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
874 B

  1. #include "bloblist.hh"
  2. #include <pEp/bloblist.h>
  3. namespace pEp
  4. {
  5. template<>
  6. void Wrapper<::bloblist_t*>::_free(::bloblist_t* bl)
  7. {
  8. ::free_bloblist(bl);
  9. }
  10. template<>
  11. int BlobList::size() const
  12. {
  13. return bloblist_length(value);
  14. }
  15. // faster than .size()==0 because it's not necessary to iterate throgh the whole list
  16. template<>
  17. bool BlobList::empty() const
  18. {
  19. return !(value && value->value);
  20. }
  21. template<>
  22. void BlobList::clear()
  23. {
  24. free_bloblist(value);
  25. value = nullptr;
  26. }
  27. template<>
  28. void BlobList::push_back(const char*&& s)
  29. {
  30. auto last = stringlist_add(value, s);
  31. if(value==nullptr)
  32. value = last;
  33. }
  34. ////////////////
  35. template class ListWrapper<::bloblist_t*, ::bloblist_t*>;
  36. } // end of namespace pEp