为便携式MVC编写C ++库 [英] Writing C++ libraries for portable MVC

查看:114
本文介绍了为便携式MVC编写C ++库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我正处于项目的概念阶段,该项目旨在分发到多个平台(主要是Windows和Linux / Mac)。通过阅读文献,我选择了MVC架构,模型是C ++库,视图/控制器是专门针对平台编码的。



从技术上讲, ,如果必须以尽可能便携的状态编码,你将如何完成模型部分?我已经考虑过动态库(部分原因在于模块化,部分原因在于它(至少对我而言)是与其他语言一起使用的明显选择),但是在每个平台下导出符号的不同接口意味着代码本身不再是可移植的。关于你们如何设计这个的任何指示?便携式库的标准是什么?



请温柔:)谢谢。

Hello,

I'm in the conceptual stages of a project which is intended to be distributed to several platforms (Windows and Linux/Mac primarily). Through reading through the literature I have opted for an MVC architecture, with the model being a C++ library and the view/controller being coded platform-specifically.

Technically, though, how would you accomplish the model part, given that it has to be coded in as portable a state as possible? I've contemplated dynamic libraries (partly due to the modularity, partly due to the fact that it's (for me at least) sort of an obvious choice for use with other languages), however the differing interfaces for exporting symbols under each platform means that the code in itself is not really portable any longer. Any pointers as to how you guys would design this? Any standards as far as portable libraries goes?

Please be gentle :) Thanks.

推荐答案

好,正如您已经考虑过的,没有办法(至少现在)创建一个轻量级的跨平台MVC库。在某种程度上,M和C是可能的。但从我的角度来看,需要编写抽象层以适应不同的平台。而且,b $ b,而MVC肯定不是设计模式,它的架构模式。从定义的角度来看,便携式似乎无关紧要。但是,MVC本身很简单,观察者的设计模式就足够了。需要考虑进一步的实现而不是模式本身。

感兴趣,你可能看看纯MVC一个开源项目。看起来有不同的语言绑定。 facade类非常有趣。
Well, As you have already considered, there is no way(at least now) to create a light weighted cross platform MVC lib. To some extent, M and C are possible. but View from my point of view, one need to write the abstraction layer to adapt to different platform.
moreover, MVC is certainly not the design pattern, it's architecture pattern. from the definition point of view, portable seems irrelevant. However, MVC itself is simple, observer design pattern is enough. one need to consider the further implementation rather than the pattern itself.
feel interested,you may have a look "Pure MVC" one opensource project.seems having different language binding. the facade class is quite interesting.


您可能希望在Internet上搜索与平台无关的GUI框架。 QT(链接到维基百科) [ ^ ]是这样一个框架,可能符合您的要求,也可能不符合您的要求。



请注意,DLL的概念根本不是关于可移植性的,而是关于可伸缩性和管理资源!此外,甚至在许多甚至大多数非Windows平台上都不支持这一概念。
You might want to internet-search for platform independent GUI frameworks. QT (link to wikipedia)[^] is such a framework which may or may not conform to your requirements.

Note that the concept of DLLs is not about portabilty at all, it's about scalability and managing resources! Moreover this concept isn't even supported on many or even most non-Windows platforms.


这篇关于为便携式MVC编写C ++库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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