DataSource.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #pragma once
  2. /*
  3. This defines the DataSource type in the Lua global namespace
  4. //methods
  5. noreturn DataSource:NotifyRowAdd(string tablename, int firstadded, int numadded)
  6. noreturn DataSource:NotifyRemove(string tablename, int firstremoved, int numremoved)
  7. noreturn DataSource:NotifyRowChange(string tablename, int firstchanged, int numchanged)
  8. noreturn DataSource:NotifyRowChange(string tablename) --the same as above, but for all rows
  9. when you get an instance of this, you MUST set two functions:
  10. DataSource.GetNumRows = function(tablename) ....... end --returns an int
  11. DataSource.GetRow = function(tablename,index,columns) ......end
  12. --where columns is a numerically indexed table of strings, and the function needs to
  13. --return a table of numerically indexed strings
  14. */
  15. #include <Rocket/Core/Lua/LuaType.h>
  16. #include <Rocket/Core/Lua/lua.hpp>
  17. #include "LuaDataSource.h"
  18. namespace Rocket {
  19. namespace Core {
  20. namespace Lua {
  21. typedef LuaDataSource DataSource;
  22. int DataSourceNotifyRowAdd(lua_State* L, DataSource* obj);
  23. int DataSourceNotifyRowRemove(lua_State* L, DataSource* obj);
  24. int DataSourceNotifyRowChange(lua_State* L, DataSource* obj);
  25. int DataSourceSetAttrGetNumRows(lua_State* L);
  26. int DataSourceSetAttrGetRow(lua_State* L);
  27. RegType<DataSource> DataSourceMethods[];
  28. luaL_reg DataSourceGetters[];
  29. luaL_reg DataSourceSetters[];
  30. }
  31. }
  32. }