Advertisement
dooly386

class template cpp

May 14th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.39 KB | None | 0 0
  1. #include <common/c_lua.h>
  2.  
  3. namespace codename6
  4. {
  5. c_difftime::c_difftime()
  6. {
  7. }
  8. c_difftime::c_difftime(const c_difftime &v) : super(v)
  9. {
  10. }
  11. void c_difftime::Assign(const void *v)
  12. {
  13.     super::Assign(v);
  14. }
  15. const char *c_difftime::ClassName() const
  16. {
  17.     return "c_difftime";
  18. }
  19. const void *c_difftime::Clone(uint64_t opt) const
  20. {
  21.     return new c_difftime(*this);
  22. }
  23. bool c_difftime::Inherited(const char *clsname) const
  24. {
  25.     if(strcmp(c_difftime::ClassName(),clsname)==0) return true;
  26.     return super::Inherited(clsname);
  27. }
  28.  
  29. uint64_t c_difftime::write(std::ostream &s) const
  30. {
  31.     uint64_t pos = s.tellp();
  32.     super::write(s);
  33.     return (uint64_t)s.tellp()-pos;
  34. }
  35. uint64_t c_difftime::read(std::istream &s)
  36. {
  37.     uint64_t pos = s.tellg();
  38.     super::read(s);
  39.     return (uint64_t)s.tellg()-pos;
  40.  
  41. }
  42.  
  43. int c_difftime::from_lua(void *LL,int idx)
  44. {
  45.     lua_State *L = (lua_State *)LL;
  46.     int ret = 0;
  47.     ret += super::from_lua(LL,idx+ret);
  48.     return ret;
  49. }
  50. int c_difftime::to_lua(void *LL)
  51. {
  52.     lua_State *L = (lua_State *)LL;
  53.     int ret = 0;
  54.     ret += super::to_lua(LL);
  55.     return ret;
  56. }
  57.  
  58. int c_difftime::on_lua_command_call(const char *cmd,void *LL)
  59. {
  60.     lua_State *L = (lua_State *)LL;
  61.     STR_SWITCH_BEGIN(cmd)
  62.  
  63.     CASE("c_difftime::Assign")
  64.     {
  65.         const void * v = (const void *)luaL_checkinteger(L,3);
  66.         c_difftime::Assign(v);
  67.         return 0;
  68.     }
  69.  
  70.     STR_SWITCH_END()
  71.     return super::on_lua_command_call(cmd,L);
  72. }
  73.  
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement