/* Copyright 2003-2005 ROBLOX Corporation, All Rights Reserved */ #pragma once #include "v8tree/Instance.h" namespace RBX { // Summary: A simple class that exposes a configurable function. // Usage: It allows scripts to expose their functions extern const char* const sBindableFunction; class BindableFunction : public DescribedCreatable { struct Invocation { shared_ptr arguments; boost::function)> resumeFunction; boost::function errorFunction; }; typedef std::queue Queue; Queue queue; public: BindableFunction():DescribedCreatable("Function") {} void invoke(shared_ptr arguments, boost::function)> resumeFunction, boost::function errorFunction); typedef boost::function, boost::function)>, boost::function)> OnInvokeCallback; OnInvokeCallback onInvoke; void processQueue(const OnInvokeCallback& oldValue); /*override*/ bool askSetParent(const Instance* instance) const; }; #if 0 // Summary: A simple class that exposes a property // Usage: It allows scripts to expose their properties extern const char* const sPropertyInstance; class PropertyInstance : public DescribedCreatable { public: PropertyInstance():DescribedCreatable("Property") {} rbx::signal valueChanged; boost::function getCallback; boost::function setCallback; Reflection::Variant getValue(); void setValue(const Reflection::Variant& value); void fireValueChanged(); }; #endif // Summary: A simple class that exposes a fire-able event. // Usage: It allows scripts to expose their events extern const char* const sBindableEvent; class BindableEvent : public DescribedCreatable { public: BindableEvent():DescribedCreatable("Event") {} rbx::signal)> event; void fire(shared_ptr arguments); /*override*/ bool askSetParent(const Instance* instance) const; }; } // namespace RBX