TITANIUM_FUNCTION(CoreDispatcher, RunIdleAsync) { auto context = get_context(); if (arguments.size() == 1) { auto _0 = arguments.at(0); TITANIUM_ASSERT_AND_THROW(_0.IsObject(), "Expected Object"); auto object_agileCallback = static_cast<JSObject>(_0); auto wrapper_agileCallback = object_agileCallback.GetPrivate<Windows::UI::Core::IdleDispatchedHandler>(); // FIXME What if the type we want here is some parent class of the actual wrapper's class? I think we'll get nullptr here. // We need some way to know the underlying type the JSObject maps to, get that, then cast to the type we want... auto agileCallback = wrapper_agileCallback->unwrapWindows_UI_Core_IdleDispatchedHandler(); auto method_result = unwrap()->RunIdleAsync(agileCallback); auto result = context.CreateObject(JSExport<Windows::Foundation::IAsyncAction>::Class()); auto result_wrapper = result.GetPrivate<Windows::Foundation::IAsyncAction>(); result_wrapper->wrap(method_result); return result; } // Catch-all if no arg count matches! TITANIUM_LOG_DEBUG("No method signature matched CoreDispatcher::RunIdleAsync with # of args: ", arguments.size()); return context.CreateUndefined(); }
TITANIUM_FUNCTION(Canvas, SetZIndex) { auto context = get_context(); if (arguments.size() == 2) { auto _0 = arguments.at(0); TITANIUM_ASSERT_AND_THROW(_0.IsObject(), "Expected Object"); auto object_element = static_cast<JSObject>(_0); auto wrapper_element = object_element.GetPrivate<Windows::UI::Xaml::UIElement>(); // FIXME What if the type we want here is some parent class of the actual wrapper's class? I think we'll get nullptr here. // We need some way to know the underlying type the JSObject maps to, get that, then cast to the type we want... auto element = wrapper_element->unwrapWindows_UI_Xaml_UIElement(); auto _1 = arguments.at(1); TITANIUM_ASSERT_AND_THROW(_1.IsNumber(), "Expected Number"); auto value = static_cast<int32_t>(_1); ::Windows::UI::Xaml::Controls::Canvas::SetZIndex(element, value); return context.CreateUndefined(); } // Catch-all if no arg count matches! TITANIUM_LOG_DEBUG("No method signature matched Canvas::SetZIndex with # of args: ", arguments.size()); return context.CreateUndefined(); }
TITANIUM_FUNCTION(CoreDispatcher, ShouldYield) { auto context = get_context(); if (arguments.size() == 1) { auto _0 = arguments.at(0); TITANIUM_ASSERT_AND_THROW(_0.IsNumber(), "Expected Number"); auto priority = static_cast<::Windows::UI::Core::CoreDispatcherPriority>(static_cast<int32_t>(_0)); // TODO Look up enum in metadata to know what type it's value is? auto method_result = unwrap()->ShouldYield(priority); auto result = context.CreateBoolean(method_result); return result; } if (arguments.size() == 0) { auto method_result = unwrap()->ShouldYield(); auto result = context.CreateBoolean(method_result); return result; } // Catch-all if no arg count matches! TITANIUM_LOG_DEBUG("No method signature matched CoreDispatcher::ShouldYield with # of args: ", arguments.size()); return context.CreateUndefined(); }
TITANIUM_FUNCTION(DependencyObject, GetAnimationBaseValue) { auto context = get_context(); if (arguments.size() == 1) { auto _0 = arguments.at(0); TITANIUM_ASSERT_AND_THROW(_0.IsObject(), "Expected Object"); auto object_dp = static_cast<JSObject>(_0); auto wrapper_dp = object_dp.GetPrivate<Windows::UI::Xaml::DependencyProperty>(); // FIXME What if the type we want here is some parent class of the actual wrapper's class? I think we'll get nullptr here. // We need some way to know the underlying type the JSObject maps to, get that, then cast to the type we want... auto dp = wrapper_dp->unwrapWindows_UI_Xaml_DependencyProperty(); auto method_result = unwrap()->GetAnimationBaseValue(dp); auto result = context.CreateObject(JSExport<Platform::Object>::Class()); auto result_wrapper = result.GetPrivate<Platform::Object>(); result_wrapper->wrap(method_result); return result; } // Catch-all if no arg count matches! TITANIUM_LOG_DEBUG("No method signature matched DependencyObject::GetAnimationBaseValue with # of args: ", arguments.size()); return context.CreateUndefined(); }
TITANIUM_FUNCTION(SocketModule, createUDP) { TITANIUM_LOG_DEBUG("SocketModule::createUDP: "); ENSURE_OPTIONAL_OBJECT_AT_INDEX(parameters, 0); JSValue Titanium_property = get_context().get_global_object().GetProperty("Titanium"); TITANIUM_ASSERT(Titanium_property.IsObject()); // precondition JSObject Titanium = static_cast<JSObject>(Titanium_property); JSValue Network_property = Titanium.GetProperty("Network"); TITANIUM_ASSERT(Network_property.IsObject()); // precondition JSObject Network = static_cast<JSObject>(Network_property); JSValue Socket_property = Network.GetProperty("Socket"); TITANIUM_ASSERT(Socket_property.IsObject()); // precondition JSObject Socket = static_cast<JSObject>(Socket_property); JSValue UDP_property = Socket.GetProperty("UDP"); TITANIUM_ASSERT(UDP_property.IsObject()); // precondition JSObject UDP = static_cast<JSObject>(UDP_property); auto udp = UDP.CallAsConstructor(); applyProperties(parameters, udp); return udp; }
std::string NativeGlobalObjectExample::readRequiredModule(const JSObject& parent, const std::string& path) const { TITANIUM_LOG_DEBUG("GlobalObjectDelegateExample::loadRequiredModule for ", path); if (require_resource__.find(path) == require_resource__.end()) { return ""; } return require_resource__.at(path); }
void ListSection::setViewForSectionItem(const std::uint32_t& itemIndex, const std::shared_ptr<View>& view) { TITANIUM_ASSERT(items__.size() > itemIndex); TITANIUM_LOG_DEBUG("ListSectin::setViewForSectionItem at ", itemIndex, " ", view.get(), " for ", this); auto item = items__.at(itemIndex); item.view = view; items__.at(itemIndex) = item; }
TITANIUM_FUNCTION(CoreDispatcher, StopProcessEvents) { auto context = get_context(); if (arguments.size() == 0) { unwrap()->StopProcessEvents(); return context.CreateUndefined(); } // Catch-all if no arg count matches! TITANIUM_LOG_DEBUG("No method signature matched CoreDispatcher::StopProcessEvents with # of args: ", arguments.size()); return context.CreateUndefined(); }
TITANIUM_FUNCTION(CoreDispatcher, ProcessEvents) { auto context = get_context(); if (arguments.size() == 1) { auto _0 = arguments.at(0); TITANIUM_ASSERT_AND_THROW(_0.IsNumber(), "Expected Number"); auto options = static_cast<::Windows::UI::Core::CoreProcessEventsOption>(static_cast<int32_t>(_0)); // TODO Look up enum in metadata to know what type it's value is? unwrap()->ProcessEvents(options); return context.CreateUndefined(); } // Catch-all if no arg count matches! TITANIUM_LOG_DEBUG("No method signature matched CoreDispatcher::ProcessEvents with # of args: ", arguments.size()); return context.CreateUndefined(); }
TITANIUM_FUNCTION(PropertyMetadata, Create) { auto context = get_context(); if (arguments.size() == 2) { auto _0 = arguments.at(0); TITANIUM_ASSERT_AND_THROW(_0.IsObject(), "Expected Object"); auto object_createDefaultValueCallback = static_cast<JSObject>(_0); auto wrapper_createDefaultValueCallback = object_createDefaultValueCallback.GetPrivate<Windows::UI::Xaml::CreateDefaultValueCallback>(); // FIXME What if the type we want here is some parent class of the actual wrapper's class? I think we'll get nullptr here. // We need some way to know the underlying type the JSObject maps to, get that, then cast to the type we want... auto createDefaultValueCallback = wrapper_createDefaultValueCallback->unwrapWindows_UI_Xaml_CreateDefaultValueCallback(); auto _1 = arguments.at(1); TITANIUM_ASSERT_AND_THROW(_1.IsObject(), "Expected Object"); auto object_propertyChangedCallback = static_cast<JSObject>(_1); auto wrapper_propertyChangedCallback = object_propertyChangedCallback.GetPrivate<Windows::UI::Xaml::PropertyChangedCallback>(); // FIXME What if the type we want here is some parent class of the actual wrapper's class? I think we'll get nullptr here. // We need some way to know the underlying type the JSObject maps to, get that, then cast to the type we want... auto propertyChangedCallback = wrapper_propertyChangedCallback->unwrapWindows_UI_Xaml_PropertyChangedCallback(); auto method_result = ::Windows::UI::Xaml::PropertyMetadata::Create(createDefaultValueCallback, propertyChangedCallback); auto result = context.CreateObject(JSExport<Windows::UI::Xaml::PropertyMetadata>::Class()); auto result_wrapper = result.GetPrivate<Windows::UI::Xaml::PropertyMetadata>(); result_wrapper->wrap(method_result); return result; } if (arguments.size() == 1) { auto _0 = arguments.at(0); TITANIUM_ASSERT_AND_THROW(_0.IsObject(), "Expected Object"); auto object_createDefaultValueCallback = static_cast<JSObject>(_0); auto wrapper_createDefaultValueCallback = object_createDefaultValueCallback.GetPrivate<Windows::UI::Xaml::CreateDefaultValueCallback>(); // FIXME What if the type we want here is some parent class of the actual wrapper's class? I think we'll get nullptr here. // We need some way to know the underlying type the JSObject maps to, get that, then cast to the type we want... auto createDefaultValueCallback = wrapper_createDefaultValueCallback->unwrapWindows_UI_Xaml_CreateDefaultValueCallback(); auto method_result = ::Windows::UI::Xaml::PropertyMetadata::Create(createDefaultValueCallback); auto result = context.CreateObject(JSExport<Windows::UI::Xaml::PropertyMetadata>::Class()); auto result_wrapper = result.GetPrivate<Windows::UI::Xaml::PropertyMetadata>(); result_wrapper->wrap(method_result); return result; } if (arguments.size() == 2) { auto _0 = arguments.at(0); TITANIUM_ASSERT_AND_THROW(_0.IsObject(), "Expected Object"); auto object_defaultValue = static_cast<JSObject>(_0); auto wrapper_defaultValue = object_defaultValue.GetPrivate<Platform::Object>(); // FIXME What if the type we want here is some parent class of the actual wrapper's class? I think we'll get nullptr here. // We need some way to know the underlying type the JSObject maps to, get that, then cast to the type we want... auto defaultValue = wrapper_defaultValue->unwrapPlatform_Object(); auto _1 = arguments.at(1); TITANIUM_ASSERT_AND_THROW(_1.IsObject(), "Expected Object"); auto object_propertyChangedCallback = static_cast<JSObject>(_1); auto wrapper_propertyChangedCallback = object_propertyChangedCallback.GetPrivate<Windows::UI::Xaml::PropertyChangedCallback>(); // FIXME What if the type we want here is some parent class of the actual wrapper's class? I think we'll get nullptr here. // We need some way to know the underlying type the JSObject maps to, get that, then cast to the type we want... auto propertyChangedCallback = wrapper_propertyChangedCallback->unwrapWindows_UI_Xaml_PropertyChangedCallback(); auto method_result = ::Windows::UI::Xaml::PropertyMetadata::Create(defaultValue, propertyChangedCallback); auto result = context.CreateObject(JSExport<Windows::UI::Xaml::PropertyMetadata>::Class()); auto result_wrapper = result.GetPrivate<Windows::UI::Xaml::PropertyMetadata>(); result_wrapper->wrap(method_result); return result; } if (arguments.size() == 1) { auto _0 = arguments.at(0); TITANIUM_ASSERT_AND_THROW(_0.IsObject(), "Expected Object"); auto object_defaultValue = static_cast<JSObject>(_0); auto wrapper_defaultValue = object_defaultValue.GetPrivate<Platform::Object>(); // FIXME What if the type we want here is some parent class of the actual wrapper's class? I think we'll get nullptr here. // We need some way to know the underlying type the JSObject maps to, get that, then cast to the type we want... auto defaultValue = wrapper_defaultValue->unwrapPlatform_Object(); auto method_result = ::Windows::UI::Xaml::PropertyMetadata::Create(defaultValue); auto result = context.CreateObject(JSExport<Windows::UI::Xaml::PropertyMetadata>::Class()); auto result_wrapper = result.GetPrivate<Windows::UI::Xaml::PropertyMetadata>(); result_wrapper->wrap(method_result); return result; } // Catch-all if no arg count matches! TITANIUM_LOG_DEBUG("No method signature matched PropertyMetadata::Create with # of args: ", arguments.size()); return context.CreateUndefined(); }
GlobalObject::Timer::Timer(Callback_t callback, const std::chrono::milliseconds& interval) : interval__(interval) { TITANIUM_LOG_DEBUG("GlobalObject::Timer: interval = ", interval.count(), "ms"); }
ListSection::~ListSection() { TITANIUM_LOG_DEBUG("ListSection:: dtor ", this); }
TITANIUM_FUNCTION(DependencyProperty, RegisterAttached) { auto context = get_context(); if (arguments.size() == 4) { auto _0 = arguments.at(0); TITANIUM_ASSERT_AND_THROW(_0.IsString(), "Expected String"); auto name = TitaniumWindows::Utility::ConvertUTF8String(static_cast<std::string>(_0)); auto _1 = arguments.at(1); TITANIUM_ASSERT_AND_THROW(_1.IsObject(), "Expected Object"); auto object_propertyType = static_cast<JSObject>(_1); ::Windows::UI::Xaml::Interop::TypeName propertyType; // Assign fields explicitly since we didn't use a constructor auto object_propertyType_Name = object_propertyType.GetProperty("Name"); TITANIUM_ASSERT_AND_THROW(object_propertyType_Name.IsString(), "Expected String"); auto object_propertyType_Name_ = TitaniumWindows::Utility::ConvertUTF8String(static_cast<std::string>(object_propertyType_Name)); propertyType.Name = object_propertyType_Name_; auto object_propertyType_Kind = object_propertyType.GetProperty("Kind"); TITANIUM_ASSERT_AND_THROW(object_propertyType_Kind.IsNumber(), "Expected Number"); auto object_propertyType_Kind_ = static_cast<::Windows::UI::Xaml::Interop::TypeKind>(static_cast<int32_t>(object_propertyType_Kind)); // TODO Look up enum in metadata to know what type it's value is? propertyType.Kind = object_propertyType_Kind_; auto _2 = arguments.at(2); TITANIUM_ASSERT_AND_THROW(_2.IsObject(), "Expected Object"); auto object_ownerType = static_cast<JSObject>(_2); ::Windows::UI::Xaml::Interop::TypeName ownerType; // Assign fields explicitly since we didn't use a constructor auto object_ownerType_Name = object_ownerType.GetProperty("Name"); TITANIUM_ASSERT_AND_THROW(object_ownerType_Name.IsString(), "Expected String"); auto object_ownerType_Name_ = TitaniumWindows::Utility::ConvertUTF8String(static_cast<std::string>(object_ownerType_Name)); ownerType.Name = object_ownerType_Name_; auto object_ownerType_Kind = object_ownerType.GetProperty("Kind"); TITANIUM_ASSERT_AND_THROW(object_ownerType_Kind.IsNumber(), "Expected Number"); auto object_ownerType_Kind_ = static_cast<::Windows::UI::Xaml::Interop::TypeKind>(static_cast<int32_t>(object_ownerType_Kind)); // TODO Look up enum in metadata to know what type it's value is? ownerType.Kind = object_ownerType_Kind_; auto _3 = arguments.at(3); TITANIUM_ASSERT_AND_THROW(_3.IsObject(), "Expected Object"); auto object_defaultMetadata = static_cast<JSObject>(_3); auto wrapper_defaultMetadata = object_defaultMetadata.GetPrivate<Windows::UI::Xaml::PropertyMetadata>(); // FIXME What if the type we want here is some parent class of the actual wrapper's class? I think we'll get nullptr here. // We need some way to know the underlying type the JSObject maps to, get that, then cast to the type we want... auto defaultMetadata = wrapper_defaultMetadata->unwrapWindows_UI_Xaml_PropertyMetadata(); auto method_result = ::Windows::UI::Xaml::DependencyProperty::RegisterAttached(name, propertyType, ownerType, defaultMetadata); auto result = context.CreateObject(JSExport<Windows::UI::Xaml::DependencyProperty>::Class()); auto result_wrapper = result.GetPrivate<Windows::UI::Xaml::DependencyProperty>(); result_wrapper->wrap(method_result); return result; } // Catch-all if no arg count matches! TITANIUM_LOG_DEBUG("No method signature matched DependencyProperty::RegisterAttached with # of args: ", arguments.size()); return context.CreateUndefined(); }
TITANIUM_FUNCTION(GeneralTransform, TransformBounds) { auto context = get_context(); if (arguments.size() == 1) { auto _0 = arguments.at(0); TITANIUM_ASSERT_AND_THROW(_0.IsObject(), "Expected Object"); auto object_rect = static_cast<JSObject>(_0); ::Windows::Foundation::Rect rect; // Assign fields explicitly since we didn't use a constructor auto object_rect_X = object_rect.GetProperty("X"); TITANIUM_ASSERT_AND_THROW(object_rect_X.IsNumber(), "Expected Number"); auto object_rect_X_ = static_cast<float>(static_cast<double>(object_rect_X)); rect.X = object_rect_X_; auto object_rect_Y = object_rect.GetProperty("Y"); TITANIUM_ASSERT_AND_THROW(object_rect_Y.IsNumber(), "Expected Number"); auto object_rect_Y_ = static_cast<float>(static_cast<double>(object_rect_Y)); rect.Y = object_rect_Y_; auto object_rect_Width = object_rect.GetProperty("Width"); TITANIUM_ASSERT_AND_THROW(object_rect_Width.IsNumber(), "Expected Number"); auto object_rect_Width_ = static_cast<float>(static_cast<double>(object_rect_Width)); rect.Width = object_rect_Width_; auto object_rect_Height = object_rect.GetProperty("Height"); TITANIUM_ASSERT_AND_THROW(object_rect_Height.IsNumber(), "Expected Number"); auto object_rect_Height_ = static_cast<float>(static_cast<double>(object_rect_Height)); rect.Height = object_rect_Height_; auto method_result = unwrap()->TransformBounds(rect); auto result = context.CreateObject(); auto method_result_X_ = context.CreateNumber(static_cast<double>(method_result.X)); result.SetProperty("X", method_result_X_); auto method_result_Y_ = context.CreateNumber(static_cast<double>(method_result.Y)); result.SetProperty("Y", method_result_Y_); auto method_result_Width_ = context.CreateNumber(static_cast<double>(method_result.Width)); result.SetProperty("Width", method_result_Width_); auto method_result_Height_ = context.CreateNumber(static_cast<double>(method_result.Height)); result.SetProperty("Height", method_result_Height_); return result; } // Catch-all if no arg count matches! TITANIUM_LOG_DEBUG("No method signature matched GeneralTransform::TransformBounds with # of args: ", arguments.size()); return context.CreateUndefined(); }
TITANIUM_FUNCTION(GeneralTransform, TryTransform) { auto context = get_context(); if (arguments.size() == 2) { auto _0 = arguments.at(0); TITANIUM_ASSERT_AND_THROW(_0.IsObject(), "Expected Object"); auto object_inPoint = static_cast<JSObject>(_0); ::Windows::Foundation::Point inPoint; // Assign fields explicitly since we didn't use a constructor auto object_inPoint_X = object_inPoint.GetProperty("X"); TITANIUM_ASSERT_AND_THROW(object_inPoint_X.IsNumber(), "Expected Number"); auto object_inPoint_X_ = static_cast<float>(static_cast<double>(object_inPoint_X)); inPoint.X = object_inPoint_X_; auto object_inPoint_Y = object_inPoint.GetProperty("Y"); TITANIUM_ASSERT_AND_THROW(object_inPoint_Y.IsNumber(), "Expected Number"); auto object_inPoint_Y_ = static_cast<float>(static_cast<double>(object_inPoint_Y)); inPoint.Y = object_inPoint_Y_; auto _1 = arguments.at(1); TITANIUM_ASSERT_AND_THROW(_1.IsObject(), "Expected Object"); auto object_outPoint = static_cast<JSObject>(_1); ::Windows::Foundation::Point outPoint; // Assign fields explicitly since we didn't use a constructor auto object_outPoint_X = object_outPoint.GetProperty("X"); TITANIUM_ASSERT_AND_THROW(object_outPoint_X.IsNumber(), "Expected Number"); auto object_outPoint_X_ = static_cast<float>(static_cast<double>(object_outPoint_X)); outPoint.X = object_outPoint_X_; auto object_outPoint_Y = object_outPoint.GetProperty("Y"); TITANIUM_ASSERT_AND_THROW(object_outPoint_Y.IsNumber(), "Expected Number"); auto object_outPoint_Y_ = static_cast<float>(static_cast<double>(object_outPoint_Y)); outPoint.Y = object_outPoint_Y_; auto method_result = unwrap()->TryTransform(inPoint, &outPoint); auto result = context.CreateBoolean(method_result); auto out_1 = context.CreateObject(); auto outPoint_X_ = context.CreateNumber(static_cast<double>(outPoint.X)); out_1.SetProperty("X", outPoint_X_); auto outPoint_Y_ = context.CreateNumber(static_cast<double>(outPoint.Y)); out_1.SetProperty("Y", outPoint_Y_); _1 = out_1; return result; } // Catch-all if no arg count matches! TITANIUM_LOG_DEBUG("No method signature matched GeneralTransform::TryTransform with # of args: ", arguments.size()); return context.CreateUndefined(); }