Data.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /**
  2. * Copyright (c) 2006-2023 LOVE Development Team
  3. *
  4. * This software is provided 'as-is', without any express or implied
  5. * warranty. In no event will the authors be held liable for any damages
  6. * arising from the use of this software.
  7. *
  8. * Permission is granted to anyone to use this software for any purpose,
  9. * including commercial applications, and to alter it and redistribute it
  10. * freely, subject to the following restrictions:
  11. *
  12. * 1. The origin of this software must not be misrepresented; you must not
  13. * claim that you wrote the original software. If you use this software
  14. * in a product, an acknowledgment in the product documentation would be
  15. * appreciated but is not required.
  16. * 2. Altered source versions must be plainly marked as such, and must not be
  17. * misrepresented as being the original software.
  18. * 3. This notice may not be removed or altered from any source distribution.
  19. **/
  20. #ifndef LOVE_DATA_H
  21. #define LOVE_DATA_H
  22. // LOVE
  23. #include "config.h"
  24. #include "Object.h"
  25. // C
  26. #include <stddef.h>
  27. namespace love
  28. {
  29. /**
  30. * This class is a simple abstraction over all objects which contain data.
  31. **/
  32. class Data : public Object
  33. {
  34. public:
  35. static love::Type type;
  36. /**
  37. * Destructor.
  38. **/
  39. virtual ~Data() {}
  40. /**
  41. * Creates a duplicate of Data derived class instance.
  42. **/
  43. virtual Data *clone() const = 0;
  44. /**
  45. * Gets a pointer to the data. This pointer will obviously not
  46. * be valid if the Data object is destroyed.
  47. **/
  48. virtual void *getData() const = 0;
  49. /**
  50. * Gets the size of the Data in bytes.
  51. **/
  52. virtual size_t getSize() const = 0;
  53. }; // Data
  54. } // love
  55. #endif // LOVE_DATA_H