drmfile.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /**
  2. * Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
  3. * All rights reserved.
  4. *
  5. * For the applicable distribution terms see the license.txt -file, included in
  6. * the distribution.
  7. */
  8. #ifndef DRMFILE_H
  9. #define DRMFILE_H
  10. #include <QObject>
  11. class DRMFilePrivate;
  12. /*!
  13. \class DRMFile class
  14. \brief Utility API intended to demonstrate and facilitate access to DRM protected
  15. content.
  16. The API has two private implementations, one Symbian specific - using the
  17. Content Access Framework (CAF) API - and an empty one which enables the API
  18. to be used (more like compiled) in the simulator
  19. */
  20. class DRMFile : public QObject
  21. {
  22. Q_OBJECT
  23. Q_DECLARE_PRIVATE(DRMFile)
  24. public:
  25. /*!
  26. Constructor
  27. */
  28. explicit DRMFile(QObject *parent = 0);
  29. /*!
  30. Destructor
  31. */
  32. virtual ~DRMFile();
  33. public:
  34. /*!
  35. open method for the specified file
  36. const QString & name - fully qualified file name and path.
  37. Will return a negative error code if the file opening fails. The error
  38. code should be checked with *isDRMError* in order to understand
  39. */
  40. int open(const QString & name);
  41. /*!
  42. Read max of *length* bytes into the provided *data* buffer
  43. Will return a negative error code or the length of the read data.
  44. if length is not given or equal to '0' it will allocate memory buffer to
  45. contain the whole data client must release allocated memory passed by
  46. reference pointer 'data'
  47. */
  48. int read(uchar*& data, int length = 0, int index = 0);
  49. /*!
  50. Closes the file.
  51. */
  52. void close();
  53. /*!
  54. Returns data item size referred by index in DRM container
  55. */
  56. int size(int index = 0);
  57. /*!
  58. returns DRM container size or negative error value
  59. */
  60. int count();
  61. /*!
  62. allocates memory for data item name or NULL if error happens
  63. 'index' - data item index in the DRM container
  64. */
  65. QString getName(int index);
  66. protected:
  67. //data
  68. DRMFilePrivate* const d_ptr; //private implementation of the API
  69. };
  70. #endif // DRMFILE_H