1
0

item.h 875 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef NULLSOFT_APEV2_ITEM_H
  2. #define NULLSOFT_APEV2_ITEM_H
  3. #include <bfc/platform/types.h>
  4. namespace APEv2
  5. {
  6. enum
  7. {
  8. ITEM_KEY_COMPARE_CASE_INSENSITIVE = 0,
  9. ITEM_KEY_COMPARE_CASE_SENSITIVE = 1,
  10. };
  11. class Item
  12. {
  13. public:
  14. Item();
  15. ~Item();
  16. void Retain();
  17. void Release();
  18. /* If successful, puts incremented data pointer in new_data, and new data size remaining in new_len */
  19. int Read(void *data, size_t len, void **new_data, size_t *new_len);
  20. int Encode(void *data, size_t len);
  21. size_t EncodeSize();
  22. bool IsReadOnly();
  23. bool IsString();
  24. bool KeyMatch(const char *key, int compare=ITEM_KEY_COMPARE_CASE_INSENSITIVE);
  25. int Get(void **data, size_t *len);
  26. int GetKey(const char **tag);
  27. int Set(const void *data, size_t len, int dataType);
  28. int SetKey(const char *tag);
  29. private:
  30. size_t refCount;
  31. uint32_t flags;
  32. char *key;
  33. void *value;
  34. uint32_t len;
  35. };
  36. }
  37. #endif