本文整理汇总了C++中TITANIUM_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ TITANIUM_ASSERT函数的具体用法?C++ TITANIUM_ASSERT怎么用?C++ TITANIUM_ASSERT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TITANIUM_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TITANIUM_FUNCTION
TITANIUM_FUNCTION(TableView, insertRowBefore)
{
TITANIUM_LOG_WARN("TableView.insertRowBefore is not implemented yet");
if (arguments.size() < 3) {
return get_context().CreateUndefined();
} else if (arguments.size() >= 3) {
const auto _0 = arguments.at(0);
TITANIUM_ASSERT(_0.IsNumber());
const auto _1 = arguments.at(1);
TITANIUM_ASSERT(_1.IsObject());
const auto _2 = arguments.at(2);
//TITANIUM_ASSERT(_2.IsTableViewAnimationProperties());
const double index = static_cast<double>(_0);
const auto row = static_cast<JSObject>(_1);
const auto animation = static_cast<JSObject>(_2);
// insertRowBefore(index, row, animation);
} else if (arguments.size() >= 2) {
const auto _0 = arguments.at(0);
TITANIUM_ASSERT(_0.IsNumber());
const auto _1 = arguments.at(1);
TITANIUM_ASSERT(_1.IsObject());
const double index = static_cast<double>(_0);
const auto row = static_cast<JSObject>(_1);
// insertRowBefore(index, row);
} else if (arguments.size() >= 1) {
const auto _0 = arguments.at(0);
TITANIUM_ASSERT(_0.IsNumber());
const double index = static_cast<double>(_0);
// insertRowBefore(index);
}
return get_context().CreateUndefined();
}
示例2: TITANIUM_FUNCTION
TITANIUM_FUNCTION(ListView, scrollToItem)
{
const auto js_context = this_object.get_context();
if (arguments.size() >= 2) {
JSObject animation = js_context.CreateObject();
const auto _0 = arguments.at(0);
TITANIUM_ASSERT(_0.IsNumber());
const auto _1 = arguments.at(1);
TITANIUM_ASSERT(_1.IsNumber());
const auto sectionIndex = static_cast<uint32_t>(_0);
const auto itemIndex = static_cast<uint32_t>(_1);
if (arguments.size() >= 3) {
const auto _3 = arguments.at(2);
if (_3.IsObject()) {
animation = listviewAnimationProperties_ctor__.CallAsConstructor({_3});
}
}
scrollToItem(sectionIndex, itemIndex, animation.GetPrivate<ListViewAnimationProperties>());
}
return this_object.get_context().CreateUndefined();
}
示例3: get_context
void TableViewRow::ensureRowLabel()
{
if (title__ == nullptr) {
const auto Titanium_property = get_context().get_global_object().GetProperty("Titanium");
TITANIUM_ASSERT(Titanium_property.IsObject());
const auto Titanium = static_cast<JSObject>(Titanium_property);
const auto UI_property = Titanium.GetProperty("UI");
TITANIUM_ASSERT(UI_property.IsObject());
const auto UI = static_cast<JSObject>(UI_property);
const auto Label_property = UI.GetProperty("Label");
TITANIUM_ASSERT(Label_property.IsObject());
auto Label = static_cast<JSObject>(Label_property);
const auto label = Label.CallAsConstructor();
title__ = label.GetPrivate<TitaniumWindows::UI::Label>();
title__->set_text("");
title__->getViewLayoutDelegate()->set_left("0");
EnsureRowComponentWidth(title__->getViewLayoutDelegate<WindowsViewLayoutDelegate>()->getComponent());
add(label);
}
}
示例4: TITANIUM_FUNCTION
TITANIUM_FUNCTION(ListSection, replaceItemsAt)
{
const auto js_context = this_object.get_context();
if (arguments.size() >= 3) {
const auto _0 = arguments.at(0);
TITANIUM_ASSERT(_0.IsNumber());
const auto _1 = arguments.at(1);
TITANIUM_ASSERT(_1.IsNumber());
const auto _2 = arguments.at(2);
TITANIUM_ASSERT(_2.IsObject());
JSObject animation = js_context.CreateObject();
const auto index = static_cast<std::uint32_t>(_0);
const auto count = static_cast<std::uint32_t>(_1);
const auto dataItems = js_to_ListDataItem_array(static_cast<JSObject>(_2));
if (arguments.size() >= 4) {
const auto _3 = arguments.at(3);
if (_3.IsObject()) {
animation = listviewAnimationProperties_ctor__.CallAsConstructor({ _3 });
}
}
replaceItemsAt(index, count, dataItems, animation.GetPrivate<ListViewAnimationProperties>());
}
return get_context().CreateUndefined();
}
示例5: TITANIUM_FUNCTION
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;
}
示例6: TITANIUM_FUNCTION
TITANIUM_FUNCTION(View, setLocation)
{
TITANIUM_ASSERT(arguments.size() == 1);
auto _0 = arguments.at(0);
TITANIUM_ASSERT(_0.IsObject());
setLocation(js_to_MapLocationTypev2(static_cast<JSObject>(_0)));
return get_context().CreateUndefined();
}
示例7: TITANIUM_ASSERT
JSValue GlobalObject::requireBuiltinModule(const JSContext& js_context, const std::string& moduleId)
{
if (moduleId == "ti.map") {
JSValue Titanium_property = js_context.get_global_object().GetProperty("Titanium");
TITANIUM_ASSERT(Titanium_property.IsObject()); // precondition
JSObject Titanium = static_cast<JSObject>(Titanium_property);
JSValue Map_property = Titanium.GetProperty("Map");
TITANIUM_ASSERT(Map_property.IsObject()); // precondition
return Map_property;
}
return js_context.CreateUndefined();
}
示例8: TITANIUM_PROPERTY_SETTER
TITANIUM_PROPERTY_SETTER(Animation, transform)
{
TITANIUM_ASSERT(argument.IsObject());
const auto object = static_cast<JSObject>(argument);
set_transform(object.GetPrivate<Titanium::UI::TwoDMatrix>());
return true;
}
示例9: TITANIUM_PROPERTY_SETTER
TITANIUM_PROPERTY_SETTER(View, region)
{
TITANIUM_ASSERT(argument.IsObject());
const auto region = static_cast<JSObject>(argument);
set_region(js_to_MapRegionTypev2(region));
return true;
}
示例10: TITANIUM_FUNCTION
TITANIUM_FUNCTION(File, write)
{
const auto js_context = this_object.get_context();
if (arguments.size() < 1) {
return js_context.CreateUndefined();
}
const auto _0 = arguments.at(0);
const auto _1 = arguments.size() < 2 ? js_context.CreateBoolean(false) : arguments.at(1);
TITANIUM_ASSERT(_1.IsBoolean());
const auto append = static_cast<bool>(_1);
if (_0.IsString()) {
return js_context.CreateBoolean(write(static_cast<std::string>(arguments.at(0)), append));
} else if (_0.IsObject()) {
const auto js_object = static_cast<JSObject>(_0);
const auto blob = js_object.GetPrivate<Titanium::Blob>();
const auto file = js_object.GetPrivate<File>();
if (blob != nullptr) {
return js_context.CreateBoolean(write(blob, append));
} else if (file != nullptr) {
return js_context.CreateBoolean(write(file, append));
}
}
return js_context.CreateNull();
}
示例11: TITANIUM_FUNCTION
TITANIUM_FUNCTION(UIModule, create2DMatrix)
{
ENSURE_OPTIONAL_OBJECT_AT_INDEX(parameters, 0);
// FIXME Macros didn't work because identifiers can't start with digits!
JSValue Titanium_property = this_object.get_context().get_global_object().GetProperty("Titanium");
TITANIUM_ASSERT(Titanium_property.IsObject());
JSObject Titanium = static_cast<JSObject>(Titanium_property);
JSValue UI_property = Titanium.GetProperty("UI");
TITANIUM_ASSERT(UI_property.IsObject());
JSObject UI = static_cast<JSObject>(UI_property);
JSValue TwoDMatrix_property = UI.GetProperty("2DMatrix");
TITANIUM_ASSERT(TwoDMatrix_property.IsObject());
JSObject TwoDMatrix = static_cast<JSObject>(TwoDMatrix_property);
auto TwoDMatrix_obj = TwoDMatrix.CallAsConstructor(parameters);
Titanium::Module::applyProperties(parameters, TwoDMatrix_obj);
return TwoDMatrix_obj;
}
示例12: TITANIUM_FUNCTION
TITANIUM_FUNCTION(Module, removeEventListener)
{
ENSURE_STRING_AT_INDEX(name, 0);
ENSURE_OBJECT_AT_INDEX(callback, 1);
TITANIUM_ASSERT(callback.IsFunction());
removeEventListener(name, callback, this_object);
return get_context().CreateUndefined();
}
示例13: get_object
void ListSection::fireListSectionEvent(const std::string& event_name, const std::uint32_t& index, const std::uint32_t& itemCount, const std::uint32_t& affectedRows)
{
const auto js_listview = get_object().GetProperty("listview");
if (!js_listview.IsObject()) {
return;
}
const auto listview = static_cast<JSObject>(js_listview).GetPrivate<ListView>();
TITANIUM_ASSERT(listview);
listview->fireListSectionEvent(event_name, get_object().GetPrivate<ListSection>(), index, itemCount, affectedRows);
}
示例14: TITANIUM_ASSERT
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;
}
示例15: TITANIUM_PROPERTY_SETTER
TITANIUM_PROPERTY_SETTER(TableView, data)
{
TITANIUM_ASSERT(argument.IsObject());
auto data_obj = static_cast<JSObject>(argument);
TITANIUM_ASSERT(data_obj.IsArray());
auto data = static_cast<std::vector<JSValue>>(static_cast<JSArray>(data_obj));
auto animation = get_context().CreateObject();
std::vector<JSObject> tableObjects;
for (uint32_t i=0;i<data.size();i++) {
auto tableObject = static_cast<JSObject>(data[i]);
tableObjects.push_back(tableObject);
}
setData(tableObjects, animation.GetPrivate<TableViewAnimationProperties>());
return false;
}