Exemplo n.º 1
0
 UserdataMetatable &addStaticFunction(const char *name, Fun f) {
   if (has_key(name)) {
     throw KaguyaException(std::string(name) + " is already registered.");
     return *this;
   }
   member_map_[name] = AnyDataPusher(kaguya::function(f));
   return *this;
 }
Exemplo n.º 2
0
 UserdataMetatable &addStaticField(const char *name, const Data &d) {
   if (has_key(name)) {
     throw KaguyaException(std::string(name) + " is already registered.");
     return *this;
   }
   member_map_[name] = AnyDataPusher(d);
   return *this;
 }
Exemplo n.º 3
0
 UserdataMetatable &addPropertyAny(const char *name, GetterType getter) {
   if (has_key(name)) {
     throw KaguyaException(std::string(name) + " is already registered.");
     return *this;
   }
   property_map_[name] = AnyDataPusher(function(getter));
   return *this;
 }
Exemplo n.º 4
0
 UserdataMetatable &addProperty(const char *name, Ret class_type::*mem) {
   if (has_key(name)) {
     throw KaguyaException(std::string(name) + " is already registered.");
     return *this;
   }
   property_map_[name] = AnyDataPusher(kaguya::function(mem));
   return *this;
 }
Exemplo n.º 5
0
 /// @brief assign function
 /// @param name name for lua
 /// @param f member function object.
 UserdataMetatable &addFunction(const char *name, PolymorphicMemberInvoker f) {
   if (has_key(name)) {
     throw KaguyaException(std::string(name) + " is already registered. To "
                                               "overload a function, use "
                                               "addOverloadedFunctions");
     return *this;
   }
   member_map_[name] = AnyDataPusher(kaguya::function(f));
   return *this;
 }
Exemplo n.º 6
0
  UserdataMetatable &addOverloadedFunctions(const char *name, Funcs... f) {
    if (has_key(name)) {
      throw KaguyaException(std::string(name) + " is already registered.");
      return *this;
    }

    member_map_[name] = AnyDataPusher(overload(f...));

    return *this;
  }
Exemplo n.º 7
0
 UserdataMetatable &addProperty(const char *name,
                                GetType (*getter)(const class_type &),
                                void (*setter)(class_type &, SetType)) {
   if (has_key(name)) {
     throw KaguyaException(std::string(name) + " is already registered.");
     return *this;
   }
   property_map_[name] = AnyDataPusher(overload(getter, setter));
   return *this;
 }
Exemplo n.º 8
0
		UserdataMetatable& addFunction(const char* name, Ret class_type::* f)
		{
			if (has_key(name))
			{
				throw KaguyaException(std::string(name) + " is already registered. To overload a function, use addOverloadedFunctions");
				return *this;
			}
			member_map_[name] = AnyDataPusher(kaguya::function(f));
			return *this;
		}