2
0

TrackReference.h 857 B

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include <pb_encode.h>
  3. #include <optional>
  4. #include <string_view>
  5. #include <vector>
  6. #include "NanoPBHelper.h"
  7. #include "pb_decode.h"
  8. #include "protobuf/spirc.pb.h"
  9. namespace cspot {
  10. struct TrackReference {
  11. TrackReference();
  12. // Resolved track GID
  13. std::vector<uint8_t> gid;
  14. std::string uri, context;
  15. std::optional<bool> queued;
  16. // Type identifier
  17. enum class Type { TRACK, EPISODE };
  18. Type type;
  19. void decodeURI();
  20. bool operator==(const TrackReference& other) const;
  21. // Encodes list of track references into a pb structure, used by nanopb
  22. static bool pbEncodeTrackList(pb_ostream_t* stream, const pb_field_t* field,
  23. void* const* arg);
  24. static bool pbDecodeTrackList(pb_istream_t* stream, const pb_field_t* field,
  25. void** arg);
  26. };
  27. } // namespace cspot