23 #include <boost/function.hpp>
24 #include <boost/shared_ptr.hpp>
25 #include <boost/variant/variant_fwd.hpp>
26 #include "fb_stdint.h"
27 #include "FBPointers.h"
43 FB_FORWARD_PTR(BrowserHost);
44 FB_FORWARD_PTR(JSAPI);
45 FB_FORWARD_PTR(JSObject);
47 namespace variant_detail {
147 #if defined(_MSC_VER)
148 # pragma deprecated(BrowserHostWrapper, BrowserObjectAPI, JSOutObject)
149 #elif defined(__GNUC__)
168 template<
class T,
class U>
169 boost::shared_ptr<T>
ptr_cast(boost::shared_ptr<U>
const & r);
214 typedef FB::variant_detail::empty FBVoid;
215 typedef FB::variant_detail::null FBNull;
216 struct FBDateString {
219 FBDateString(
const FBDateString& rhs) : date(rhs.date) { }
220 FBDateString(
const std::string &dstr) : date(dstr) { }
222 FBDateString& operator=(
const std::string& dstr) { date = dstr;
return *
this; }
223 std::string getValue() {
return date; }
224 void setValue(std::string value) { date = value; }
225 bool operator<(
const std::string& rh)
const
229 bool operator<(
const FBDateString& rh)
const
231 return date < rh.date;
279 SecurityScope_Public = 0,
280 SecurityScope_Protected = 2,
281 SecurityScope_Private = 4,
282 SecurityScope_Local = 6
287 struct MethodFunctors
291 MethodFunctors() : call() {}
294 MethodFunctors(
const MethodFunctors& m) : call(m.call) {}
295 MethodFunctors& operator=(
const MethodFunctors& rhs) {
317 :
get(
get), set(set) {}
319 :
get(p.get), set(p.set) {}
331 typedef std::pair<std::string, FB::JSObjectPtr> EventPair;
332 typedef std::multimap<std::string, FB::JSObjectPtr> EventMultiMap;
333 typedef std::map<void*, FB::JSObjectPtr> EventIFaceMap;
334 typedef std::map<std::string, FB::JSObjectPtr> EventSingleMap;
338 template<
class T,
class U>
339 boost::shared_ptr<T>
ptr_cast(boost::shared_ptr<U>
const & r)
341 return boost::dynamic_pointer_cast<T>(r);
344 namespace boost_variant {
345 typedef boost::variant<long, int, double, std::string, FB::JSAPIPtr, FB::JSObjectPtr, FB::FBNull, FB::FBVoid> fb_compat;
346 typedef boost::variant<long, int, double, float, std::string, FB::FBNull, FB::FBVoid> primitives;
347 typedef boost::variant<std::string, FB::StringSet> strings;
boost::function< variant(const std::vector< variant > &)> CallMethodFunctor
Defines an alias representing a method functor used by FB::JSAPIAuto, created by FB::make_method().
variant(JSAPI::* InvokeType)(const std::string &, const std::vector< variant > &)
Defines an alias representing a function pointer to JSAPI::Invoke.
boost::function< FB::variant()> GetPropFunctor
Defines an alias representing a property getter functor used by FB::JSAPIAuto.
boost::shared_ptr< FB::JSObject > JSObjectPtr
Defines an alias representing a JSObject shared_ptr (you should never use a JSObject* directly) ...
boost::function< void(const FB::variant &)> SetPropFunctor
Defines an alias representing a property setter functor used by FB::JSAPIAuto.
Used by FB::JSAPISimple to store information about a property.
Used by FB::JSAPISimple to store information about a method.
Wraps a Javascript Object.
JSAPIPtr JSOutObject
Defines an alias for JSOutObject -> JSAPIPtr.
JSObject BrowserObjectAPI
Defines a alias for backwards compatibility.
Accepts any datatype, used in all interactions with javascript. Provides tools for getting back out t...
variant(JSAPI::* GetPropertyType)(const std::string &)
Defines an alias representing a function pointer to JSAPI::GetProperty.
variant(JSAPI::* CallMethodPtr)(const std::vector< variant > &)
Defines an alias representing a function ptr for a method on a FB::JSAPISimple object.
boost::shared_ptr< T > ptr_cast(boost::shared_ptr< U > const &r)
Convenience function for doing a dynamic cast of one boost::shared_ptr to another.
std::vector< variant > VariantList
Defines an alias representing list of variants.
boost::weak_ptr< FB::JSAPI > JSAPIWeakPtr
Defines an alias for a JSAPI weak_ptr (you should never use a JSAPI* directly)
variant(JSAPI::* ConstructType)(const std::vector< variant > &)
Defines an alias representing a function pointer to JSAPI::Invoke.
std::set< std::string > StringSet
Defines an alias representing a set of std::strings.
boost::weak_ptr< FB::JSObject > JSObjectWeakPtr
Defines an alias representing a JSObject weak_ptr (you should never use a JSObject* directly) ...
int SecurityZone
Used to set a SecurityZone for a method or property – used by JSAPIAuto.
void(JSAPI::* SetPropPtr)(const variant &value)
Defines an alias representing a function pointer for a property setter on a FB::JSAPISimple object...
boost::shared_ptr< FB::JSAPI > JSAPIPtr
Defines an alias for a JSAPI shared_ptr (you should never use a JSAPI* directly)
std::map< std::string, PropertyFunctors > PropertyFunctorsMap
Defines an alias representing a map of property functors used by FB::JSAPIAuto.
void(JSAPI::* RemovePropertyType)(const std::string &)
Defines an alias representing a function pointer to JSAPI::GetProperty.
BrowserHost BrowserHostWrapper
Defines a alias for backwards compatibility.
variant(JSAPI::* GetPropPtr)()
Defines an alias representing a function pointer for a property getter on a FB::JSAPISimple object...
boost::shared_ptr< FB::BrowserHost > BrowserHostPtr
Defines an alias representing a BrowserHost shared_ptr (you should never use a BrowserHost* directly)...
SecurityLevel
Default SecurityZone values; you can use these or provide your own.
When used as a parameter on a JSAPIAuto function this matches 0 or more variants – in other words...
std::map< std::string, MethodInfo > MethodMap
Defines an alias representing a map of methods used by FB::JSAPISimple.
used by FB::JSAPIAuto to store property implementation details, created by FB::make_property().
std::map< std::string, PropertyInfo > PropertyMap
Defines an alias representing a map of properties used by FB::JSAPISimple.
std::map< std::string, variant > VariantMap
Defines an alias representing a string -> variant map.
std::map< std::string, MethodFunctors > MethodFunctorMap
Defines an alias representing a map of method functors used by FB::JSAPIAuto.
void(JSAPI::* SetPropertyType)(const std::string &, const variant &)
Defines an alias representing a function pointer to JSAPI::SetProperty.
JavaScript API class – provides a javascript interface that can be exposed to the browser...