LuaDataSource.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #pragma once
  2. #include <Rocket/Core/Lua/LuaType.h>
  3. #include <Rocket/Core/Lua/lua.hpp>
  4. #include <Rocket/Controls/DataSource.h>
  5. using Rocket::Controls::DataSource;
  6. namespace Rocket {
  7. namespace Core {
  8. namespace Lua {
  9. class LuaDataSource : public DataSource
  10. {
  11. public:
  12. //default initilialize the lua func references to -1
  13. LuaDataSource(const String& name = "");
  14. /// Fetches the contents of one row of a table within the data source.
  15. /// @param[out] row The list of values in the table.
  16. /// @param[in] table The name of the table to query.
  17. /// @param[in] row_index The index of the desired row.
  18. /// @param[in] columns The list of desired columns within the row.
  19. virtual void GetRow(Rocket::Core::StringList& row, const Rocket::Core::String& table, int row_index, const Rocket::Core::StringList& columns);
  20. /// Fetches the number of rows within one of this data source's tables.
  21. /// @param[in] table The name of the table to query.
  22. /// @return The number of rows within the specified table. Returns -1 in case of an incorrect Lua function.
  23. virtual int GetNumRows(const Rocket::Core::String& table);
  24. //make the protected members of DataSource public
  25. using DataSource::NotifyRowAdd;
  26. using DataSource::NotifyRowRemove;
  27. using DataSource::NotifyRowChange;
  28. //lua reference to DataSource.GetRow
  29. int getRowRef;
  30. //lua reference to DataSource.GetNumRows
  31. int getNumRowsRef;
  32. };
  33. }
  34. }
  35. }