语言混合:模型和视图 [英] Language Mixing: Model and View

查看:156
本文介绍了语言混合:模型和视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑开发一个应用程序,其中模型将用C ++编写(使用Boost),视图将使用Objective-C ++编写(使用Cocoa Touch)。

Consider developing an application where the model will be written in C++ (with Boost), and the view will be written in Objective-C++ (with Cocoa Touch).

推荐答案

从源代码直接执行的一些例子显示了如何集成C ++和Objective-C ++ :Apple有关于使用C ++的文档有关Objective- C

Take it straight from the source: Apple has documentation on using C++ With Objective-C.

除此之外,在我看来,试图保持C ++和Objective-C部分尽可能整洁。

There really isn't much more to it besides, in my opinion, trying to keep the C++ and Objective-C parts as cleanly seperated as possible.

在你的情况下它是自然的:

In your case it comes natural:


  • 限制C ++类的定义模型

  • 将Objective-C部分限制为视图相关代码并使用C ++模型

我不知道任何实际的简单例子,但任何跨平台项目,在Mac上有一个本机GUI使用相同的方法。一个最清洁的例子是 Chromium来源

I don't know of any actual simple examples, but any cross-platform project that has a native GUI on the mac uses the same approach. One mostly clean example would be the Chromium source.

这篇关于语言混合:模型和视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆