hello StartupCommand PureMVC cpp with CMake
hello StartupCommand PureMVC cpp with CMake
CMakeLists.txt
, main.cpp
和PureMVC sources
从execute() Startup SimpleCommand显示"Hello Startup"的最简单示例是什么?
PureMVC源代码在这里
理想的解决方案可以是链接到github项目。
你应该编译相应的dll和lib (Debug或Release [static|shared]),包括PureMVC文件。也许您可以从PureMVC::Patterns:: facade派生一个facade,覆盖基本的虚函数。因为它在c++和类java编程语言之间是不同的,重写的initializeController()不会在基类的构造函数中被调用!下面是一个派生示例:
class ApplicationFacade
: public virtual IFacade
, public Facade
{
friend class Facade;
public:
static const string STARTUP;
static const string EXIT;
protected:
ApplicationFacade(void)
: Facade(this, "ApplicationFacade")
{
initializeController();
}
public:
static ApplicationFacade& getInstance(void)
{
if (Facade::hasCore("ApplicationFacade"))
return *(dynamic_cast<ApplicationFacade*>(&Facade::getInstance("ApplicationFacade")));
return *(new ApplicationFacade());
}
protected:
virtual void initializeNotifier(string const& key)
{
Facade::initializeNotifier(key);
}
virtual void initializeFacade()
{
Facade::initializeFacade();
}
virtual void initializeController(void)
{
Facade::initializeController();
StartupCommand* startupCommand = new StartupCommand();
registerCommand(STARTUP, startupCommand);
ExitCommand* exitCommand = new ExitCommand();
registerCommand(EXIT, exitCommand);
}
~ApplicationFacade()
{
}
};
const string ApplicationFacade::STARTUP = "startup";
const string ApplicationFacade::EXIT = "exit";
StartupCommand和ExitCommand来源于PureMVC::Patterns::SimpleCommand然后在main.cpp中,你可以通过以下命令启动程序:
ApplicationFacade& facade = ApplicationFacade::getInstance();
facade.sendNotification(ApplicationFacade::STARTUP);
和退出:
facade.sendNotification(ApplicationFacade::EXIT);
相关文章:
- DLL Made with CMake 使程序崩溃
- VS2019 - Sudo Remote Debugging on Linux with Cmake project
- Cmake with Flex/Bison on windows
- OpenSSL with CMake - 未知选项: --sysroot 在构建 openSSL 时
- 解决方法:'can not be used when making a shared object; recompile with -fPIC'使用Cmake。使用普通的 g++ 工作
- 在Visual Studio中使用OpenMP with Clang和CMake
- Catch2 with CMake and Visual Studio
- libsqlite3.dylib link with CMake
- OpenMP 4.5 on Windows with Clang, CMake & Ninja
- Compile Eigen + Intel MKL with CMake
- CMake 64-bit with SFML 64-bit
- CMake trouble with Mingw
- LTO with LLVM and CMake
- 在 Windows 7 上安装 OpenCV 3.1.0 with CMake,opencv_ffmpeg.dll无效的
- CMake MacOS X bundle with BundleUtiliies for Qt application
- Qt WEBKIT with CMake
- Combining CMake option() with add_definitions()
- CMake with gmock
- hello StartupCommand PureMVC cpp with CMake
- CMake with cygwin " make[2]: *** No rule to make target 'cygwin' "