LuaDataSource.h 1.5 KB

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