diff --git a/DesignPatterns.pro b/DesignPatterns.pro new file mode 100644 index 0000000..3613175 --- /dev/null +++ b/DesignPatterns.pro @@ -0,0 +1,61 @@ +QT += core +QT -= gui + +CONFIG += c++11 + +TARGET = DesignPatterns +CONFIG += console +CONFIG -= app_bundle + +TEMPLATE = app + +SOURCES += main.cpp + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which as been marked deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +include(factorypattern/factorypattern.pri)#工厂模式 +include(singletonpattern/singletonpattern.pri)#单例模式 +include(proxypattern/proxypattern.pri)#代理模式 +include(templatepattern/templatepattern.pri)#模版模式 +include(strategypattern/strategypattern.pri)#策略模式 +include(flyweightpattern/flyweightpattern.pri)#享元模式 +include(visitorpattern/visitorpattern.pri)#访问者模式 +include(mediatorpattern/mediatorpattern.pri)#中介者模式 +include(observerpattern/observerpattern.pri)#观察者模式 +include(statepattern/statepattern.pri)#状态模式 +include(commandpattern/commandpattern.pri)#命令模式 +include(decoratorpattern/decoratorpattern.pri)#装饰模式 +include(bridgepattern/bridgepattern.pri)#桥接模式 +include(iteratorpattern/iteratorpattern.pri)#迭代器模式 +include(compositepattern/compositepattern.pri)#组合模式 +include(facadepattern/facadepattern.pri)#外观模式 +include(adapterpattern/adapterpattern.pri)#适配器模式 +include(abstractfactorypattern/abstractfactorypattern.pri)#抽象工厂模式 +include(builderpattern/builderpattern.pri)#建造者模式 +include(prototypepattern/prototypepattern.pri)#原型模式 +include(interpreterpattern/interpreterpattern.pri)#解释器模式 +include(chainofresponsibilitypattern/chainofresponsibilitypattern.pri)#责任链模式 +include(mementopattern/mementopattern.pri)#备忘录模式 + + + + + + + + + + + + + + diff --git a/DesignPatterns.pro.user b/DesignPatterns.pro.user new file mode 100644 index 0000000..9b63d1b --- /dev/null +++ b/DesignPatterns.pro.user @@ -0,0 +1,318 @@ + + + + + + EnvironmentId + {f6048ee0-a648-46d2-9ec4-234de25ff265} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + System + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.8.0 MSVC2013 32bit + Desktop Qt 5.8.0 MSVC2013 32bit + qt.58.win32_msvc2013_kit + 0 + 0 + 0 + + C:/Users/liubo/Desktop/VSCode Projects/build-DesignPatterns-Desktop_Qt_5_8_0_MSVC2013_32bit-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + + 2 + 鏋勫缓 + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + + 1 + 娓呯悊 + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + C:/Users/liubo/Desktop/VSCode Projects/build-DesignPatterns-Desktop_Qt_5_8_0_MSVC2013_32bit-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + + 2 + 鏋勫缓 + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + + 1 + 娓呯悊 + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + C:/Users/liubo/Desktop/VSCode Projects/build-DesignPatterns-Desktop_Qt_5_8_0_MSVC2013_32bit-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + + 2 + 鏋勫缓 + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + + 1 + 娓呯悊 + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + 閮ㄧ讲 + + ProjectExplorer.BuildSteps.Deploy + + 1 + 鍦ㄦ湰鍦伴儴缃 + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + -1 + + DesignPatterns + + Qt4ProjectManager.Qt4RunConfiguration:C:/Users/liubo/Desktop/VSCode Projects/DesignPatterns/DesignPatterns.pro + true + + DesignPatterns.pro + false + + + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 18 + + + Version + 18 + + diff --git a/abstractfactorypattern/abstractfactory.h b/abstractfactorypattern/abstractfactory.h new file mode 100644 index 0000000..f8afa25 --- /dev/null +++ b/abstractfactorypattern/abstractfactory.h @@ -0,0 +1,78 @@ +#include "interface.h" +#include + +class AbstractFactory +{ +public: + AbstractFactory() + { + cout << "create AbstractFactory" << endl; + } + virtual ~AbstractFactory(){} + virtual Shape * getShape(string type) = 0; + virtual Color * getColor(string type) = 0; +}; + +class ShapeFactory: public AbstractFactory +{ +public: + ShapeFactory() + { + cout << "create ShapeFactory" << endl; + } + Shape * getShape(string type) + { + if (type.compare("Circle") == 0) + { + return new Circle(); + } + else if (type.compare("Square") == 0) + { + return new Square(); + } + else if (type.compare("Rectangle") == 0) + { + return new Rectangle(); + } + else + { + return nullptr; + } + } + Color * getColor(string type) + { + return nullptr; + } +}; + +class ColorFactory: public AbstractFactory +{ +public: + ColorFactory() + { + cout << "create ColorFactory" << endl; + } + Color *getColor(string type) + { + if (type.compare("Red") == 0) + { + return new Red(); + } + else if (type.compare("Green") == 0) + { + return new Green(); + } + else if (type.compare("Blue") == 0) + { + return new Blue(); + } + else + { + return nullptr; + } + } + Shape * getShape(string type) + { + return nullptr; + } +}; diff --git a/abstractfactorypattern/abstractfactorypattern.pri b/abstractfactorypattern/abstractfactorypattern.pri new file mode 100644 index 0000000..c471047 --- /dev/null +++ b/abstractfactorypattern/abstractfactorypattern.pri @@ -0,0 +1,4 @@ +HEADERS += \ + $$PWD/interface.h \ + $$PWD/abstractfactory.h \ + $$PWD/factoryproducer.h diff --git a/abstractfactorypattern/factoryproducer.h b/abstractfactorypattern/factoryproducer.h new file mode 100644 index 0000000..2910dc5 --- /dev/null +++ b/abstractfactorypattern/factoryproducer.h @@ -0,0 +1,22 @@ +#include "abstractfactory.h" + +class FactoryProducer +{ +public: + FactoryProducer(){} + AbstractFactory *getFactory(string type) + { + if (type.compare("ShapeFactory") == 0) + { + return new ShapeFactory(); + } + else if (type.compare("ColorFactory") == 0) + { + return new ColorFactory(); + } + else + { + return nullptr; + } + } +}; diff --git a/abstractfactorypattern/interface.h b/abstractfactorypattern/interface.h new file mode 100644 index 0000000..ddaa5b2 --- /dev/null +++ b/abstractfactorypattern/interface.h @@ -0,0 +1,103 @@ +#include +using namespace std; + +class Shape +{ +public: + Shape() + { + cout << "create Shape" << endl; + + } + virtual ~Shape(){} + virtual void draw() = 0; +}; + +class Circle: public Shape +{ +public: + Circle() + { + cout << "create Circle" << endl; + } + void draw() + { + cout << "draw Circle" << endl; + } +}; + +class Square: public Shape +{ +public: + Square() + { + cout << "create Square" << endl; + } + void draw() + { + cout << "draw Square" << endl; + } +}; + +class Rectangle: public Shape +{ +public: + Rectangle() + { + cout << "create Rectangle" << endl; + } + void draw() + { + cout << "draw Rectangle" << endl; + } +}; + +class Color +{ +public: + Color() + { + cout << "create Color" << endl; + } + virtual ~Color(){} + virtual void fill() = 0; +}; + +class Red: public Color +{ +public: + Red() + { + cout << "create Red" << endl; + } + void fill() + { + cout << "fill Red" << endl; + } +}; + +class Green: public Color +{ +public: + Green() + { + cout << "create Green" << endl; + } + void fill() + { + cout << "fill Green" << endl; + } +}; + +class Blue: public Color +{ +public: + Blue() + { + cout << "create Blue" << endl; + } + void fill() + { + cout << "fill Blue" << endl; + } +}; diff --git a/adapterpattern/adapterpattern.pri b/adapterpattern/adapterpattern.pri new file mode 100644 index 0000000..be78595 --- /dev/null +++ b/adapterpattern/adapterpattern.pri @@ -0,0 +1,3 @@ +HEADERS += \ + $$PWD/first_interface.h \ + $$PWD/second_interface.h diff --git a/adapterpattern/first_interface.h b/adapterpattern/first_interface.h new file mode 100644 index 0000000..d74e36b --- /dev/null +++ b/adapterpattern/first_interface.h @@ -0,0 +1,38 @@ +#include +#include +using namespace std; + +class AdvancedMediaPlayer +{ +public: + AdvancedMediaPlayer(){} + virtual ~AdvancedMediaPlayer(){} + virtual void playVlc(string fileName) = 0; + virtual void playMp4(string fileName) = 0; +}; + +class VlcPlayer: public AdvancedMediaPlayer +{ +public: + void playVlc(string fileName) + { + cout << "Playing vlc file. Name: " + fileName << endl; + } + void playMp4(string fileName) + { + cout << fileName + " do nothing" << endl; + } +}; + +class Mp4Player: public AdvancedMediaPlayer +{ +public: + void playVlc(string fileName) + { + cout << fileName + " do nothing" << endl; + } + void playMp4(string fileName) + { + cout << "Playing mp4 file. Name: " + fileName << endl; + } +}; diff --git a/adapterpattern/second_interface.h b/adapterpattern/second_interface.h new file mode 100644 index 0000000..8b002c3 --- /dev/null +++ b/adapterpattern/second_interface.h @@ -0,0 +1,64 @@ +#include "first_interface.h" + +class MediaPlayer +{ +public: + MediaPlayer(){} + virtual ~MediaPlayer(){} + virtual void play(string audioType, string fileName) = 0; +}; + +class MediaAdapter: public MediaPlayer +{ +public: + MediaAdapter(string audioType) + { + if (audioType == "vlc") + { + player = new VlcPlayer(); + } + else if(audioType == "mp4") + { + player = new Mp4Player(); + } + else + { + player = nullptr; + } + } + void play(string audioType, string fileName) + { + if (audioType == "vlc") + { + player->playVlc(fileName); + } + else if(audioType == "mp4") + { + player->playMp4(fileName); + } + } + +public: + AdvancedMediaPlayer *player; +}; + +class AudioPlayer: public MediaPlayer +{ +public: + void play(string audioType, string fileName) + { + if (audioType == "mp3") + { + cout << "Playing mp3 file. Name: " + fileName << endl; + } + else if(audioType == "mp4" || audioType == "vlc") + { + MediaAdapter * adapter = new MediaAdapter(audioType); + adapter->play(audioType, fileName); + } + else + { + cout << "Invalid media. " + audioType + " format not supported"; + } + } +}; diff --git a/bin/Makefile b/bin/Makefile new file mode 100644 index 0000000..3c19a5e --- /dev/null +++ b/bin/Makefile @@ -0,0 +1,474 @@ +############################################################################# +# Makefile for building: DesignPatterns +# Generated by qmake (3.0) (Qt 5.7.1) +# Project: ..\DesignPatterns.pro +# Template: app +# Command: D:\Qt5.7.1-64\5.7\msvc2015_64\bin\qmake.exe -spec win32-msvc2015 -o Makefile ..\DesignPatterns.pro +############################################################################# + +MAKEFILE = Makefile + +first: release +install: release-install +uninstall: release-uninstall +QMAKE = D:\Qt5.7.1-64\5.7\msvc2015_64\bin\qmake.exe +DEL_FILE = del +CHK_DIR_EXISTS= if not exist +MKDIR = mkdir +COPY = copy /y +COPY_FILE = copy /y +COPY_DIR = xcopy /s /q /y /i +INSTALL_FILE = copy /y +INSTALL_PROGRAM = copy /y +INSTALL_DIR = xcopy /s /q /y /i +DEL_FILE = del +SYMLINK = $(QMAKE) -install ln -f -s +DEL_DIR = rmdir +MOVE = move +SUBTARGETS = \ + release \ + debug + + +release: FORCE + @set MAKEFLAGS=$(MAKEFLAGS) + $(MAKE) -f $(MAKEFILE).Release +release-make_first: FORCE + @set MAKEFLAGS=$(MAKEFLAGS) + $(MAKE) -f $(MAKEFILE).Release +release-all: FORCE + @set MAKEFLAGS=$(MAKEFLAGS) + $(MAKE) -f $(MAKEFILE).Release all +release-clean: FORCE + @set MAKEFLAGS=$(MAKEFLAGS) + $(MAKE) -f $(MAKEFILE).Release clean +release-distclean: FORCE + @set MAKEFLAGS=$(MAKEFLAGS) + $(MAKE) -f $(MAKEFILE).Release distclean +release-install: FORCE + @set MAKEFLAGS=$(MAKEFLAGS) + $(MAKE) -f $(MAKEFILE).Release install +release-uninstall: FORCE + @set MAKEFLAGS=$(MAKEFLAGS) + $(MAKE) -f $(MAKEFILE).Release uninstall +debug: FORCE + @set MAKEFLAGS=$(MAKEFLAGS) + $(MAKE) -f $(MAKEFILE).Debug +debug-make_first: FORCE + @set MAKEFLAGS=$(MAKEFLAGS) + $(MAKE) -f $(MAKEFILE).Debug +debug-all: FORCE + @set MAKEFLAGS=$(MAKEFLAGS) + $(MAKE) -f $(MAKEFILE).Debug all +debug-clean: FORCE + @set MAKEFLAGS=$(MAKEFLAGS) + $(MAKE) -f $(MAKEFILE).Debug clean +debug-distclean: FORCE + @set MAKEFLAGS=$(MAKEFLAGS) + $(MAKE) -f $(MAKEFILE).Debug distclean +debug-install: FORCE + @set MAKEFLAGS=$(MAKEFLAGS) + $(MAKE) -f $(MAKEFILE).Debug install +debug-uninstall: FORCE + @set MAKEFLAGS=$(MAKEFLAGS) + $(MAKE) -f $(MAKEFILE).Debug uninstall + +Makefile: ..\DesignPatterns.pro D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\win32-msvc2015\qmake.conf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\spec_pre.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\common\angle.conf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\common\msvc-base.conf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\common\msvc-desktop.conf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\qconfig.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dcore.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dcore_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dextras.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dextras_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dinput.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dinput_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dlogic.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dlogic_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquick.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquick_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickextras.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickextras_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickinput.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickinput_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickrender.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickrender_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3drender.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3drender_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axbase.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axbase_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axcontainer.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axcontainer_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axserver.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axserver_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_bluetooth.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_bluetooth_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_bootstrap_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_charts.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_charts_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_clucene_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_concurrent.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_concurrent_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_core.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_core_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_datavisualization.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_datavisualization_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_dbus.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_dbus_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_designer.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_designer_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_designercomponents_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_gamepad.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_gamepad_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_gui.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_gui_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_help.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_help_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_location.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_location_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_multimedia.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_multimedia_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_multimediawidgets.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_multimediawidgets_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_network.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_network_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_nfc.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_nfc_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_opengl.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_opengl_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_openglextensions.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_openglextensions_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_packetprotocol_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_platformsupport_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_positioning.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_positioning_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_printsupport.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_printsupport_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_purchasing.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_purchasing_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qml.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qml_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qmldebug_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qmldevtools_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qmltest.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qmltest_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qtmultimediaquicktools_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quick.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quick_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quickcontrols2.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quickcontrols2_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quickparticles_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quicktemplates2_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quickwidgets.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quickwidgets_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_script.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_script_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_scripttools.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_scripttools_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_scxml.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_scxml_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_sensors.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_sensors_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_serialbus.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_serialbus_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_serialport.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_serialport_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_sql.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_sql_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_svg.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_svg_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_testlib.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_testlib_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_uiplugin.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_uitools.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_uitools_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webchannel.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webchannel_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webengine.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webengine_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webenginecore.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webenginecore_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webenginecoreheaders_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webenginewidgets.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webenginewidgets_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_websockets.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_websockets_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webview.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webview_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_widgets.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_widgets_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_winextras.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_winextras_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_xml.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_xml_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_xmlpatterns.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_xmlpatterns_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_zlib_private.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\qt_functions.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\qt_config.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\win32\qt_config.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\win32-msvc2015\qmake.conf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\spec_post.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\exclusive_builds.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\toolchain.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\default_pre.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\win32\default_pre.prf \ + ..\factorypattern\factorypattern.pri \ + ..\singletonpattern\singletonpattern.pri \ + ..\proxypattern\proxypattern.pri \ + ..\templatepattern\templatepattern.pri \ + ..\strategypattern\strategypattern.pri \ + ..\flyweightpattern\flyweightpattern.pri \ + ..\visitorpattern\visitorpattern.pri \ + ..\mediatorpattern\mediatorpattern.pri \ + ..\observerpattern\observerpattern.pri \ + ..\statepattern\statepattern.pri \ + ..\commandpattern\commandpattern.pri \ + ..\decoratorpattern\decoratorpattern.pri \ + ..\bridgepattern\bridgepattern.pri \ + ..\iteratorpattern\iteratorpattern.pri \ + ..\compositepattern\compositepattern.pri \ + ..\facadepattern\facadepattern.pri \ + ..\adapterpattern\adapterpattern.pri \ + ..\abstractfactorypattern\abstractfactorypattern.pri \ + ..\builderpattern\builderpattern.pri \ + ..\prototypepattern\prototypepattern.pri \ + ..\interpreterpattern\interpreterpattern.pri \ + ..\chainofresponsibilitypattern\chainofresponsibilitypattern.pri \ + ..\mementopattern\mementopattern.pri \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\resolve_config.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\exclusive_builds_post.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\default_post.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\win32\console.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\win32\rtti.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\precompile_header.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\warn_on.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\qt.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\resources.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\moc.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\file_copies.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\testcase_targets.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\exceptions.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\yacc.prf \ + D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\lex.prf \ + ..\DesignPatterns.pro \ + D:\Qt5.7.1-64\5.7\msvc2015_64\lib\Qt5Core.prl + $(QMAKE) -spec win32-msvc2015 -o Makefile ..\DesignPatterns.pro +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\spec_pre.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\common\angle.conf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\common\msvc-base.conf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\common\msvc-desktop.conf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\qconfig.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dcore.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dcore_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dextras.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dextras_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dinput.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dinput_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dlogic.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dlogic_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquick.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquick_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickextras.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickextras_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickinput.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickinput_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickrender.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickrender_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3drender.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3drender_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axbase.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axbase_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axcontainer.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axcontainer_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axserver.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axserver_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_bluetooth.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_bluetooth_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_bootstrap_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_charts.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_charts_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_clucene_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_concurrent.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_concurrent_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_core.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_core_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_datavisualization.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_datavisualization_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_dbus.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_dbus_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_designer.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_designer_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_designercomponents_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_gamepad.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_gamepad_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_gui.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_gui_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_help.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_help_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_location.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_location_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_multimedia.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_multimedia_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_multimediawidgets.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_multimediawidgets_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_network.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_network_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_nfc.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_nfc_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_opengl.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_opengl_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_openglextensions.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_openglextensions_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_packetprotocol_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_platformsupport_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_positioning.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_positioning_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_printsupport.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_printsupport_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_purchasing.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_purchasing_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qml.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qml_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qmldebug_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qmldevtools_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qmltest.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qmltest_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qtmultimediaquicktools_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quick.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quick_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quickcontrols2.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quickcontrols2_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quickparticles_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quicktemplates2_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quickwidgets.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quickwidgets_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_script.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_script_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_scripttools.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_scripttools_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_scxml.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_scxml_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_sensors.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_sensors_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_serialbus.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_serialbus_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_serialport.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_serialport_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_sql.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_sql_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_svg.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_svg_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_testlib.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_testlib_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_uiplugin.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_uitools.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_uitools_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webchannel.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webchannel_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webengine.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webengine_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webenginecore.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webenginecore_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webenginecoreheaders_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webenginewidgets.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webenginewidgets_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_websockets.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_websockets_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webview.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webview_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_widgets.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_widgets_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_winextras.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_winextras_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_xml.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_xml_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_xmlpatterns.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_xmlpatterns_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_zlib_private.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\qt_functions.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\qt_config.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\win32\qt_config.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\win32-msvc2015\qmake.conf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\spec_post.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\exclusive_builds.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\toolchain.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\default_pre.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\win32\default_pre.prf: +..\factorypattern\factorypattern.pri: +..\singletonpattern\singletonpattern.pri: +..\proxypattern\proxypattern.pri: +..\templatepattern\templatepattern.pri: +..\strategypattern\strategypattern.pri: +..\flyweightpattern\flyweightpattern.pri: +..\visitorpattern\visitorpattern.pri: +..\mediatorpattern\mediatorpattern.pri: +..\observerpattern\observerpattern.pri: +..\statepattern\statepattern.pri: +..\commandpattern\commandpattern.pri: +..\decoratorpattern\decoratorpattern.pri: +..\bridgepattern\bridgepattern.pri: +..\iteratorpattern\iteratorpattern.pri: +..\compositepattern\compositepattern.pri: +..\facadepattern\facadepattern.pri: +..\adapterpattern\adapterpattern.pri: +..\abstractfactorypattern\abstractfactorypattern.pri: +..\builderpattern\builderpattern.pri: +..\prototypepattern\prototypepattern.pri: +..\interpreterpattern\interpreterpattern.pri: +..\chainofresponsibilitypattern\chainofresponsibilitypattern.pri: +..\mementopattern\mementopattern.pri: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\resolve_config.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\exclusive_builds_post.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\default_post.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\win32\console.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\win32\rtti.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\precompile_header.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\warn_on.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\qt.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\resources.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\moc.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\file_copies.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\testcase_targets.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\exceptions.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\yacc.prf: +D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\lex.prf: +..\DesignPatterns.pro: +D:\Qt5.7.1-64\5.7\msvc2015_64\lib\Qt5Core.prl: +qmake: FORCE + @$(QMAKE) -spec win32-msvc2015 -o Makefile ..\DesignPatterns.pro + +qmake_all: FORCE + +make_first: release-make_first debug-make_first FORCE +all: release-all debug-all FORCE +clean: release-clean debug-clean FORCE + -$(DEL_FILE) DesignPatterns.exp +distclean: release-distclean debug-distclean FORCE + -$(DEL_FILE) Makefile + -$(DEL_FILE) DesignPatterns.lib + +release-mocclean: + @set MAKEFLAGS=$(MAKEFLAGS) + $(MAKE) -f $(MAKEFILE).Release mocclean +debug-mocclean: + @set MAKEFLAGS=$(MAKEFLAGS) + $(MAKE) -f $(MAKEFILE).Debug mocclean +mocclean: release-mocclean debug-mocclean + +release-mocables: + @set MAKEFLAGS=$(MAKEFLAGS) + $(MAKE) -f $(MAKEFILE).Release mocables +debug-mocables: + @set MAKEFLAGS=$(MAKEFLAGS) + $(MAKE) -f $(MAKEFILE).Debug mocables +mocables: release-mocables debug-mocables + +check: first + +benchmark: first +FORCE: + +$(MAKEFILE).Release: Makefile +$(MAKEFILE).Debug: Makefile diff --git a/bin/Makefile.Debug b/bin/Makefile.Debug new file mode 100644 index 0000000..65ceb9e --- /dev/null +++ b/bin/Makefile.Debug @@ -0,0 +1,208 @@ +############################################################################# +# Makefile for building: DesignPatterns +# Generated by qmake (3.0) (Qt 5.7.1) +# Project: ..\DesignPatterns.pro +# Template: app +############################################################################# + +MAKEFILE = Makefile.Debug + +####### Compiler, tools and options + +CC = cl +CXX = cl +DEFINES = -DUNICODE -DWIN32 -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_CORE_LIB +CFLAGS = -nologo -Zc:wchar_t -FS -Zc:strictStrings -Zi -MDd -W3 -w44456 -w44457 -w44458 /Fddebug\DesignPatterns.vc.pdb $(DEFINES) +CXXFLAGS = -nologo -Zc:wchar_t -FS -Zc:strictStrings -Zc:throwingNew -Zi -MDd -GR -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\DesignPatterns.vc.pdb $(DEFINES) +INCPATH = -I..\..\DesignPatterns -I. -ID:\Qt5.7.1-64\5.7\msvc2015_64\include -ID:\Qt5.7.1-64\5.7\msvc2015_64\include\QtCore -Idebug -ID:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\win32-msvc2015 +LINKER = link +LFLAGS = /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" +LIBS = /LIBPATH:D:\Qt5.7.1-64\5.7\msvc2015_64\lib D:\Qt5.7.1-64\5.7\msvc2015_64\lib\Qt5Cored.lib +QMAKE = D:\Qt5.7.1-64\5.7\msvc2015_64\bin\qmake.exe +IDC = idc +IDL = midl +ZIP = zip -r -9 +DEF_FILE = +RES_FILE = +COPY = copy /y +SED = $(QMAKE) -install sed +COPY_FILE = copy /y +COPY_DIR = xcopy /s /q /y /i +DEL_FILE = del +DEL_DIR = rmdir +MOVE = move +CHK_DIR_EXISTS= if not exist +MKDIR = mkdir +INSTALL_FILE = copy /y +INSTALL_PROGRAM = copy /y +INSTALL_DIR = xcopy /s /q /y /i + +####### Output directory + +OBJECTS_DIR = debug + +####### Files + +SOURCES = ..\main.cpp +OBJECTS = debug\main.obj + +DIST = ..\factorypattern\interface.h \ + ..\factorypattern\shapefactory.h \ + ..\singletonpattern\singletonpattern.h \ + ..\proxypattern\interface.h \ + ..\templatepattern\interface.h \ + ..\flyweightpattern\interface.h \ + ..\flyweightpattern\shapefactory.h \ + ..\visitorpattern\father.h \ + ..\visitorpattern\son.h \ + ..\mediatorpattern\chatroom.h \ + ..\mediatorpattern\usr.h \ + ..\observerpattern\interface.h \ + ..\observerpattern\subject.h \ + ..\statepattern\memento.h \ + ..\statepattern\originator.h \ + ..\statepattern\caretaker.h \ + ..\statepattern\context.h \ + ..\statepattern\interface.h \ + ..\commandpattern\stock.h \ + ..\commandpattern\interface.h \ + ..\commandpattern\broker.h \ + ..\decoratorpattern\first_interface.h \ + ..\decoratorpattern\second_interface.h \ + ..\bridgepattern\first_interface.h \ + ..\bridgepattern\second_interface.h \ + ..\iteratorpattern\interface.h \ + ..\compositepattern\employee.h \ + ..\facadepattern\interface.h \ + ..\facadepattern\shapemaker.h \ + ..\adapterpattern\first_interface.h \ + ..\adapterpattern\second_interface.h \ + ..\abstractfactorypattern\interface.h \ + ..\abstractfactorypattern\abstractfactory.h \ + ..\abstractfactorypattern\factoryproducer.h \ + ..\builderpattern\packinterface.h \ + ..\builderpattern\foodinterface.h \ + ..\builderpattern\meal.h \ + ..\builderpattern\meakbuilder.h \ + ..\prototypepattern\interface.h \ + ..\interpreterpattern\interface.h \ + ..\chainofresponsibilitypattern\interface.h \ + ..\mementopattern\memento.h \ + ..\mementopattern\originator.h \ + ..\mementopattern\caretaker.h ..\main.cpp +QMAKE_TARGET = DesignPatterns +DESTDIR = debug\ #avoid trailing-slash linebreak +TARGET = DesignPatterns.exe +DESTDIR_TARGET = debug\DesignPatterns.exe + +####### Implicit rules + +.SUFFIXES: .c .cpp .cc .cxx + +{..}.cpp{debug\}.obj:: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fodebug\ @<< + $< +<< + +{..}.cc{debug\}.obj:: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fodebug\ @<< + $< +<< + +{..}.cxx{debug\}.obj:: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fodebug\ @<< + $< +<< + +{..}.c{debug\}.obj:: + $(CC) -c $(CFLAGS) $(INCPATH) -Fodebug\ @<< + $< +<< + +{.}.cpp{debug\}.obj:: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fodebug\ @<< + $< +<< + +{.}.cc{debug\}.obj:: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fodebug\ @<< + $< +<< + +{.}.cxx{debug\}.obj:: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fodebug\ @<< + $< +<< + +{.}.c{debug\}.obj:: + $(CC) -c $(CFLAGS) $(INCPATH) -Fodebug\ @<< + $< +<< + +####### Build rules + +first: all +all: Makefile.Debug $(DESTDIR_TARGET) + +$(DESTDIR_TARGET): $(OBJECTS) + $(LINKER) $(LFLAGS) /MANIFEST:embed /OUT:$(DESTDIR_TARGET) @<< +$(OBJECTS) $(LIBS) +<< + +qmake: FORCE + @$(QMAKE) -spec win32-msvc2015 -o Makefile.Debug ..\DesignPatterns.pro + +qmake_all: FORCE + +dist: + $(ZIP) DesignPatterns.zip $(SOURCES) $(DIST) ..\DesignPatterns.pro D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\spec_pre.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\common\angle.conf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\common\msvc-base.conf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\common\msvc-desktop.conf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\qconfig.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dcore.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dcore_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dextras.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dextras_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dinput.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dinput_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dlogic.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dlogic_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquick.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquick_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickextras.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickextras_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickinput.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickinput_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickrender.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickrender_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3drender.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3drender_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axbase.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axbase_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axcontainer.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axcontainer_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axserver.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axserver_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_bluetooth.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_bluetooth_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_bootstrap_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_charts.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_charts_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_clucene_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_concurrent.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_concurrent_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_core.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_core_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_datavisualization.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_datavisualization_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_dbus.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_dbus_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_designer.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_designer_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_designercomponents_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_gamepad.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_gamepad_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_gui.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_gui_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_help.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_help_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_location.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_location_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_multimedia.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_multimedia_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_multimediawidgets.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_multimediawidgets_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_network.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_network_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_nfc.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_nfc_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_opengl.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_opengl_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_openglextensions.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_openglextensions_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_packetprotocol_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_platformsupport_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_positioning.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_positioning_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_printsupport.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_printsupport_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_purchasing.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_purchasing_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qml.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qml_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qmldebug_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qmldevtools_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qmltest.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qmltest_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qtmultimediaquicktools_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quick.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quick_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quickcontrols2.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quickcontrols2_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quickparticles_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quicktemplates2_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quickwidgets.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quickwidgets_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_script.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_script_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_scripttools.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_scripttools_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_scxml.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_scxml_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_sensors.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_sensors_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_serialbus.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_serialbus_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_serialport.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_serialport_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_sql.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_sql_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_svg.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_svg_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_testlib.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_testlib_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_uiplugin.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_uitools.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_uitools_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webchannel.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webchannel_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webengine.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webengine_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webenginecore.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webenginecore_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webenginecoreheaders_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webenginewidgets.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webenginewidgets_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_websockets.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_websockets_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webview.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webview_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_widgets.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_widgets_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_winextras.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_winextras_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_xml.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_xml_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_xmlpatterns.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_xmlpatterns_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_zlib_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\qt_functions.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\qt_config.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\win32\qt_config.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\win32-msvc2015\qmake.conf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\spec_post.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\exclusive_builds.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\toolchain.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\default_pre.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\win32\default_pre.prf ..\factorypattern\factorypattern.pri ..\singletonpattern\singletonpattern.pri ..\proxypattern\proxypattern.pri ..\templatepattern\templatepattern.pri ..\strategypattern\strategypattern.pri ..\flyweightpattern\flyweightpattern.pri ..\visitorpattern\visitorpattern.pri ..\mediatorpattern\mediatorpattern.pri ..\observerpattern\observerpattern.pri ..\statepattern\statepattern.pri ..\commandpattern\commandpattern.pri ..\decoratorpattern\decoratorpattern.pri ..\bridgepattern\bridgepattern.pri ..\iteratorpattern\iteratorpattern.pri ..\compositepattern\compositepattern.pri ..\facadepattern\facadepattern.pri ..\adapterpattern\adapterpattern.pri ..\abstractfactorypattern\abstractfactorypattern.pri ..\builderpattern\builderpattern.pri ..\prototypepattern\prototypepattern.pri ..\interpreterpattern\interpreterpattern.pri ..\chainofresponsibilitypattern\chainofresponsibilitypattern.pri ..\mementopattern\mementopattern.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\resolve_config.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\exclusive_builds_post.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\default_post.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\build_pass.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\win32\console.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\win32\rtti.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\precompile_header.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\warn_on.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\qt.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\resources.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\moc.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\file_copies.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\testcase_targets.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\exceptions.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\yacc.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\lex.prf ..\DesignPatterns.pro D:\Qt5.7.1-64\5.7\msvc2015_64\lib\Qt5Cored.prl NO_PCH_SOURCES RESOURCES HEADERS SOURCES OBJECTIVE_SOURCES YACCSOURCES YACCSOURCES LEXSOURCES + +clean: compiler_clean + -$(DEL_FILE) debug\main.obj + -$(DEL_FILE) debug\DesignPatterns.exp debug\DesignPatterns.vc.pdb debug\DesignPatterns.ilk debug\DesignPatterns.idb + +distclean: clean + -$(DEL_FILE) debug\DesignPatterns.lib debug\DesignPatterns.pdb + -$(DEL_FILE) $(DESTDIR_TARGET) + -$(DEL_FILE) Makefile.Debug + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all + +check: first + +benchmark: first + +compiler_no_pch_compiler_make_all: +compiler_no_pch_compiler_clean: +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_moc_header_make_all: +compiler_moc_header_clean: +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: + + + +####### Compile + +debug\main.obj: ..\main.cpp ../mementopattern/originator.h \ + ../mementopattern/memento.h \ + ../mementopattern/caretaker.h + +####### Install + +install: FORCE + +uninstall: FORCE + +FORCE: + diff --git a/bin/Makefile.Release b/bin/Makefile.Release new file mode 100644 index 0000000..c98fc7a --- /dev/null +++ b/bin/Makefile.Release @@ -0,0 +1,208 @@ +############################################################################# +# Makefile for building: DesignPatterns +# Generated by qmake (3.0) (Qt 5.7.1) +# Project: ..\DesignPatterns.pro +# Template: app +############################################################################# + +MAKEFILE = Makefile.Release + +####### Compiler, tools and options + +CC = cl +CXX = cl +DEFINES = -DUNICODE -DWIN32 -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_CORE_LIB -DNDEBUG +CFLAGS = -nologo -Zc:wchar_t -FS -Zc:strictStrings -O2 -MD -W3 -w44456 -w44457 -w44458 $(DEFINES) +CXXFLAGS = -nologo -Zc:wchar_t -FS -Zc:strictStrings -Zc:throwingNew -O2 -MD -GR -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc $(DEFINES) +INCPATH = -I..\..\DesignPatterns -I. -ID:\Qt5.7.1-64\5.7\msvc2015_64\include -ID:\Qt5.7.1-64\5.7\msvc2015_64\include\QtCore -Irelease -ID:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\win32-msvc2015 +LINKER = link +LFLAGS = /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" +LIBS = /LIBPATH:D:\Qt5.7.1-64\5.7\msvc2015_64\lib D:\Qt5.7.1-64\5.7\msvc2015_64\lib\Qt5Core.lib +QMAKE = D:\Qt5.7.1-64\5.7\msvc2015_64\bin\qmake.exe +IDC = idc +IDL = midl +ZIP = zip -r -9 +DEF_FILE = +RES_FILE = +COPY = copy /y +SED = $(QMAKE) -install sed +COPY_FILE = copy /y +COPY_DIR = xcopy /s /q /y /i +DEL_FILE = del +DEL_DIR = rmdir +MOVE = move +CHK_DIR_EXISTS= if not exist +MKDIR = mkdir +INSTALL_FILE = copy /y +INSTALL_PROGRAM = copy /y +INSTALL_DIR = xcopy /s /q /y /i + +####### Output directory + +OBJECTS_DIR = release + +####### Files + +SOURCES = ..\main.cpp +OBJECTS = release\main.obj + +DIST = ..\factorypattern\interface.h \ + ..\factorypattern\shapefactory.h \ + ..\singletonpattern\singletonpattern.h \ + ..\proxypattern\interface.h \ + ..\templatepattern\interface.h \ + ..\flyweightpattern\interface.h \ + ..\flyweightpattern\shapefactory.h \ + ..\visitorpattern\father.h \ + ..\visitorpattern\son.h \ + ..\mediatorpattern\chatroom.h \ + ..\mediatorpattern\usr.h \ + ..\observerpattern\interface.h \ + ..\observerpattern\subject.h \ + ..\statepattern\memento.h \ + ..\statepattern\originator.h \ + ..\statepattern\caretaker.h \ + ..\statepattern\context.h \ + ..\statepattern\interface.h \ + ..\commandpattern\stock.h \ + ..\commandpattern\interface.h \ + ..\commandpattern\broker.h \ + ..\decoratorpattern\first_interface.h \ + ..\decoratorpattern\second_interface.h \ + ..\bridgepattern\first_interface.h \ + ..\bridgepattern\second_interface.h \ + ..\iteratorpattern\interface.h \ + ..\compositepattern\employee.h \ + ..\facadepattern\interface.h \ + ..\facadepattern\shapemaker.h \ + ..\adapterpattern\first_interface.h \ + ..\adapterpattern\second_interface.h \ + ..\abstractfactorypattern\interface.h \ + ..\abstractfactorypattern\abstractfactory.h \ + ..\abstractfactorypattern\factoryproducer.h \ + ..\builderpattern\packinterface.h \ + ..\builderpattern\foodinterface.h \ + ..\builderpattern\meal.h \ + ..\builderpattern\meakbuilder.h \ + ..\prototypepattern\interface.h \ + ..\interpreterpattern\interface.h \ + ..\chainofresponsibilitypattern\interface.h \ + ..\mementopattern\memento.h \ + ..\mementopattern\originator.h \ + ..\mementopattern\caretaker.h ..\main.cpp +QMAKE_TARGET = DesignPatterns +DESTDIR = release\ #avoid trailing-slash linebreak +TARGET = DesignPatterns.exe +DESTDIR_TARGET = release\DesignPatterns.exe + +####### Implicit rules + +.SUFFIXES: .c .cpp .cc .cxx + +{..}.cpp{release\}.obj:: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ @<< + $< +<< + +{..}.cc{release\}.obj:: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ @<< + $< +<< + +{..}.cxx{release\}.obj:: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ @<< + $< +<< + +{..}.c{release\}.obj:: + $(CC) -c $(CFLAGS) $(INCPATH) -Forelease\ @<< + $< +<< + +{.}.cpp{release\}.obj:: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ @<< + $< +<< + +{.}.cc{release\}.obj:: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ @<< + $< +<< + +{.}.cxx{release\}.obj:: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ @<< + $< +<< + +{.}.c{release\}.obj:: + $(CC) -c $(CFLAGS) $(INCPATH) -Forelease\ @<< + $< +<< + +####### Build rules + +first: all +all: Makefile.Release $(DESTDIR_TARGET) + +$(DESTDIR_TARGET): $(OBJECTS) + $(LINKER) $(LFLAGS) /MANIFEST:embed /OUT:$(DESTDIR_TARGET) @<< +$(OBJECTS) $(LIBS) +<< + +qmake: FORCE + @$(QMAKE) -spec win32-msvc2015 -o Makefile.Release ..\DesignPatterns.pro + +qmake_all: FORCE + +dist: + $(ZIP) DesignPatterns.zip $(SOURCES) $(DIST) ..\DesignPatterns.pro D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\spec_pre.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\common\angle.conf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\common\msvc-base.conf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\common\msvc-desktop.conf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\qconfig.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dcore.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dcore_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dextras.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dextras_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dinput.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dinput_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dlogic.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dlogic_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquick.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquick_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickextras.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickextras_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickinput.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickinput_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickrender.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3dquickrender_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3drender.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_3drender_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axbase.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axbase_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axcontainer.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axcontainer_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axserver.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_axserver_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_bluetooth.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_bluetooth_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_bootstrap_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_charts.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_charts_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_clucene_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_concurrent.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_concurrent_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_core.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_core_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_datavisualization.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_datavisualization_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_dbus.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_dbus_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_designer.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_designer_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_designercomponents_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_gamepad.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_gamepad_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_gui.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_gui_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_help.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_help_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_location.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_location_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_multimedia.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_multimedia_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_multimediawidgets.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_multimediawidgets_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_network.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_network_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_nfc.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_nfc_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_opengl.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_opengl_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_openglextensions.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_openglextensions_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_packetprotocol_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_platformsupport_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_positioning.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_positioning_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_printsupport.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_printsupport_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_purchasing.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_purchasing_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qml.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qml_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qmldebug_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qmldevtools_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qmltest.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qmltest_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_qtmultimediaquicktools_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quick.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quick_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quickcontrols2.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quickcontrols2_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quickparticles_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quicktemplates2_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quickwidgets.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_quickwidgets_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_script.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_script_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_scripttools.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_scripttools_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_scxml.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_scxml_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_sensors.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_sensors_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_serialbus.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_serialbus_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_serialport.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_serialport_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_sql.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_sql_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_svg.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_svg_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_testlib.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_testlib_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_uiplugin.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_uitools.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_uitools_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webchannel.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webchannel_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webengine.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webengine_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webenginecore.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webenginecore_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webenginecoreheaders_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webenginewidgets.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webenginewidgets_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_websockets.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_websockets_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webview.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_webview_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_widgets.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_widgets_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_winextras.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_winextras_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_xml.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_xml_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_xmlpatterns.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_xmlpatterns_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\modules\qt_lib_zlib_private.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\qt_functions.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\qt_config.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\win32\qt_config.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\win32-msvc2015\qmake.conf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\spec_post.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\exclusive_builds.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\toolchain.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\default_pre.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\win32\default_pre.prf ..\factorypattern\factorypattern.pri ..\singletonpattern\singletonpattern.pri ..\proxypattern\proxypattern.pri ..\templatepattern\templatepattern.pri ..\strategypattern\strategypattern.pri ..\flyweightpattern\flyweightpattern.pri ..\visitorpattern\visitorpattern.pri ..\mediatorpattern\mediatorpattern.pri ..\observerpattern\observerpattern.pri ..\statepattern\statepattern.pri ..\commandpattern\commandpattern.pri ..\decoratorpattern\decoratorpattern.pri ..\bridgepattern\bridgepattern.pri ..\iteratorpattern\iteratorpattern.pri ..\compositepattern\compositepattern.pri ..\facadepattern\facadepattern.pri ..\adapterpattern\adapterpattern.pri ..\abstractfactorypattern\abstractfactorypattern.pri ..\builderpattern\builderpattern.pri ..\prototypepattern\prototypepattern.pri ..\interpreterpattern\interpreterpattern.pri ..\chainofresponsibilitypattern\chainofresponsibilitypattern.pri ..\mementopattern\mementopattern.pri D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\resolve_config.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\exclusive_builds_post.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\default_post.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\build_pass.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\win32\console.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\win32\rtti.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\precompile_header.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\warn_on.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\qt.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\resources.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\moc.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\file_copies.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\testcase_targets.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\exceptions.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\yacc.prf D:\Qt5.7.1-64\5.7\msvc2015_64\mkspecs\features\lex.prf ..\DesignPatterns.pro D:\Qt5.7.1-64\5.7\msvc2015_64\lib\Qt5Core.prl NO_PCH_SOURCES RESOURCES HEADERS SOURCES OBJECTIVE_SOURCES YACCSOURCES YACCSOURCES LEXSOURCES + +clean: compiler_clean + -$(DEL_FILE) release\main.obj + -$(DEL_FILE) release\DesignPatterns.exp + +distclean: clean + -$(DEL_FILE) release\DesignPatterns.lib + -$(DEL_FILE) $(DESTDIR_TARGET) + -$(DEL_FILE) Makefile.Release + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all + +check: first + +benchmark: first + +compiler_no_pch_compiler_make_all: +compiler_no_pch_compiler_clean: +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_moc_header_make_all: +compiler_moc_header_clean: +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: + + + +####### Compile + +release\main.obj: ..\main.cpp ../mementopattern/originator.h \ + ../mementopattern/memento.h \ + ../mementopattern/caretaker.h + +####### Install + +install: FORCE + +uninstall: FORCE + +FORCE: + diff --git a/bin/release/DesignPatterns.exe b/bin/release/DesignPatterns.exe new file mode 100644 index 0000000..b35bc83 Binary files /dev/null and b/bin/release/DesignPatterns.exe differ diff --git a/bin/release/main.obj b/bin/release/main.obj new file mode 100644 index 0000000..9bb7830 Binary files /dev/null and b/bin/release/main.obj differ diff --git a/bridgepattern/bridgepattern.pri b/bridgepattern/bridgepattern.pri new file mode 100644 index 0000000..be78595 --- /dev/null +++ b/bridgepattern/bridgepattern.pri @@ -0,0 +1,3 @@ +HEADERS += \ + $$PWD/first_interface.h \ + $$PWD/second_interface.h diff --git a/bridgepattern/first_interface.h b/bridgepattern/first_interface.h new file mode 100644 index 0000000..3c502ee --- /dev/null +++ b/bridgepattern/first_interface.h @@ -0,0 +1,28 @@ +#include +using namespace std; + +class DrawApi +{ +public: + DrawApi(){} + virtual ~DrawApi(){} + virtual void drawCircle(int radius, int x, int y) = 0; +}; + +class RedCircle: public DrawApi +{ +public: + void drawCircle(int radius, int x, int y) + { + cout << "drawing circle [ color: red, radius: " << radius << ", x: " << x << ", y: " << y << " ]" << endl; + } +}; + +class GreenCircle: public DrawApi +{ +public: + void drawCircle(int radius, int x, int y) + { + cout << "drawing circle [ color: green, radius: " << radius << ", x: " << x << ", y: " << y << " ]" << endl; + } +}; diff --git a/bridgepattern/second_interface.h b/bridgepattern/second_interface.h new file mode 100644 index 0000000..a623782 --- /dev/null +++ b/bridgepattern/second_interface.h @@ -0,0 +1,36 @@ +#include "first_interface.h" + +class Shape +{ +public: + virtual ~Shape(){} + DrawApi *getDrawApi() + { + return this->drawApi; + } + virtual void draw() = 0; + +protected: + DrawApi *drawApi; + Shape(DrawApi *drawApi): drawApi(drawApi){} +}; + +class Circle: public Shape +{ +public: + Circle(int radius, int x, int y, DrawApi *drawApi): Shape(drawApi) + { + this->x = x; + this->y = y; + this->radius = radius; + } + void draw() + { + getDrawApi()->drawCircle(radius, x, y); + } + +private: + int x; + int y; + int radius; +}; diff --git a/builderpattern/builderpattern.pri b/builderpattern/builderpattern.pri new file mode 100644 index 0000000..58d21ee --- /dev/null +++ b/builderpattern/builderpattern.pri @@ -0,0 +1,5 @@ +HEADERS += \ + $$PWD/packinterface.h \ + $$PWD/foodinterface.h \ + $$PWD/meal.h \ + $$PWD/meakbuilder.h diff --git a/builderpattern/foodinterface.h b/builderpattern/foodinterface.h new file mode 100644 index 0000000..761a442 --- /dev/null +++ b/builderpattern/foodinterface.h @@ -0,0 +1,86 @@ +#include "packinterface.h" +#include + +class Food +{ +public: + Food(){} + virtual ~Food(){} + virtual Packing *getPack() = 0; + virtual string getName() = 0; + virtual float getPrice() = 0; +}; + +class Burger: public Food +{ +public: + Packing *getPack() + { + return new Wrapper(); + } + virtual string getName() = 0; + virtual float getPrice() = 0; +}; + +class ColdDrink: public Food +{ +public: + Packing *getPack() + { + return new Bottle(); + } + virtual string getName() = 0; + virtual float getPrice() = 0; +}; + +class VegBurger: public Burger +{ +public: + string getName() + { + return "Veg Burger"; + } + float getPrice() + { + return 25.0f; + } +}; + +class ChickenBurger: public Burger +{ +public: + string getName() + { + return "Chicken Burger"; + } + float getPrice() + { + return 50.5f; + } +}; + +class Coke: public ColdDrink +{ +public: + string getName() + { + return "Coke"; + } + float getPrice() + { + return 30.0f; + } +}; + +class Pepsi: public ColdDrink +{ +public: + string getName() + { + return "Pepsi"; + } + float getPrice() + { + return 35.0f; + } +}; diff --git a/builderpattern/meakbuilder.h b/builderpattern/meakbuilder.h new file mode 100644 index 0000000..a741a2b --- /dev/null +++ b/builderpattern/meakbuilder.h @@ -0,0 +1,20 @@ +#include "meal.h" + +class MealBuilder +{ +public: + Meal *prepareVegMeal () + { + Meal * meal = new Meal(); + meal->addFoodToVector(new VegBurger()); + meal->addFoodToVector(new Coke()); + return meal; + } + Meal *prepareNonVegMeal () + { + Meal * meal = new Meal(); + meal->addFoodToVector(new ChickenBurger()); + meal->addFoodToVector(static_cast(new Pepsi())); + return meal; + } +}; diff --git a/builderpattern/meal.h b/builderpattern/meal.h new file mode 100644 index 0000000..7b0aa8a --- /dev/null +++ b/builderpattern/meal.h @@ -0,0 +1,37 @@ +#include "foodinterface.h" +#include + +class Meal +{ +public: + Meal() + { + vec.reserve(255); + } + void addFoodToVector(Food * food) + { + vec.push_back(food); + } + float getCost() + { + float ret = 0.0; + for(auto &food: vec) + { + ret += food->getPrice(); + } + return ret; + } + void showFoods() + { + for(auto &food: vec) + { + cout << "--------------------------" << endl; + cout << food->getName() << endl; + cout << food->getPack()->pack() << endl; + cout << food->getPrice() << endl; + } + } + +public: + std::vector vec; +}; diff --git a/builderpattern/packinterface.h b/builderpattern/packinterface.h new file mode 100644 index 0000000..84bb296 --- /dev/null +++ b/builderpattern/packinterface.h @@ -0,0 +1,28 @@ +#include +using namespace std; + +class Packing +{ +public: + Packing(){} + virtual ~Packing(){} + virtual string pack() = 0; +}; + +class Wrapper: public Packing +{ +public: + string pack() + { + return "Wrapper"; + } +}; + +class Bottle: public Packing +{ +public: + string pack() + { + return "Bottle"; + } +}; diff --git a/chainofresponsibilitypattern/chainofresponsibilitypattern.pri b/chainofresponsibilitypattern/chainofresponsibilitypattern.pri new file mode 100644 index 0000000..42a791a --- /dev/null +++ b/chainofresponsibilitypattern/chainofresponsibilitypattern.pri @@ -0,0 +1,2 @@ +HEADERS += \ + $$PWD/interface.h diff --git a/chainofresponsibilitypattern/interface.h b/chainofresponsibilitypattern/interface.h new file mode 100644 index 0000000..ebf63c0 --- /dev/null +++ b/chainofresponsibilitypattern/interface.h @@ -0,0 +1,81 @@ +#include +#include +#include +using namespace std; + +class AbstractLogger +{ +public: + static const int INFO = 1; + static const int DEBUG = 2; + static const int ERROR = 3; + AbstractLogger() + { + nextLogger = nullptr; + } + virtual ~AbstractLogger(){} + void setNextLogger(AbstractLogger *next) + { + nextLogger = next; + } + void logMessage(int level, string message) + { + if(this->level <= level) + { + write(message); + } + else + { + assert(nextLogger != nullptr); + nextLogger->write(message); + } + } + virtual void write(string message) = 0; + +protected: + int level; + AbstractLogger *nextLogger; +}; + +class ConsoleLogger: public AbstractLogger +{ +public: + ConsoleLogger(int level) + { + this->level = level; + cout << "init ConsoleLogger" << endl; + } + void write(string message) + { + cout << "Standard Console::Logger: " + message << endl; + } + +}; + +class ErrorLogger: public AbstractLogger +{ +public: + ErrorLogger(int level) + { + this->level = level; + cout << "init ErrorLogger" << endl; + } + void write(string message) + { + cout << "Error Console::Logger: " + message << endl; + } +}; + +class FileLogger: public AbstractLogger +{ +public: + FileLogger(int level) + { + this->level = level; + cout << "init FileLogger" << endl; + } + void write(string message) + { + cout << "File::Logger: " + message << endl; + } +}; diff --git a/commandpattern/broker.h b/commandpattern/broker.h new file mode 100644 index 0000000..b19760e --- /dev/null +++ b/commandpattern/broker.h @@ -0,0 +1,22 @@ +#include +#include "interface.h" + +class Broker +{ +public: + void addOrder(Order *order) + { + vector.push_back(order); + } + void executeAllOrder() + { + for(auto it : vector) + { + it->execute(); + } + vector.clear(); + } + +private: + std::vector vector; +}; diff --git a/commandpattern/commandpattern.pri b/commandpattern/commandpattern.pri new file mode 100644 index 0000000..9334d90 --- /dev/null +++ b/commandpattern/commandpattern.pri @@ -0,0 +1,4 @@ +HEADERS += \ + $$PWD/stock.h \ + $$PWD/interface.h \ + $$PWD/broker.h diff --git a/commandpattern/interface.h b/commandpattern/interface.h new file mode 100644 index 0000000..d0a0fcc --- /dev/null +++ b/commandpattern/interface.h @@ -0,0 +1,34 @@ +#include "stock.h" + +class Order +{ +public: + Order(){} + virtual ~Order(){} + virtual void execute() = 0; +}; + +class BuyStock: public Order +{ +public: + BuyStock(Stock *stock) : stock(stock){} + void execute() + { + stock->buy(); + } +private: + Stock *stock; +}; + +class SellStock: public Order +{ +public: + SellStock(Stock *stock) : stock(stock){} + void execute() + { + stock->sell(); + } + +private: + Stock *stock; +}; diff --git a/commandpattern/stock.h b/commandpattern/stock.h new file mode 100644 index 0000000..099345e --- /dev/null +++ b/commandpattern/stock.h @@ -0,0 +1,20 @@ +#include +#include +using namespace std; + +class Stock +{ +public: + void buy() + { + cout << "Stock [ Name: " + name + ", Quantity: " + std::to_string(quantity) + " ] bought" << endl; + } + void sell() + { + cout << "Stock [ Name: " + name + ", Quantity: " + std::to_string(quantity) + " ] sold" << endl; + } + +private: + string name = "test"; + int quantity = 10; +}; diff --git a/compositepattern/compositepattern.pri b/compositepattern/compositepattern.pri new file mode 100644 index 0000000..51eaa5f --- /dev/null +++ b/compositepattern/compositepattern.pri @@ -0,0 +1,2 @@ +HEADERS += \ + $$PWD/employee.h diff --git a/compositepattern/employee.h b/compositepattern/employee.h new file mode 100644 index 0000000..c216ac3 --- /dev/null +++ b/compositepattern/employee.h @@ -0,0 +1,35 @@ +#include +#include +#include +using namespace std; + +class Employee +{ +public: + Employee(string name, string department, int salary) + { + this->name = name; + this->department = department; + this->salary = salary; + cout << "Employee name: " + name << ", department: " + department << ", salary: " << salary << endl; + } + void add(Employee *employee) + { + vector.push_back(employee); + } + std::vector getVector() + { + return this->vector; + } + string getDetails() + { + string ret = "Employee name: " + name + ", department: " + department + ", salary: " + std::to_string(salary); + return ret; + } + +private: + string name; + string department; + int salary; + std::vector vector; +}; diff --git a/decoratorpattern/decoratorpattern.pri b/decoratorpattern/decoratorpattern.pri new file mode 100644 index 0000000..be78595 --- /dev/null +++ b/decoratorpattern/decoratorpattern.pri @@ -0,0 +1,3 @@ +HEADERS += \ + $$PWD/first_interface.h \ + $$PWD/second_interface.h diff --git a/decoratorpattern/first_interface.h b/decoratorpattern/first_interface.h new file mode 100644 index 0000000..154a990 --- /dev/null +++ b/decoratorpattern/first_interface.h @@ -0,0 +1,28 @@ +#include +using namespace std; + +class Shape +{ +public: + Shape(){} + virtual ~Shape(){} + virtual void draw() = 0; +}; + +class Rectangle: public Shape +{ +public: + void draw() + { + cout << "draw Rectangle" << endl; + } +}; + +class Circle: public Shape +{ +public: + void draw() + { + cout << "draw Circle" << endl; + } +}; diff --git a/decoratorpattern/second_interface.h b/decoratorpattern/second_interface.h new file mode 100644 index 0000000..4a9172c --- /dev/null +++ b/decoratorpattern/second_interface.h @@ -0,0 +1,33 @@ +#include "first_interface.h" + +class ShapeDecorator +{ +public: + ShapeDecorator(Shape *shape) + { + this->shape = shape; + } + virtual ~ShapeDecorator(){} + virtual void draw() + { + shape->draw(); + } + +protected: + Shape *shape; +}; + +class RedShapeDecorator: public ShapeDecorator +{ +public: + RedShapeDecorator(Shape *shape) : ShapeDecorator(shape){} + void setRedBorder() + { + cout << "Border color: Red" << endl; + } + void draw() + { + shape->draw(); + setRedBorder(); + } +}; diff --git a/facadepattern/facadepattern.pri b/facadepattern/facadepattern.pri new file mode 100644 index 0000000..0208e86 --- /dev/null +++ b/facadepattern/facadepattern.pri @@ -0,0 +1,3 @@ +HEADERS += \ + $$PWD/interface.h \ + $$PWD/shapemaker.h diff --git a/facadepattern/interface.h b/facadepattern/interface.h new file mode 100644 index 0000000..ae647a7 --- /dev/null +++ b/facadepattern/interface.h @@ -0,0 +1,37 @@ +#include +using namespace std; + +class Shape +{ +public: + Shape(){} + virtual ~Shape(){} + virtual void draw() = 0; +}; + +class Square: public Shape +{ +public: + void draw() + { + cout << "draw Square" << endl; + } +}; + +class Circle: public Shape +{ +public: + void draw() + { + cout << "draw Circle" << endl; + } +}; + +class Rectangle: public Shape +{ +public: + void draw() + { + cout << "draw Rectangle" << endl; + } +}; diff --git a/facadepattern/shapemaker.h b/facadepattern/shapemaker.h new file mode 100644 index 0000000..0ea90d8 --- /dev/null +++ b/facadepattern/shapemaker.h @@ -0,0 +1,29 @@ +#include "interface.h" + +class ShapeMaker +{ +public: + ShapeMaker() + { + this->circle = new Circle(); + this->square = new Square(); + this->rectangle = new Rectangle(); + } + void drawCircle() + { + circle->draw(); + } + void drawSquare() + { + square->draw(); + } + void drawRectangle() + { + rectangle->draw(); + } + +private: + Shape *circle; + Shape *square; + Shape *rectangle; +}; diff --git a/factorypattern/factorypattern.pri b/factorypattern/factorypattern.pri new file mode 100644 index 0000000..a946f12 --- /dev/null +++ b/factorypattern/factorypattern.pri @@ -0,0 +1,3 @@ +HEADERS += \ + $$PWD/interface.h \ + $$PWD/shapefactory.h diff --git a/factorypattern/interface.h b/factorypattern/interface.h new file mode 100644 index 0000000..640a32c --- /dev/null +++ b/factorypattern/interface.h @@ -0,0 +1,52 @@ +#include +using namespace std; + +class Shape +{ +public: + Shape() + { + cout << "create Shape" << endl; + } + virtual ~Shape(){} + virtual void draw() = 0; +}; + +class Circle : public Shape +{ +public: + Circle() + { + cout << "create Circle" << endl; + } + void draw() + { + cout << "draw Circle" << endl; + } +}; + +class Square: public Shape +{ +public: + Square() + { + cout << "create Square" << endl; + } + void draw() + { + cout << "draw Square" << endl; + } +}; + +class Rectangle: public Shape +{ +public: + Rectangle() + { + cout << "create Rectangle" << endl; + } + void draw() + { + cout << "draw Rectangle" << endl; + } +}; diff --git a/factorypattern/shapefactory.h b/factorypattern/shapefactory.h new file mode 100644 index 0000000..1df9022 --- /dev/null +++ b/factorypattern/shapefactory.h @@ -0,0 +1,26 @@ +#include "interface.h" + +class ShapeFactory +{ +public: + ShapeFactory(){} + Shape* getShape(string type) + { + if (type.compare("Circle") == 0) + { + return new Circle(); + } + else if (type.compare("Square") == 0) + { + return new Square(); + } + else if (type.compare("Rectangle") == 0) + { + return new Rectangle(); + } + else + { + return nullptr; + } + } +}; diff --git a/flyweightpattern/flyweightpattern.pri b/flyweightpattern/flyweightpattern.pri new file mode 100644 index 0000000..a946f12 --- /dev/null +++ b/flyweightpattern/flyweightpattern.pri @@ -0,0 +1,3 @@ +HEADERS += \ + $$PWD/interface.h \ + $$PWD/shapefactory.h diff --git a/flyweightpattern/interface.h b/flyweightpattern/interface.h new file mode 100644 index 0000000..4d5a207 --- /dev/null +++ b/flyweightpattern/interface.h @@ -0,0 +1,42 @@ +#include +#include +using namespace std; + +class Shape +{ +public: + Shape(){} + virtual ~Shape(){} + virtual void draw() = 0; +}; + +class Circle : public Shape +{ +public: + Circle(string color) : color(color){} + void setX(int x) + { + this->x = x; + cout << "set x success" << endl; + } + void setY(int y) + { + this->y = y; + cout << "set y success" << endl; + } + void setRadius(int radius) + { + this->radius = radius; + cout << "set radius success" << endl; + } + void draw() + { + cout << "draw Circle [color: " + color + ", x: " + std::to_string(x) + ", y: " + std::to_string(y) + ", radius: " + std::to_string(radius) + "]" << endl << endl; + } + +private: + int x; + int y; + int radius; + string color; +}; diff --git a/flyweightpattern/shapefactory.h b/flyweightpattern/shapefactory.h new file mode 100644 index 0000000..9c4cc9d --- /dev/null +++ b/flyweightpattern/shapefactory.h @@ -0,0 +1,23 @@ +#include "interface.h" +#include + +class ShapeFactory +{ +public: + std::map map; + auto getCircle(string color)->Shape* + { + auto iter = map.find(color); + if (iter != map.end()) + { + return iter->second; + } + else + { + Shape *circle = new Circle(color); + map.insert(std::make_pair(color, circle)); + cout << "Creating circle of color : " + color << endl; + return circle; + } + } +}; diff --git a/interpreterpattern/interface.h b/interpreterpattern/interface.h new file mode 100644 index 0000000..790af5c --- /dev/null +++ b/interpreterpattern/interface.h @@ -0,0 +1,65 @@ +#include +#include +using namespace std; + +class Expression +{ +public: + Expression(){} + virtual ~Expression(){} + virtual bool interpret(string context) = 0; +}; + +class TerminalExpression: public Expression +{ +public: + TerminalExpression(string data) : data(data) + { + cout << "init TerminalExpression" << endl; + } + bool interpret(string context) + { + if(context.find(data) != string::npos) + { + return true; + } + return false; + } + +private: + string data; +}; + +class OrExpression: public Expression +{ +public: + OrExpression(Expression *exp1, Expression *exp2) : exp1(exp1), exp2(exp2) + { + cout << "init OrExpression" << endl; + } + bool interpret(string context) + { + return exp1->interpret(context) || exp2->interpret(context); + } + +private: + Expression *exp1 = nullptr; + Expression *exp2 = nullptr; +}; + +class AndExpression: public Expression +{ +public: + AndExpression(Expression *exp1, Expression *exp2) : exp1(exp1), exp2(exp2) + { + cout << "init AndExpression" << endl; + } + bool interpret(string context) + { + return exp1->interpret(context) && exp2->interpret(context); + } + +private: + Expression *exp1 = nullptr; + Expression *exp2 = nullptr; +}; diff --git a/interpreterpattern/interpreterpattern.pri b/interpreterpattern/interpreterpattern.pri new file mode 100644 index 0000000..42a791a --- /dev/null +++ b/interpreterpattern/interpreterpattern.pri @@ -0,0 +1,2 @@ +HEADERS += \ + $$PWD/interface.h diff --git a/iteratorpattern/interface.h b/iteratorpattern/interface.h new file mode 100644 index 0000000..2757852 --- /dev/null +++ b/iteratorpattern/interface.h @@ -0,0 +1,61 @@ +#include +#include +#include +using namespace std; + +class Iterator +{ +public: + Iterator(){} + virtual ~Iterator(){} + virtual bool hasNext() = 0; + virtual string next() = 0; +}; + +class NameIterator: public Iterator +{ +public: + NameIterator(size_t index, std::vector vector) : index(index), vector(vector){} + bool hasNext() + { + if(index < vector.size() - 1) + { + return true; + } + return false; + } + string next() + { + if(this->hasNext()) + { + return vector.at(index++); + } + return nullptr; + } + +private: + size_t index; + std::vector vector; +}; + +class Container +{ +public: + Container(){} + virtual ~Container(){} + virtual Iterator* getIterator() = 0; +}; + +class NameRepository: public Container +{ +public: + NameRepository(size_t index, std::vector vector) : index(index), vector(vector){} + Iterator* getIterator() + { + return new NameIterator(index, vector); + } + +private: + size_t index; + std::vector vector; +}; diff --git a/iteratorpattern/iteratorpattern.pri b/iteratorpattern/iteratorpattern.pri new file mode 100644 index 0000000..42a791a --- /dev/null +++ b/iteratorpattern/iteratorpattern.pri @@ -0,0 +1,2 @@ +HEADERS += \ + $$PWD/interface.h diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..7f876d8 --- /dev/null +++ b/main.cpp @@ -0,0 +1,331 @@ +//#include "factorypattern/shapefactory.h" +//#include "proxypattern/interface.h" +//#include "templatepattern/interface.h" +//#include "strategypattern/context.h" +//#include "flyweightpattern/shapefactory.h" +//#include "visitorpattern/son.h" +//#include "mediatorpattern/usr.h" +//#include "observerpattern/subject.h" +//#include "statepattern/interface.h" +//#include "commandpattern/broker.h" +//#include "decoratorpattern/second_interface.h" +//#include "bridgepattern/second_interface.h" +//#include "iteratorpattern/interface.h" +//#include "compositepattern/employee.h" +//#include "facadepattern/shapemaker.h" +//#include "adapterpattern/second_interface.h" +//#include "abstractfactorypattern/factoryproducer.h" +//#include "builderpattern/meakbuilder.h" +//#include "prototypepattern/interface.h" +//#include "interpreterpattern/interface.h" +#include "chainofresponsibilitypattern/interface.h" +#include "mementopattern/originator.h" +#include "mementopattern/caretaker.h" + +int main() +{ + //工厂模式 + /* + ShapeFactory shapeFactory; + Circle *circle = static_cast(shapeFactory.getShape("Circle")); + circle->draw(); + cout << endl; + Square *square = static_cast(shapeFactory.getShape("Square")); + square->draw(); + cout << endl; + Rectangle *rectangle = static_cast(shapeFactory.getShape("Rectangle")); + rectangle->draw(); + */ + //代理模式 + /* + Image *image = new ProxyImage("maoye.jpg"); + image->display(); + */ + //模板模式 + /* + Game *game = new Cricket(); + game->play(); + cout << endl; + game = new Football(); + game->play(); + */ + //策略模式 + /* + Strategy *operationAdd = new OperationAdd(); + Strategy *operationSubstract = new OperationSubstract(); + Strategy *operationMultiply = new OperationMultiply(); + Context *context = new Context(operationAdd); + cout << "10 + 5 = " << context->executeStrategy(10, 5) << endl; + context = new Context(operationSubstract); + cout << "10 - 5 = " << context->executeStrategy(10, 5) << endl; + context = new Context(operationMultiply); + cout << "10 * 5 = " << context->executeStrategy(10, 5) << endl; + */ + //享元模式 + /* + ShapeFactory shapeFactory; + string array[] = { "Red", "Blue", "Red", "Yellow", "Blue" }; + for (auto color : array) + { + int x = rand() % 100; + int y = rand() % 100; + int radius = rand() % 100; + Circle *circle = static_cast(shapeFactory.getCircle(color)); + circle->setX(x); + circle->setY(y); + circle->setRadius(radius); + circle->draw(); + } + */ + //访问者模式 + /* + ComputerPartDisplayVisitor *cp = new ComputerPartDisplayVisitor(); + ComputerPart *computer = new Computer(); + ComputerPart *mouse = new Mouse(); + ComputerPart *keyboard = new Keyboard(); + ComputerPart *monitor = new Monitor(); + computer->accept(cp); + cout << endl; + mouse->accept(cp); + keyboard->accept(cp); + monitor->accept(cp); + */ + //中介者模式 + /* + User *user1 = new User("Billy"); + User *user2 = new User("Kitty"); + User *user3 = new User("Alice"); + cout << endl; + user1->showMessage("hello"); + user2->showMessage("world"); + user3->showMessage("!"); + */ + //观察者模式 + /* + Subject *subject = new Subject(10); + Observer *binaryObserver = new BinaryObserver(); + Observer *octalObserver = new OctalObserver(); + Observer *hexaObserver = new HexaObserver(); + subject->attach(binaryObserver); + subject->attach(octalObserver); + subject->attach(hexaObserver); + cout << subject->getState() << endl; + subject->setState(20); + cout << subject->getState() << endl; + */ + //状态模式 + /* + Context *context = new Context(); + State *startState = new StartState(); + startState->doAction(context); + cout << context->getState()->getString() << endl; + State *stopState = new StopState(); + stopState->doAction(context); + cout << context->getState()->getString() << endl; + */ + //命令模式 + /* + Stock *stock = new Stock(); + Order * buyStock = new BuyStock(stock); + Order * sellStock = new SellStock(stock); + Broker * broker = new Broker(); + broker->addOrder(buyStock); + broker->addOrder(sellStock); + broker->executeAllOrder(); + */ + //装饰模式 + /* + Shape *circle = new Circle(); + ShapeDecorator *redCircle = new RedShapeDecorator(new Circle()); + ShapeDecorator *redRectangle = new RedShapeDecorator(new Rectangle()); + circle->draw(); + cout << endl; + redCircle->draw(); + cout << endl; + redRectangle->draw(); + */ + //桥接模式 + /* + DrawApi *redDrawApi = new RedCircle(); + DrawApi *greenDrawApi = new GreenCircle(); + Shape *redCircle = new Circle(100, 10, 10, redDrawApi); + Shape *greenCircle = new Circle(100, 10, 10, greenDrawApi); + redCircle->draw(); + greenCircle->draw(); + */ + //迭代器模式 + /* + std::vector vector; + vector.push_back("Billy"); + vector.push_back("Alice"); + vector.push_back("Kitty"); + vector.push_back("Ben"); + vector.push_back("Jason"); + vector.push_back("Jack"); + vector.push_back("Miss"); + NameRepository *nameRepository = new NameRepository(0, vector); + for(Iterator *iterator = nameRepository->getIterator(); iterator->hasNext();) + { + cout << iterator->next() << endl; + } + */ + //组合模式 + /* + Employee *CEO = new Employee("Billy", "CEO", 50000); + Employee *vice_president = new Employee("Killy", "vice_president", 40000); + Employee *lead_engineer = new Employee("Ben", "lead_engineer", 40000); + Employee *marketing_manager1 = new Employee("Jason", "marketing_manager1", 30000); + Employee *marketing_manager2 = new Employee("Jon", "marketing_manager2", 30000); + Employee *artisan1 = new Employee("Alice", "artisan1", 10000); + Employee *artisan2 = new Employee("Sam", "artisan2", 10000); + CEO->add(vice_president); + CEO->add(lead_engineer); + vice_president->add(marketing_manager1); + vice_president->add(marketing_manager2); + lead_engineer->add(artisan1); + lead_engineer->add(artisan2); + cout << endl << "CEO: " << CEO->getDetails() << endl; + for (auto employee : CEO->getVector()) + { + cout << endl << "Leader: " << employee->getDetails() << endl; + cout << "Employee: " << endl; + for (auto e : employee->getVector()) + { + cout << e->getDetails() << endl; + } + } + */ + //外观模式 + /* + ShapeMaker shapeMaker; + shapeMaker.drawCircle(); + shapeMaker.drawSquare(); + shapeMaker.drawRectangle(); + */ + //适配器模式 + /* + AudioPlayer *audioPlayer = new AudioPlayer(); + audioPlayer->play("mp3", "beyond the horizon.mp3"); + audioPlayer->play("mp4", "alone.mp4"); + audioPlayer->play("vlc", "far far away.vlc"); + audioPlayer->play("avi", "mind me.avi"); + */ + //抽象工厂模式 + /* + FactoryProducer factoryProducer; + AbstractFactory * shapeFactory = factoryProducer.getFactory("ShapeFactory"); + AbstractFactory * colorFactory = factoryProducer.getFactory("ColorFactory"); + cout << endl; + Shape * circle = shapeFactory->getShape("Circle"); + circle->draw(); + cout << endl; + Shape * square = shapeFactory->getShape("Square"); + square->draw(); + cout << endl; + Shape * rectangle = shapeFactory->getShape("Rectangle"); + rectangle->draw(); + cout << endl; + Color * red = colorFactory->getColor("Red"); + red->fill(); + cout << endl; + Color * green = colorFactory->getColor("Green"); + green->fill(); + cout << endl; + Color * blue = colorFactory->getColor("Blue"); + blue->fill(); + */ + //建造者模式 + /* + MealBuilder * mealBuilder = new MealBuilder(); + Meal * vegMeal = mealBuilder->prepareVegMeal(); + cout << "Veg Meal" << endl; + vegMeal->showFoods(); + cout << "Total Cost: " << vegMeal->getCost() << endl; + Meal * nonVegMeal = mealBuilder->prepareNonVegMeal(); + cout << "\n\nNon-Veg Meal" << endl; + nonVegMeal->showFoods(); + cout << "Total Cost: " << nonVegMeal->getCost() << endl; + */ + //原型模式 + /* + Shape *circle1 = new Circle("circle"); + circle1->test(); + cout << endl; + Shape *circle2 = circle1->clone(); + circle2->test(); + cout << endl; + if (circle1 == circle2) + { + cout << "same" << endl; + } + else + { + cout << "different" << endl; + } + */ + //解析器模式 + /* + Expression *robert = new TerminalExpression("Robert"); + Expression *john = new TerminalExpression("John"); + Expression *isMale = new OrExpression(robert, john); + Expression *julie = new TerminalExpression("Julie"); + Expression *married = new TerminalExpression("Married"); + Expression *isMarriedWoman = new AndExpression(julie, married); + string ret1 = isMale->interpret("John") ? "true" : "false"; + string ret2 = isMarriedWoman->interpret("Married Julie") ? "true" : "false"; + cout << endl; + cout << "John is male? " + ret1 << endl; + cout << "Julie is a married women? " + ret2 << endl; + */ + //责任链模式 + + AbstractLogger *errorLogger = new ErrorLogger(AbstractLogger::ERROR); + AbstractLogger *fileLogger = new FileLogger(AbstractLogger::DEBUG); + AbstractLogger *consoleLogger = new ConsoleLogger(AbstractLogger::INFO); + cout << endl; + errorLogger->setNextLogger(fileLogger); + fileLogger->setNextLogger(consoleLogger); + errorLogger->logMessage(AbstractLogger::INFO, "This is an information"); + errorLogger->logMessage(AbstractLogger::DEBUG, "This is an debug level information"); + errorLogger->logMessage(AbstractLogger::ERROR, "This is an error information"); + cout << endl; + fileLogger->logMessage(AbstractLogger::INFO, "This is an information"); + fileLogger->logMessage(AbstractLogger::DEBUG, "This is an debug level information"); + fileLogger->logMessage(AbstractLogger::ERROR, "This is an error information"); + + //备忘录模式 + /* + Originator *originator = new Originator(); + Caretaker *caretaker = new Caretaker(); + originator->setState("state #1"); + caretaker->add(originator->saveStateToMemento()); + originator->setState("state #2"); + caretaker->add(originator->saveStateToMemento()); + originator->setState("state #3"); + caretaker->add(originator->saveStateToMemento()); + originator->setState("state #4"); + caretaker->add(originator->saveStateToMemento()); + originator->setState("state #5"); + caretaker->add(originator->saveStateToMemento()); + cout << endl; + for(size_t i = 0; i < caretaker->getVectorLength(); i++) + { + originator->getStateFromMemento(caretaker->getMemento(i)); + cout << "current state: " + originator->getState() << endl; + } + */ + return 0; +} + + + + + + + + + + + + + diff --git a/mediatorpattern/chatroom.h b/mediatorpattern/chatroom.h new file mode 100644 index 0000000..2207c19 --- /dev/null +++ b/mediatorpattern/chatroom.h @@ -0,0 +1,25 @@ +#include +#include +#include +using namespace std; + +class ChatRoom +{ +public: + void showMessage(string name, string message) + { + time_t setTime; + time(&setTime); + tm* ptm = localtime(&setTime); + std::string time = std::to_string(ptm->tm_year + 1900) + + "/" + + std::to_string(ptm->tm_mon + 1) + + "/" + + std::to_string(ptm->tm_mday) + + " " + + std::to_string(ptm->tm_hour) + ":" + + std::to_string(ptm->tm_min) + ":" + + std::to_string(ptm->tm_sec); + cout << time + " [ " + name + " ] : " + message << endl; + } +}; diff --git a/mediatorpattern/mediatorpattern.pri b/mediatorpattern/mediatorpattern.pri new file mode 100644 index 0000000..222f871 --- /dev/null +++ b/mediatorpattern/mediatorpattern.pri @@ -0,0 +1,3 @@ +HEADERS += \ + $$PWD/chatroom.h \ + $$PWD/usr.h diff --git a/mediatorpattern/usr.h b/mediatorpattern/usr.h new file mode 100644 index 0000000..9ea12fe --- /dev/null +++ b/mediatorpattern/usr.h @@ -0,0 +1,26 @@ +#include "chatroom.h" + +class User +{ +public: + User(string name) : name(name) + { + cout << "init user " + name << endl; + } + string getName() + { + return this->name; + } + void setName(string name) + { + this->name = name; + } + void showMessage(string message) + { + ChatRoom chatRoom; + chatRoom.showMessage(this->name, message); + } + +private: + string name; +}; diff --git a/mementopattern/caretaker.h b/mementopattern/caretaker.h new file mode 100644 index 0000000..295d625 --- /dev/null +++ b/mementopattern/caretaker.h @@ -0,0 +1,22 @@ +#include "memento.h" +#include + +class Caretaker +{ +public: + void add(Memento *memento) + { + vector.push_back(memento); + } + Memento *getMemento(size_t index) + { + return vector.at(index); + } + size_t getVectorLength() + { + return vector.size(); + } + +private: + std::vector vector; +}; diff --git a/mementopattern/memento.h b/mementopattern/memento.h new file mode 100644 index 0000000..88be32c --- /dev/null +++ b/mementopattern/memento.h @@ -0,0 +1,20 @@ +#pragma once +#include +#include +using namespace std; + +class Memento +{ +public: + Memento(string state) : state(state) + { + cout << "init Memento " + state << endl; + } + string getState() + { + return this->state; + } + +private: + string state; +}; diff --git a/mementopattern/mementopattern.pri b/mementopattern/mementopattern.pri new file mode 100644 index 0000000..1cb6f35 --- /dev/null +++ b/mementopattern/mementopattern.pri @@ -0,0 +1,4 @@ +HEADERS += \ + $$PWD/memento.h \ + $$PWD/originator.h \ + $$PWD/caretaker.h diff --git a/mementopattern/originator.h b/mementopattern/originator.h new file mode 100644 index 0000000..826a9a0 --- /dev/null +++ b/mementopattern/originator.h @@ -0,0 +1,25 @@ +#include "memento.h" + +class Originator +{ +public: + void setState(string state) + { + this->state = state; + } + string getState() + { + return this->state; + } + Memento *saveStateToMemento() + { + return new Memento(this->state); + } + void getStateFromMemento(Memento *memento) + { + this->state = memento->getState(); + } + +private: + string state; +}; diff --git a/observerpattern/interface.h b/observerpattern/interface.h new file mode 100644 index 0000000..6a7f425 --- /dev/null +++ b/observerpattern/interface.h @@ -0,0 +1,37 @@ +#include +using namespace std; + +class Observer +{ +public: + Observer(){} + virtual ~Observer(){} + virtual void update() = 0; +}; + +class BinaryObserver: public Observer +{ +public: + void update() + { + cout << "BinaryObserver update" << endl; + } +}; + +class OctalObserver: public Observer +{ +public: + void update() + { + cout << "OctalObserver update" << endl; + } +}; + +class HexaObserver: public Observer +{ +public: + void update() + { + cout << "HexaObserver update" << endl; + } +}; diff --git a/observerpattern/observerpattern.pri b/observerpattern/observerpattern.pri new file mode 100644 index 0000000..f3faecd --- /dev/null +++ b/observerpattern/observerpattern.pri @@ -0,0 +1,3 @@ +HEADERS += \ + $$PWD/interface.h \ + $$PWD/subject.h diff --git a/observerpattern/subject.h b/observerpattern/subject.h new file mode 100644 index 0000000..184bf56 --- /dev/null +++ b/observerpattern/subject.h @@ -0,0 +1,37 @@ +#include +#include "interface.h" + +class Subject +{ +public: + Subject(size_t state) : state(state) {} + size_t getState() + { + return this->state; + } + void setState(size_t state) + { + this->state = state; + notifyAllObservers(); + } + void attach(Observer *observer) + { + vector.push_back(observer); + } + void notifyAllObservers() + { + for(auto itor : vector) + { + itor->update(); + } + } + +private: + std::vector vector; + size_t state; +}; + + + + + diff --git a/prototypepattern/interface.h b/prototypepattern/interface.h new file mode 100644 index 0000000..0bc4bc5 --- /dev/null +++ b/prototypepattern/interface.h @@ -0,0 +1,40 @@ +#include +#include +using namespace std; + +class Shape +{ +public: + Shape() + { + cout << "create Shape" << endl; + } + virtual ~Shape(){} + virtual Shape *clone() = 0; + virtual void test() = 0; +}; + +class Circle: public Shape +{ +public: + Circle(string type) : type(type) + { + cout << "create Circle" << endl; + } + ~Circle(){} + Circle(const Circle& circle) + { + this->type = circle.type; + } + Shape *clone() + { + return new Circle(*this); + } + void test() + { + cout << "type: " << type << endl; + } + +private: + string type; +}; diff --git a/prototypepattern/prototypepattern.pri b/prototypepattern/prototypepattern.pri new file mode 100644 index 0000000..42a791a --- /dev/null +++ b/prototypepattern/prototypepattern.pri @@ -0,0 +1,2 @@ +HEADERS += \ + $$PWD/interface.h diff --git a/proxypattern/interface.h b/proxypattern/interface.h new file mode 100644 index 0000000..59c23f3 --- /dev/null +++ b/proxypattern/interface.h @@ -0,0 +1,52 @@ +#include +#include +using namespace std; + +class Image +{ +public: + Image(){} + virtual ~Image(){} + virtual void display() = 0; +}; + +class RealImage : public Image +{ +public: + RealImage(string fileName) : fileName(fileName) + { + loadFromDisk(fileName); + } + void loadFromDisk(string fileName) + { + cout << "Loading " + fileName << endl; + } + void display() + { + cout << "Displaying " + fileName << endl; + } + +private: + string fileName; +}; + +class ProxyImage : public Image +{ +public: + ProxyImage(string fileName) : fileName(fileName) + { + realImage = nullptr; + } + void display() + { + if (realImage == nullptr) + { + realImage = new RealImage(fileName); + } + realImage->display(); + } + +private: + RealImage *realImage; + string fileName; +}; diff --git a/proxypattern/proxypattern.pri b/proxypattern/proxypattern.pri new file mode 100644 index 0000000..42a791a --- /dev/null +++ b/proxypattern/proxypattern.pri @@ -0,0 +1,2 @@ +HEADERS += \ + $$PWD/interface.h diff --git a/singletonpattern/singletonpattern.h b/singletonpattern/singletonpattern.h new file mode 100644 index 0000000..2759094 --- /dev/null +++ b/singletonpattern/singletonpattern.h @@ -0,0 +1,83 @@ +#include +#include +using namespace std; + +//懒汉式 +/* +class SingleObject +{ +private: + SingleObject() + { + cout << "create SingleObject" << endl; + } + static SingleObject *instance; + +public: + static SingleObject *getInstance() + { + if (instance == nullptr) + { + instance = new SingleObject(); + } + return instance; + } +}; +SingleObject *SingleObject::instance = nullptr; +*/ + +//饿汉式 +/* +class SingleObject +{ +private: + SingleObject() + { + cout << "create SingleObject" << endl; + } + +public: + static SingleObject *getInstance() + { + static SingleObject instance; + return &instance; + } +} +*/ + +//多线程加锁 +class SingleObject +{ +private: + SingleObject() + { + cout << "create SingleObject" << endl; + } + static SingleObject *instance; + static mutex *my_mutext; + +public: + static SingleObject *getInstance() + { + if(instance == nullptr) + { + my_mutext->lock(); + instance = new SingleObject(); + my_mutext->unlock(); + } + return instance; + } + void test() + { + cout << "hello world" << endl; + } +}; + +SingleObject *SingleObject::instance = nullptr; +mutex *SingleObject::my_mutext = new mutex(); + + + + + + diff --git a/singletonpattern/singletonpattern.pri b/singletonpattern/singletonpattern.pri new file mode 100644 index 0000000..1323912 --- /dev/null +++ b/singletonpattern/singletonpattern.pri @@ -0,0 +1,2 @@ +HEADERS += \ + $$PWD/singletonpattern.h diff --git a/statepattern/context.h b/statepattern/context.h new file mode 100644 index 0000000..c4030cc --- /dev/null +++ b/statepattern/context.h @@ -0,0 +1,21 @@ +class State; + +class Context +{ +public: + Context() + { + state = nullptr; + } + void setState(State *state) + { + this->state = state; + } + State*getState() + { + return this->state; + } + +private: + State *state; +}; diff --git a/statepattern/interface.h b/statepattern/interface.h new file mode 100644 index 0000000..cd1d3b8 --- /dev/null +++ b/statepattern/interface.h @@ -0,0 +1,41 @@ +#include "context.h" +#include +#include +using namespace std; + +class State +{ +public: + State(){} + virtual ~State(){} + virtual void doAction(Context *context) = 0; + virtual string getString() = 0; +}; + +class StartState: public State +{ +public: + void doAction(Context *context) + { + cout << "Player is in start state" << endl; + context->setState(this); + } + string getString() + { + return "Start State"; + } +}; + +class StopState: public State +{ +public: + void doAction(Context *context) + { + cout << "Player is in stop state" << endl; + context->setState(this); + } + string getString() + { + return "Stop State"; + } +}; diff --git a/statepattern/statepattern.pri b/statepattern/statepattern.pri new file mode 100644 index 0000000..794eaff --- /dev/null +++ b/statepattern/statepattern.pri @@ -0,0 +1,6 @@ +HEADERS += \ + $$PWD/memento.h \ + $$PWD/originator.h \ + $$PWD/caretaker.h \ + $$PWD/context.h \ + $$PWD/interface.h diff --git a/strategypattern/context.h b/strategypattern/context.h new file mode 100644 index 0000000..4476332 --- /dev/null +++ b/strategypattern/context.h @@ -0,0 +1,14 @@ +#include "interface.h" + +class Context +{ +public: + Context(Strategy *strategy) : strategy(strategy){} + int executeStrategy(int num1, int num2) + { + return strategy->doOperation(num1, num2); + } + +private: + Strategy *strategy; +}; diff --git a/strategypattern/interface.h b/strategypattern/interface.h new file mode 100644 index 0000000..5bb7d9b --- /dev/null +++ b/strategypattern/interface.h @@ -0,0 +1,34 @@ +class Strategy +{ +public: + Strategy(){} + virtual ~Strategy(){} + virtual int doOperation(int num1, int num2) = 0; +}; + +class OperationAdd : public Strategy +{ +public: + int doOperation(int num1, int num2) + { + return num1 + num2; + } +}; + +class OperationSubstract: public Strategy +{ +public: + int doOperation(int num1, int num2) + { + return num1 - num2; + } +}; + +class OperationMultiply: public Strategy +{ +public: + int doOperation(int num1, int num2) + { + return num1 * num2; + } +}; diff --git a/strategypattern/strategypattern.pri b/strategypattern/strategypattern.pri new file mode 100644 index 0000000..e69de29 diff --git a/templatepattern/interface.h b/templatepattern/interface.h new file mode 100644 index 0000000..8c273c2 --- /dev/null +++ b/templatepattern/interface.h @@ -0,0 +1,52 @@ +#include +using namespace std; + +class Game +{ +public: + Game(){} + virtual ~Game(){} + virtual void initialize() = 0; + virtual void startPlay() = 0; + virtual void endPlay() = 0; + virtual void play() final + { + initialize(); + startPlay(); + endPlay(); + } +}; + +class Cricket : public Game +{ +public: + void initialize() + { + cout << "Cricket Game Initialized Start playing" << endl; + } + void startPlay() + { + cout << "Cricket Game Started Enjoy the game" << endl; + } + void endPlay() + { + cout << "Cricket Game Finished" << endl; + } +}; + +class Football : public Game +{ +public: + void initialize() + { + cout << "Football Game Initialized Start playing" << endl; + } + void startPlay() + { + cout << "Football Game Started Enjoy the game" << endl; + } + void endPlay() + { + cout << "Football Game Finished" << endl; + } +}; diff --git a/templatepattern/templatepattern.pri b/templatepattern/templatepattern.pri new file mode 100644 index 0000000..42a791a --- /dev/null +++ b/templatepattern/templatepattern.pri @@ -0,0 +1,2 @@ +HEADERS += \ + $$PWD/interface.h diff --git a/visitorpattern/father.h b/visitorpattern/father.h new file mode 100644 index 0000000..c81f150 --- /dev/null +++ b/visitorpattern/father.h @@ -0,0 +1,26 @@ +#include +using namespace std; +class Computer; +class Mouse; +class Keyboard; +class Monitor; + +class ComputerPartVisitor +{ +public: + ComputerPartVisitor(){} + virtual ~ComputerPartVisitor(){} + virtual void visit(Computer*computer) = 0; + virtual void visit(Mouse *mouse) = 0; + virtual void visit(Keyboard *keyboard) = 0; + virtual void visit(Monitor *monitor) = 0; +}; + +class ComputerPart +{ +public: + ComputerPart(){} + virtual ~ComputerPart(){} + virtual void accept(ComputerPartVisitor *computerPartVisitor) = 0; + virtual string getString() = 0; +}; diff --git a/visitorpattern/son.h b/visitorpattern/son.h new file mode 100644 index 0000000..292de85 --- /dev/null +++ b/visitorpattern/son.h @@ -0,0 +1,92 @@ +#include "father.h" +#include +#include + +class Keyboard : public ComputerPart +{ +public: + void accept(ComputerPartVisitor *computerPartVisitor) + { + computerPartVisitor->visit(this); + } + string getString() + { + return "Displaying Keyboard"; + } +}; + +class Monitor: public ComputerPart +{ +public: + void accept(ComputerPartVisitor *computerPartVisitor) + { + computerPartVisitor->visit(this); + } + string getString() + { + return "Displaying Monitor"; + } +}; + +class Mouse: public ComputerPart +{ +public: + void accept(ComputerPartVisitor *computerPartVisitor) + { + computerPartVisitor->visit(this); + } + string getString() + { + return "Displaying Mouse"; + } +}; + +class Computer: public ComputerPart +{ +public: + Computer() + { + ComputerPart *keyboard = new Keyboard(); + ComputerPart *monitor = new Monitor(); + ComputerPart *mouse = new Mouse(); + vector.push_back(keyboard); + vector.push_back(monitor); + vector.push_back(mouse); + } + void accept(ComputerPartVisitor *computerPartVisitor) + { + for(size_t i = 0; i < vector.size(); i++) + { + vector.at(i)->accept(computerPartVisitor); + } + computerPartVisitor->visit(this); + } + string getString() + { + return "Displaying Computer"; + } + +private: + std::vector vector; +}; + +class ComputerPartDisplayVisitor: public ComputerPartVisitor +{ +public: + void visit(Computer *computer) + { + cout << computer->getString() << endl; + } + void visit(Mouse *mouse) + { + cout << mouse->getString() << endl; + } + void visit(Keyboard *keyboard) + { + cout << keyboard->getString() << endl; + } + void visit(Monitor *monitor) + { + cout << monitor->getString() << endl; + } +}; diff --git a/visitorpattern/visitorpattern.pri b/visitorpattern/visitorpattern.pri new file mode 100644 index 0000000..9800000 --- /dev/null +++ b/visitorpattern/visitorpattern.pri @@ -0,0 +1,3 @@ +HEADERS += \ + $$PWD/father.h \ + $$PWD/son.h