drmfile.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef DRMFILE_H
  2. #define DRMFILE_H
  3. #include <QObject>
  4. class DRMFilePrivate;
  5. /*
  6. * DRMFile class
  7. *
  8. * Utility API intended to demonstrate and facilitate access to DRM protected
  9. * content.
  10. *
  11. * The API has two private implementations, one Symbian specific - using the
  12. * Content Access Framework (CAF) API - and an empty one which enables the API
  13. * to be used (more like compiled) in the simulator
  14. */
  15. class DRMFile : public QObject
  16. {
  17. Q_OBJECT
  18. Q_DECLARE_PRIVATE(DRMFile)
  19. public:
  20. /*
  21. * Constructor
  22. */
  23. explicit DRMFile(QObject *parent = 0);
  24. /*
  25. * Destructor
  26. */
  27. virtual ~DRMFile();
  28. public:
  29. /*
  30. * Read only open method for the specified file
  31. *
  32. * const QString & name - fully cualified file name and path.
  33. *
  34. * Will return a negative error code if the file opening fails. The error
  35. * code should be checked with *isDRMError* in order to understand
  36. */
  37. int open(const QString & name);
  38. /*
  39. * Read max of *length* bytes into the provided *data* buffer
  40. *
  41. * Will return a negative error code or the length of the read data.
  42. */
  43. int read(char* data, int length);
  44. /*
  45. * Close the file.
  46. */
  47. void close();
  48. /*
  49. * Returns a 32b value size of the amount of available (uncompressed) data.
  50. */
  51. int size();
  52. #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
  53. /*
  54. * Returns a 64b value size of the amount of available (uncompressed) data.
  55. * Only supported starting with Symbian^3
  56. */
  57. qint64 size64();
  58. #endif
  59. /*
  60. * Returns true if the error code returned by the *open* method is a DRM
  61. * specific error
  62. */
  63. bool isDRMError(int error);
  64. protected:
  65. /*
  66. * Private implementation of the API
  67. */
  68. DRMFilePrivate* const d_ptr;
  69. };
  70. #endif // DRMFILE_H