├── Proxy ├── Proxy.jpg ├── obj │ └── Debug │ │ ├── main.o │ │ └── Proxy.o ├── bin │ └── Debug │ │ └── Proxy.exe ├── main.cpp ├── Proxy.depend ├── Proxy.h ├── Proxy.cpp └── Proxy.cbp ├── State ├── State.jpg ├── obj │ └── Debug │ │ ├── main.o │ │ ├── Context.o │ │ └── State.o ├── bin │ └── Debug │ │ └── State.exe ├── Context.cpp ├── main.cpp ├── Context.h ├── State.depend ├── State.h ├── State.cpp ├── State.layout └── State.cbp ├── Bridge ├── Bridge.jpg ├── obj │ └── Debug │ │ ├── Color.o │ │ ├── Shape.o │ │ └── main.o ├── bin │ └── Debug │ │ └── Bridge.exe ├── Bridge.depend ├── Color.h ├── Color.cpp ├── Bridge.cbp ├── Shape.h ├── main.cpp └── Shape.cpp ├── Facade ├── Facade.jpg ├── obj │ └── Debug │ │ ├── Facade.o │ │ └── main.o ├── bin │ └── Debug │ │ └── Facade.exe ├── main.cpp ├── Facade.depend ├── Facade.h ├── Facade.cpp └── Facade.cbp ├── Builder ├── Builder.jpg ├── obj │ └── Debug │ │ ├── main.o │ │ ├── Builder.o │ │ └── Director.o ├── bin │ └── Debug │ │ └── Builder.exe ├── Director.h ├── main.cpp ├── Director.cpp ├── Builder.depend ├── Builder.layout ├── Builder.h ├── Builder.cbp └── Builder.cpp ├── Command ├── Command.jpg ├── obj │ └── Debug │ │ ├── main.o │ │ ├── Command.o │ │ ├── Receiver.o │ │ └── ComputerFactory.o ├── bin │ └── Debug │ │ └── Command.exe ├── Command.layout ├── ComputerFactory.h ├── ComputerFactory.cpp ├── main.cpp ├── Receiver.h ├── Command.cpp ├── Receiver.cpp ├── Command.depend ├── Command.h └── Command.cbp ├── Memento ├── Memento.jpg ├── obj │ └── Debug │ │ └── main.o ├── bin │ └── Debug │ │ └── Memento.exe ├── Memento.cbp ├── main.cpp └── Memento.uml ├── Visitor ├── Visitor.jpg ├── obj │ └── Debug │ │ ├── main.o │ │ ├── Element.o │ │ ├── Visitor.o │ │ └── BlogList.o ├── bin │ └── Debug │ │ └── Visitor.exe ├── BlogList.h ├── main.cpp ├── Visitor.h ├── BlogList.cpp ├── Element.cpp ├── Visitor.cpp ├── Element.h ├── Visitor.depend └── Visitor.cbp ├── Iterator ├── Iterator.jpg ├── obj │ └── Debug │ │ ├── main.o │ │ ├── Container.o │ │ └── Iterator.o ├── bin │ └── Debug │ │ └── Iterator.exe ├── main.cpp ├── Iterator.depend ├── Iterator.cpp ├── Container.cpp ├── Iterator.h ├── Container.h └── Iterator.cbp ├── Mediator ├── Mediator.jpg ├── obj │ └── Debug │ │ ├── User.o │ │ ├── main.o │ │ └── Mediator.o ├── bin │ └── Debug │ │ └── Mediator.exe ├── main.cpp ├── Mediator.depend ├── Mediator.cpp ├── Mediator.h ├── User.cpp ├── User.h └── Mediator.cbp ├── Observer ├── Observer.jpg ├── Observer.jpg.png ├── obj │ └── Debug │ │ ├── main.o │ │ ├── Observer.o │ │ └── Subject.o ├── bin │ └── Debug │ │ └── Observer.exe ├── Observer.layout ├── Observer.cpp ├── Observer.depend ├── main.cpp ├── Observer.h ├── Subject.h ├── Subject.cpp └── Observer.cbp ├── Strategy ├── Strategy.jpg ├── obj │ └── Debug │ │ ├── main.o │ │ ├── Context.o │ │ └── Strategy.o ├── bin │ └── Debug │ │ └── Strategy.exe ├── Context.cpp ├── Context.h ├── main.cpp ├── Strategy.cpp ├── Strategy.h ├── Strategy.depend └── Strategy.cbp ├── Template ├── Template.jpg ├── obj │ └── Debug │ │ ├── main.o │ │ └── Template.o ├── bin │ └── Debug │ │ └── Template.exe ├── main.cpp ├── Template.depend ├── Template.h ├── Template.cpp ├── Template.cbp └── Template.uml ├── Composite ├── Compositor.png ├── obj │ └── Debug │ │ ├── main.o │ │ └── Compositor.o ├── bin │ └── Debug │ │ └── Composite.exe ├── Composite.depend ├── main.cpp ├── Compositor.h ├── Composite.cbp └── Compositor.cpp ├── Decorator ├── Decorator.jpg ├── obj │ └── Debug │ │ ├── main.o │ │ └── Decorator.o ├── bin │ └── Debug │ │ └── Decorator.exe ├── main.cpp ├── Decorator.depend ├── Decorator.layout ├── Decorator.h ├── Decorator.cpp └── Decorator.cbp ├── Flyweight ├── Flyweight.jpg ├── obj │ └── Debug │ │ ├── main.o │ │ └── Flyweight.o ├── bin │ └── Debug │ │ └── Flyweight.exe ├── Flyweight.depend ├── main.cpp ├── Flyweight.h ├── Flyweight.cbp └── Flyweight.cpp ├── Prototype ├── Prototype.jpg ├── obj │ └── Debug │ │ ├── main.o │ │ └── Prototype.o ├── bin │ └── Debug │ │ └── Prototype.exe ├── Prototype.depend ├── main.cpp ├── Prototype.layout ├── Prototype.h ├── Prototype.cpp └── Prototype.cbp ├── Interpretor ├── Interpretor.jpg ├── obj │ └── Debug │ │ ├── main.o │ │ ├── Context.o │ │ └── Interpretor.o ├── bin │ └── Debug │ │ └── Interpretor.exe ├── main.cpp ├── Context.cpp ├── Context.h ├── Interpretor.depend ├── Interpretor.h ├── Interpretor.cpp └── Interpretor.cbp ├── Singleton ├── obj │ └── Debug │ │ ├── main.o │ │ └── Singleton.o ├── bin │ └── Debug │ │ └── Singleton.exe ├── Singleton.h ├── main.cpp ├── Singleton.depend ├── Singleton.cpp ├── Singleton.layout └── Singleton.cbp ├── Factory ├── FactoryMethod │ ├── main.exe │ ├── factoryMethod.jpg │ ├── obj │ │ └── Debug │ │ │ ├── main.o │ │ │ ├── Factory.o │ │ │ └── Product.o │ ├── bin │ │ └── Debug │ │ │ └── Factory.exe │ ├── main.cpp │ ├── Product.h │ ├── Factory.h │ ├── Factory.layout │ ├── Product.cpp │ ├── Factory.cpp │ ├── Factory.depend │ └── Factory.cbp ├── AbstracFactory │ ├── obj │ │ └── Debug │ │ │ ├── main.o │ │ │ └── src │ │ │ ├── Factory.o │ │ │ ├── ProductA.o │ │ │ └── ProductB.o │ ├── abstractFactory.jpg │ ├── bin │ │ └── Debug │ │ │ └── AbstracFactory.exe │ ├── main.cpp │ ├── include │ │ ├── ProductB.h │ │ ├── ProductA.h │ │ └── Factory.h │ ├── src │ │ ├── ProductA.cpp │ │ ├── ProductB.cpp │ │ └── Factory.cpp │ ├── AbstracFactory.depend │ ├── AbstracFactory.layout │ └── AbstracFactory.cbp └── SimpleFactory │ ├── obj │ └── Debug │ │ ├── main.o │ │ ├── Factory.o │ │ └── Product.o │ ├── bin │ └── Debug │ │ └── SimpleFactory.exe │ ├── main.cpp │ ├── Factory.h │ ├── Factory.cpp │ ├── Product.h │ ├── SimpleFactory.depend │ ├── Product.cpp │ ├── SimpleFactory.layout │ └── SimpleFactory.cbp ├── Adapter ├── ClassAdapter │ ├── ClassAdapter.jpg │ ├── obj │ │ └── Debug │ │ │ └── main.o │ ├── bin │ │ └── Debug │ │ │ └── ClassAdapter.exe │ ├── ClassAdapter.depend │ ├── ClassAdapter.layout │ ├── main.cpp │ └── ClassAdapter.cbp └── InstanceAdapter │ ├── obj │ └── Debug │ │ └── main.o │ ├── InstanceAdapter.jpg │ ├── bin │ └── Debug │ │ └── InstanceAdapter.exe │ ├── main.cpp │ └── InstanceAdapter.cbp ├── ChainOfResponsibility ├── obj │ └── Debug │ │ ├── main.o │ │ └── Approver.o ├── ChainOfResponsibility.jpg ├── bin │ └── Debug │ │ └── ChainOfResponsibility.exe ├── ChainOfResponsibility.depend ├── main.cpp ├── Approver.h ├── ChainOfResponsibility.cbp └── Approver.cpp └── README.md /Proxy/Proxy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Proxy/Proxy.jpg -------------------------------------------------------------------------------- /State/State.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/State/State.jpg -------------------------------------------------------------------------------- /Bridge/Bridge.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Bridge/Bridge.jpg -------------------------------------------------------------------------------- /Facade/Facade.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Facade/Facade.jpg -------------------------------------------------------------------------------- /Builder/Builder.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Builder/Builder.jpg -------------------------------------------------------------------------------- /Command/Command.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Command/Command.jpg -------------------------------------------------------------------------------- /Memento/Memento.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Memento/Memento.jpg -------------------------------------------------------------------------------- /Visitor/Visitor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Visitor/Visitor.jpg -------------------------------------------------------------------------------- /Iterator/Iterator.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Iterator/Iterator.jpg -------------------------------------------------------------------------------- /Mediator/Mediator.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Mediator/Mediator.jpg -------------------------------------------------------------------------------- /Observer/Observer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Observer/Observer.jpg -------------------------------------------------------------------------------- /Proxy/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Proxy/obj/Debug/main.o -------------------------------------------------------------------------------- /State/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/State/obj/Debug/main.o -------------------------------------------------------------------------------- /Strategy/Strategy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Strategy/Strategy.jpg -------------------------------------------------------------------------------- /Template/Template.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Template/Template.jpg -------------------------------------------------------------------------------- /Bridge/obj/Debug/Color.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Bridge/obj/Debug/Color.o -------------------------------------------------------------------------------- /Bridge/obj/Debug/Shape.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Bridge/obj/Debug/Shape.o -------------------------------------------------------------------------------- /Bridge/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Bridge/obj/Debug/main.o -------------------------------------------------------------------------------- /Builder/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Builder/obj/Debug/main.o -------------------------------------------------------------------------------- /Command/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Command/obj/Debug/main.o -------------------------------------------------------------------------------- /Composite/Compositor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Composite/Compositor.png -------------------------------------------------------------------------------- /Decorator/Decorator.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Decorator/Decorator.jpg -------------------------------------------------------------------------------- /Facade/obj/Debug/Facade.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Facade/obj/Debug/Facade.o -------------------------------------------------------------------------------- /Facade/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Facade/obj/Debug/main.o -------------------------------------------------------------------------------- /Flyweight/Flyweight.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Flyweight/Flyweight.jpg -------------------------------------------------------------------------------- /Iterator/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Iterator/obj/Debug/main.o -------------------------------------------------------------------------------- /Mediator/obj/Debug/User.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Mediator/obj/Debug/User.o -------------------------------------------------------------------------------- /Mediator/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Mediator/obj/Debug/main.o -------------------------------------------------------------------------------- /Memento/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Memento/obj/Debug/main.o -------------------------------------------------------------------------------- /Observer/Observer.jpg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Observer/Observer.jpg.png -------------------------------------------------------------------------------- /Observer/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Observer/obj/Debug/main.o -------------------------------------------------------------------------------- /Prototype/Prototype.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Prototype/Prototype.jpg -------------------------------------------------------------------------------- /Proxy/bin/Debug/Proxy.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Proxy/bin/Debug/Proxy.exe -------------------------------------------------------------------------------- /Proxy/obj/Debug/Proxy.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Proxy/obj/Debug/Proxy.o -------------------------------------------------------------------------------- /State/bin/Debug/State.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/State/bin/Debug/State.exe -------------------------------------------------------------------------------- /State/obj/Debug/Context.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/State/obj/Debug/Context.o -------------------------------------------------------------------------------- /State/obj/Debug/State.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/State/obj/Debug/State.o -------------------------------------------------------------------------------- /Strategy/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Strategy/obj/Debug/main.o -------------------------------------------------------------------------------- /Template/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Template/obj/Debug/main.o -------------------------------------------------------------------------------- /Visitor/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Visitor/obj/Debug/main.o -------------------------------------------------------------------------------- /Bridge/bin/Debug/Bridge.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Bridge/bin/Debug/Bridge.exe -------------------------------------------------------------------------------- /Builder/obj/Debug/Builder.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Builder/obj/Debug/Builder.o -------------------------------------------------------------------------------- /Command/obj/Debug/Command.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Command/obj/Debug/Command.o -------------------------------------------------------------------------------- /Composite/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Composite/obj/Debug/main.o -------------------------------------------------------------------------------- /Decorator/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Decorator/obj/Debug/main.o -------------------------------------------------------------------------------- /Facade/bin/Debug/Facade.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Facade/bin/Debug/Facade.exe -------------------------------------------------------------------------------- /Flyweight/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Flyweight/obj/Debug/main.o -------------------------------------------------------------------------------- /Interpretor/Interpretor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Interpretor/Interpretor.jpg -------------------------------------------------------------------------------- /Prototype/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Prototype/obj/Debug/main.o -------------------------------------------------------------------------------- /Singleton/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Singleton/obj/Debug/main.o -------------------------------------------------------------------------------- /Visitor/obj/Debug/Element.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Visitor/obj/Debug/Element.o -------------------------------------------------------------------------------- /Visitor/obj/Debug/Visitor.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Visitor/obj/Debug/Visitor.o -------------------------------------------------------------------------------- /Builder/bin/Debug/Builder.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Builder/bin/Debug/Builder.exe -------------------------------------------------------------------------------- /Builder/obj/Debug/Director.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Builder/obj/Debug/Director.o -------------------------------------------------------------------------------- /Command/bin/Debug/Command.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Command/bin/Debug/Command.exe -------------------------------------------------------------------------------- /Command/obj/Debug/Receiver.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Command/obj/Debug/Receiver.o -------------------------------------------------------------------------------- /Factory/FactoryMethod/main.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Factory/FactoryMethod/main.exe -------------------------------------------------------------------------------- /Interpretor/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Interpretor/obj/Debug/main.o -------------------------------------------------------------------------------- /Iterator/obj/Debug/Container.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Iterator/obj/Debug/Container.o -------------------------------------------------------------------------------- /Iterator/obj/Debug/Iterator.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Iterator/obj/Debug/Iterator.o -------------------------------------------------------------------------------- /Mediator/obj/Debug/Mediator.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Mediator/obj/Debug/Mediator.o -------------------------------------------------------------------------------- /Memento/bin/Debug/Memento.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Memento/bin/Debug/Memento.exe -------------------------------------------------------------------------------- /Observer/obj/Debug/Observer.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Observer/obj/Debug/Observer.o -------------------------------------------------------------------------------- /Observer/obj/Debug/Subject.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Observer/obj/Debug/Subject.o -------------------------------------------------------------------------------- /Strategy/obj/Debug/Context.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Strategy/obj/Debug/Context.o -------------------------------------------------------------------------------- /Strategy/obj/Debug/Strategy.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Strategy/obj/Debug/Strategy.o -------------------------------------------------------------------------------- /Template/obj/Debug/Template.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Template/obj/Debug/Template.o -------------------------------------------------------------------------------- /Visitor/bin/Debug/Visitor.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Visitor/bin/Debug/Visitor.exe -------------------------------------------------------------------------------- /Visitor/obj/Debug/BlogList.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Visitor/obj/Debug/BlogList.o -------------------------------------------------------------------------------- /Composite/obj/Debug/Compositor.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Composite/obj/Debug/Compositor.o -------------------------------------------------------------------------------- /Decorator/obj/Debug/Decorator.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Decorator/obj/Debug/Decorator.o -------------------------------------------------------------------------------- /Flyweight/obj/Debug/Flyweight.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Flyweight/obj/Debug/Flyweight.o -------------------------------------------------------------------------------- /Interpretor/obj/Debug/Context.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Interpretor/obj/Debug/Context.o -------------------------------------------------------------------------------- /Iterator/bin/Debug/Iterator.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Iterator/bin/Debug/Iterator.exe -------------------------------------------------------------------------------- /Mediator/bin/Debug/Mediator.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Mediator/bin/Debug/Mediator.exe -------------------------------------------------------------------------------- /Observer/bin/Debug/Observer.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Observer/bin/Debug/Observer.exe -------------------------------------------------------------------------------- /Prototype/obj/Debug/Prototype.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Prototype/obj/Debug/Prototype.o -------------------------------------------------------------------------------- /Singleton/obj/Debug/Singleton.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Singleton/obj/Debug/Singleton.o -------------------------------------------------------------------------------- /Strategy/bin/Debug/Strategy.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Strategy/bin/Debug/Strategy.exe -------------------------------------------------------------------------------- /Template/bin/Debug/Template.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Template/bin/Debug/Template.exe -------------------------------------------------------------------------------- /Command/obj/Debug/ComputerFactory.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Command/obj/Debug/ComputerFactory.o -------------------------------------------------------------------------------- /Composite/bin/Debug/Composite.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Composite/bin/Debug/Composite.exe -------------------------------------------------------------------------------- /Decorator/bin/Debug/Decorator.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Decorator/bin/Debug/Decorator.exe -------------------------------------------------------------------------------- /Flyweight/bin/Debug/Flyweight.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Flyweight/bin/Debug/Flyweight.exe -------------------------------------------------------------------------------- /Interpretor/obj/Debug/Interpretor.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Interpretor/obj/Debug/Interpretor.o -------------------------------------------------------------------------------- /Prototype/bin/Debug/Prototype.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Prototype/bin/Debug/Prototype.exe -------------------------------------------------------------------------------- /Singleton/bin/Debug/Singleton.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Singleton/bin/Debug/Singleton.exe -------------------------------------------------------------------------------- /Adapter/ClassAdapter/ClassAdapter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Adapter/ClassAdapter/ClassAdapter.jpg -------------------------------------------------------------------------------- /Adapter/ClassAdapter/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Adapter/ClassAdapter/obj/Debug/main.o -------------------------------------------------------------------------------- /Interpretor/bin/Debug/Interpretor.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Interpretor/bin/Debug/Interpretor.exe -------------------------------------------------------------------------------- /Adapter/InstanceAdapter/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Adapter/InstanceAdapter/obj/Debug/main.o -------------------------------------------------------------------------------- /ChainOfResponsibility/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/ChainOfResponsibility/obj/Debug/main.o -------------------------------------------------------------------------------- /Factory/AbstracFactory/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Factory/AbstracFactory/obj/Debug/main.o -------------------------------------------------------------------------------- /Factory/FactoryMethod/factoryMethod.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Factory/FactoryMethod/factoryMethod.jpg -------------------------------------------------------------------------------- /Factory/FactoryMethod/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Factory/FactoryMethod/obj/Debug/main.o -------------------------------------------------------------------------------- /Factory/SimpleFactory/obj/Debug/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Factory/SimpleFactory/obj/Debug/main.o -------------------------------------------------------------------------------- /ChainOfResponsibility/obj/Debug/Approver.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/ChainOfResponsibility/obj/Debug/Approver.o -------------------------------------------------------------------------------- /Factory/AbstracFactory/abstractFactory.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Factory/AbstracFactory/abstractFactory.jpg -------------------------------------------------------------------------------- /Factory/FactoryMethod/obj/Debug/Factory.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Factory/FactoryMethod/obj/Debug/Factory.o -------------------------------------------------------------------------------- /Factory/FactoryMethod/obj/Debug/Product.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Factory/FactoryMethod/obj/Debug/Product.o -------------------------------------------------------------------------------- /Factory/SimpleFactory/obj/Debug/Factory.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Factory/SimpleFactory/obj/Debug/Factory.o -------------------------------------------------------------------------------- /Factory/SimpleFactory/obj/Debug/Product.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Factory/SimpleFactory/obj/Debug/Product.o -------------------------------------------------------------------------------- /Adapter/InstanceAdapter/InstanceAdapter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Adapter/InstanceAdapter/InstanceAdapter.jpg -------------------------------------------------------------------------------- /Factory/FactoryMethod/bin/Debug/Factory.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Factory/FactoryMethod/bin/Debug/Factory.exe -------------------------------------------------------------------------------- /Adapter/ClassAdapter/bin/Debug/ClassAdapter.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Adapter/ClassAdapter/bin/Debug/ClassAdapter.exe -------------------------------------------------------------------------------- /ChainOfResponsibility/ChainOfResponsibility.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/ChainOfResponsibility/ChainOfResponsibility.jpg -------------------------------------------------------------------------------- /Factory/AbstracFactory/obj/Debug/src/Factory.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Factory/AbstracFactory/obj/Debug/src/Factory.o -------------------------------------------------------------------------------- /Factory/AbstracFactory/obj/Debug/src/ProductA.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Factory/AbstracFactory/obj/Debug/src/ProductA.o -------------------------------------------------------------------------------- /Factory/AbstracFactory/obj/Debug/src/ProductB.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Factory/AbstracFactory/obj/Debug/src/ProductB.o -------------------------------------------------------------------------------- /Factory/SimpleFactory/bin/Debug/SimpleFactory.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Factory/SimpleFactory/bin/Debug/SimpleFactory.exe -------------------------------------------------------------------------------- /Adapter/ClassAdapter/ClassAdapter.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1379073113 source:d:\programing\practice\design pattern\adapter\classadapter\main.cpp 3 | 4 | 5 | -------------------------------------------------------------------------------- /Factory/AbstracFactory/bin/Debug/AbstracFactory.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Factory/AbstracFactory/bin/Debug/AbstracFactory.exe -------------------------------------------------------------------------------- /Adapter/InstanceAdapter/bin/Debug/InstanceAdapter.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/Adapter/InstanceAdapter/bin/Debug/InstanceAdapter.exe -------------------------------------------------------------------------------- /ChainOfResponsibility/bin/Debug/ChainOfResponsibility.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevin-shanghai/23Design_Patterns_CPP_Codeblocks/HEAD/ChainOfResponsibility/bin/Debug/ChainOfResponsibility.exe -------------------------------------------------------------------------------- /Facade/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Facade.h" 3 | 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | Facade* fac = new Facade(); 9 | fac->OperationWrapper(); 10 | 11 | cout << "Hello world!" << endl; 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /Command/Command.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Factory/FactoryMethod/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Factory.h" 3 | #include "Product.h" 4 | 5 | 6 | int main() 7 | { 8 | Factory* factory = new ConcreteFactory(); 9 | factory->CreateProduct1(); 10 | factory->CreateProduct2(); 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /Proxy/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Proxy.h" 3 | 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | SubObject* sub = new SubObject(); 9 | Proxy* pro = new Proxy(sub); 10 | pro->Request(); 11 | cout << "Hello world!" << endl; 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /Adapter/ClassAdapter/ClassAdapter.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Decorator/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Decorator.h" 3 | 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | Animal* pa = new Dog(); 9 | pa->eat(); 10 | 11 | Decorator *p = new ConcreteDecorator(pa); 12 | p->eat(); 13 | 14 | cout << "Hello world!" << endl; 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /Factory/SimpleFactory/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Factory.h" 3 | 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | Factory *fac = new Factory(); 9 | fac->CreateProduct("ProductA"); 10 | fac->CreateProduct("ProductB"); 11 | 12 | cout << "Hello world!" << endl; 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /Template/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Template.h" 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | Template* dog = new Dog(); 8 | Template* cat = new Cat(); 9 | dog->TemplateMethod_Live(); 10 | cat->TemplateMethod_Live(); 11 | 12 | cout << "Hello world!" << endl; 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /Proxy/Proxy.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1379858813 source:d:\programing\practice\design pattern\proxy\main.cpp 3 | 4 | "Proxy.h" 5 | 6 | 1379858857 source:d:\programing\practice\design pattern\proxy\proxy.cpp 7 | "Proxy.h" 8 | 9 | 10 | 1379858869 d:\programing\practice\design pattern\proxy\proxy.h 11 | 12 | -------------------------------------------------------------------------------- /Template/Template.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1189868556 source:d:\programing\practice\design pattern\template\main.cpp 3 | 4 | 5 | 1379943938 source:d:\programing\practice\design pattern\template\template.cpp 6 | "Template.h" 7 | 8 | 9 | 1379943976 d:\programing\practice\design pattern\template\template.h 10 | 11 | -------------------------------------------------------------------------------- /Facade/Facade.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1379599955 source:d:\programing\practice\design pattern\facade\main.cpp 3 | 4 | "Facade.h" 5 | 6 | 1379600021 source:d:\programing\practice\design pattern\facade\facade.cpp 7 | "Facade.h" 8 | 9 | 10 | 1379599955 d:\programing\practice\design pattern\facade\facade.h 11 | 12 | -------------------------------------------------------------------------------- /Singleton/Singleton.h: -------------------------------------------------------------------------------- 1 | #ifndef SINGLETON_H 2 | #define SINGLETON_H 3 | 4 | class Singleton 5 | { 6 | public: 7 | virtual ~Singleton(); 8 | static Singleton* GetInstance(); 9 | 10 | protected: 11 | Singleton(); 12 | 13 | private: 14 | static Singleton* m_Instance; 15 | }; 16 | 17 | 18 | #endif // SINGLETON_H 19 | -------------------------------------------------------------------------------- /Singleton/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Singleton.h" 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | Singleton* instance1 = Singleton::GetInstance(); 8 | Singleton* instance2 = Singleton::GetInstance(); 9 | cout<Handle(this); 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /Command/ComputerFactory.h: -------------------------------------------------------------------------------- 1 | #ifndef COMPUTERFACTORY_H 2 | #define COMPUTERFACTORY_H 3 | 4 | 5 | class ComputerFactory 6 | { 7 | public: 8 | ComputerFactory(); 9 | virtual ~ComputerFactory(); 10 | void CreatePC(); 11 | void CreateLaptop(); 12 | 13 | protected: 14 | private: 15 | }; 16 | 17 | #endif // COMPUTERFACTORY_H 18 | -------------------------------------------------------------------------------- /Strategy/Context.cpp: -------------------------------------------------------------------------------- 1 | #include "Context.h" 2 | #include 3 | using namespace std; 4 | 5 | 6 | Context::Context(Strategy* rhl):m_pStrategy(rhl) 7 | { 8 | 9 | } 10 | 11 | Context::~Context() 12 | { 13 | 14 | } 15 | 16 | void Context::ContextOperation() 17 | { 18 | cout<<"Context::ContextOperation()."<operation(); 20 | } 21 | 22 | -------------------------------------------------------------------------------- /State/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "Context.h" 4 | #include "State.h" 5 | using namespace std; 6 | 7 | int main() 8 | { 9 | StateA* sta = new StateA(); 10 | Context* con = new Context(sta); 11 | con->HandleForState(); 12 | con->HandleForState(); 13 | con->HandleForState(); 14 | con->HandleForState(); 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /Prototype/Prototype.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1378820524 source:d:\programing\practice\design pattern\prototype\main.cpp 3 | 4 | "Prototype.h" 5 | 6 | 1378820476 source:d:\programing\practice\design pattern\prototype\prototype.cpp 7 | "Prototype.h" 8 | 9 | 10 | 1378820476 d:\programing\practice\design pattern\prototype\prototype.h 11 | 12 | -------------------------------------------------------------------------------- /Prototype/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Prototype.h" 3 | 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | Prototype *pro1 = new Prototype1(); 9 | Prototype *pro1_clone = pro1->clone(); 10 | 11 | Prototype *pro2 = new Prototype2(); 12 | Prototype *pro2_clone = pro2->clone(); 13 | 14 | cout << "Hello world!" << endl; 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /Singleton/Singleton.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1378428161 source:d:\programing\practice\design pattern\singleton\main.cpp 3 | 4 | "Singleton.h" 5 | 6 | 1378391689 source:d:\programing\practice\design pattern\singleton\singleton.cpp 7 | 8 | "Singleton.h" 9 | 10 | 1378391689 d:\programing\practice\design pattern\singleton\singleton.h 11 | 12 | -------------------------------------------------------------------------------- /Strategy/Context.h: -------------------------------------------------------------------------------- 1 | #ifndef CONTEXT_H 2 | #define CONTEXT_H 3 | #include "Strategy.h" 4 | 5 | class Strategy; 6 | 7 | class Context 8 | { 9 | public: 10 | Context(Strategy* rhl); 11 | virtual ~Context(); 12 | void ContextOperation(); 13 | 14 | protected: 15 | private: 16 | Strategy* m_pStrategy; 17 | }; 18 | 19 | #endif // CONTEXT_H 20 | -------------------------------------------------------------------------------- /Builder/Director.h: -------------------------------------------------------------------------------- 1 | #ifndef DIRECTOR_H 2 | #define DIRECTOR_H 3 | #include "Builder.h" 4 | //class Builder; 5 | 6 | class Director 7 | { 8 | public: 9 | Director(Builder* bui); 10 | virtual ~Director(); 11 | void CreateObject(); 12 | 13 | 14 | protected: 15 | 16 | private: 17 | Builder* m_pBuilder; 18 | }; 19 | 20 | #endif // DIRECTOR_H 21 | -------------------------------------------------------------------------------- /Builder/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Director.h" 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | PcBuilder pc; 8 | LaptopBuilder lap; 9 | Director directorPC(&pc); 10 | directorPC.CreateObject(); 11 | 12 | Director directorLap(&lap); 13 | directorLap.CreateObject(); 14 | 15 | cout << "Hello world!" << endl; 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /Composite/Composite.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1379300409 source:d:\programing\practice\design pattern\composite\main.cpp 3 | 4 | "Compositor.h" 5 | 6 | 1379300313 source:d:\programing\practice\design pattern\composite\compositor.cpp 7 | "Compositor.h" 8 | 9 | 1379299955 d:\programing\practice\design pattern\composite\compositor.h 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Flyweight/Flyweight.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1379384408 source:d:\programing\practice\design pattern\flyweight\main.cpp 3 | 4 | "Flyweight.h" 5 | 6 | 1379387569 source:d:\programing\practice\design pattern\flyweight\flyweight.cpp 7 | "Flyweight.h" 8 | 9 | 1379383633 d:\programing\practice\design pattern\flyweight\flyweight.h 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Factory/SimpleFactory/Factory.h: -------------------------------------------------------------------------------- 1 | #ifndef FACTORY_H 2 | #define FACTORY_H 3 | #include 4 | 5 | using namespace std; 6 | 7 | class Product; 8 | 9 | class Factory 10 | { 11 | public: 12 | Factory(); 13 | Product* CreateProduct(std::string ProductName); 14 | ~Factory(); 15 | 16 | protected: 17 | 18 | private: 19 | 20 | }; 21 | 22 | #endif // FACTORY_H 23 | -------------------------------------------------------------------------------- /Strategy/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Context.h" 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | Strategy* stra = new StrategyA(); 8 | Context* context1 = new Context(stra); 9 | context1->ContextOperation(); 10 | 11 | stra = new StrategyB(); 12 | Context* context2 = new Context(stra); 13 | 14 | context2->ContextOperation(); 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /State/Context.h: -------------------------------------------------------------------------------- 1 | #ifndef CONTEXT_H 2 | #define CONTEXT_H 3 | #include "State.h" 4 | 5 | class State; 6 | 7 | class Context 8 | { 9 | public: 10 | Context(State* rhl); 11 | virtual ~Context(); 12 | void ChangeState(State* sta); 13 | void HandleForState(); 14 | 15 | protected: 16 | 17 | private: 18 | State* m_pState; 19 | }; 20 | 21 | #endif // CONTEXT_H 22 | -------------------------------------------------------------------------------- /Decorator/Decorator.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1379167653 source:d:\programing\practice\design pattern\adapter\decorator\main.cpp 3 | 4 | "Decorator.h" 5 | 6 | 1379168007 source:d:\programing\practice\design pattern\adapter\decorator\decorator.cpp 7 | "Decorator.h" 8 | 9 | 10 | 1379170136 d:\programing\practice\design pattern\adapter\decorator\decorator.h 11 | 12 | 13 | -------------------------------------------------------------------------------- /Factory/AbstracFactory/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "include/Factory.h" 3 | 4 | 5 | using namespace std; 6 | 7 | int main() 8 | { 9 | Factory *facA = new FactoryA(); 10 | Factory *facB = new FactoryB(); 11 | facA->CreateProductA(); 12 | facA->CreateProductB(); 13 | facB->CreateProductB(); 14 | facB->CreateProductA(); 15 | cout << "Hello world!" << endl; 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /ChainOfResponsibility/ChainOfResponsibility.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1381050687 source:d:\programing\practice\design pattern\chainofresponsibility\main.cpp 3 | 4 | "Approver.h" 5 | 6 | 1381050825 source:d:\programing\practice\design pattern\chainofresponsibility\approver.cpp 7 | "Approver.h" 8 | 9 | 10 | 1381048927 d:\programing\practice\design pattern\chainofresponsibility\approver.h 11 | 12 | -------------------------------------------------------------------------------- /Iterator/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Container.h" 3 | #include "Iterator.h" 4 | 5 | using namespace std; 6 | 7 | int main() 8 | { 9 | Container* container = new ConcreteContainer(5); 10 | Iterator* iter = new ConcreteIterator(container); 11 | for(; iter->end() == false;iter->next()) 12 | { 13 | cout<<"In Container: "<GetCurrentItem()< 2 | #include "Context.h" 3 | #include "Interpretor.h" 4 | 5 | using namespace std; 6 | 7 | int main() 8 | { 9 | Context* con1 = new Context("Hello world."); 10 | AbstractExpression* tinter = new TerminalExpression(); 11 | AbstractExpression* nont = new NonTerminalExpression(); 12 | 13 | tinter->Interpreter(con1); 14 | nont->Interpreter(con1); 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /Singleton/Singleton.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Singleton.h" 3 | 4 | using namespace std; 5 | 6 | Singleton* Singleton::m_Instance = 0; 7 | Singleton::Singleton() 8 | { 9 | cout<<"Singleton::Singleton()."< 3 | using namespace std; 4 | 5 | Strategy::Strategy() 6 | { 7 | //ctor 8 | } 9 | 10 | Strategy::~Strategy() 11 | { 12 | //dtor 13 | } 14 | 15 | void Strategy::operation() 16 | { 17 | 18 | } 19 | 20 | void StrategyA::operation() 21 | { 22 | cout<<"StrategyA::operation()."< 3 | 4 | Director::Director(Builder* bui):m_pBuilder(bui) 5 | { 6 | std::cout<<"Director::Director()."<BuildCPU(); 17 | m_pBuilder->BuildMemory(); 18 | m_pBuilder->BuildDisk(); 19 | m_pBuilder->BuildKey(); 20 | m_pBuilder->BuildMouse(); 21 | } 22 | -------------------------------------------------------------------------------- /Command/ComputerFactory.cpp: -------------------------------------------------------------------------------- 1 | #include "ComputerFactory.h" 2 | #include 3 | using namespace std; 4 | 5 | ComputerFactory::ComputerFactory() 6 | { 7 | //ctor 8 | } 9 | 10 | ComputerFactory::~ComputerFactory() 11 | { 12 | //dtor 13 | } 14 | 15 | void ComputerFactory::CreateLaptop() 16 | { 17 | std::cout<<"Laptop was created."< 4 | #include "Element.h" 5 | 6 | 7 | class BlogList 8 | { 9 | public: 10 | BlogList(); 11 | virtual ~BlogList(); 12 | void AddBlog(Element* blog); 13 | void DeleteBlog(Element* blog); 14 | void StartVisit(Visitor* vis); 15 | 16 | protected: 17 | private: 18 | std::list* m_pBlogList; 19 | }; 20 | 21 | #endif // BLOGLIST_H 22 | -------------------------------------------------------------------------------- /Factory/SimpleFactory/Factory.cpp: -------------------------------------------------------------------------------- 1 | #include "Factory.h" 2 | #include 3 | #include "Product.h" 4 | using namespace std; 5 | 6 | Factory::Factory() 7 | { 8 | //ctor 9 | } 10 | 11 | Factory::~Factory() 12 | { 13 | //dtor 14 | } 15 | 16 | Product* Factory::CreateProduct(std::string ProductName) 17 | { 18 | if(ProductName == "ProductA") 19 | return new ProductA(); 20 | else if(ProductName == "ProductB") 21 | return new ProductB(); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /Mediator/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Mediator.h" 3 | #include "User.h" 4 | 5 | using namespace std; 6 | 7 | int main() 8 | { 9 | ConcreteMediator* med = new ConcreteMediator(); 10 | ConcreteUserA* usrA = new ConcreteUserA(med); 11 | ConcreteUserB* usrB = new ConcreteUserB(med); 12 | 13 | med->SetUserA(usrA); 14 | med->SetUserB(usrB); 15 | usrA->SendMsg("Hello, UserB"); 16 | usrB->SendMsg("Hello, UserA"); 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /Factory/FactoryMethod/Product.h: -------------------------------------------------------------------------------- 1 | #ifndef __PRODUCT_H__ 2 | #define __PRODUCT_H__ 3 | class Product 4 | { 5 | public: 6 | virtual ~Product()=0; 7 | protected: 8 | Product(); 9 | }; 10 | 11 | class ChildProduct1:public Product 12 | { 13 | public: 14 | ChildProduct1(); 15 | ~ChildProduct1(); 16 | }; 17 | 18 | class ChildProduct2:public Product 19 | { 20 | public: 21 | ChildProduct2(); 22 | ~ChildProduct2(); 23 | }; 24 | #endif 25 | -------------------------------------------------------------------------------- /Strategy/Strategy.h: -------------------------------------------------------------------------------- 1 | #ifndef STRATEGY_H 2 | #define STRATEGY_H 3 | 4 | 5 | class Strategy 6 | { 7 | public: 8 | Strategy(); 9 | virtual ~Strategy(); 10 | virtual void operation(); 11 | protected: 12 | private: 13 | }; 14 | 15 | 16 | class StrategyA:public Strategy 17 | { 18 | public: 19 | void operation(); 20 | }; 21 | 22 | class StrategyB:public Strategy 23 | { 24 | public: 25 | void operation(); 26 | }; 27 | #endif // STRATEGY_H 28 | -------------------------------------------------------------------------------- /Factory/SimpleFactory/Product.h: -------------------------------------------------------------------------------- 1 | #ifndef PRODUCT_H 2 | #define PRODUCT_H 3 | 4 | 5 | class Product 6 | { 7 | public: 8 | Product(); 9 | virtual ~Product(); 10 | protected: 11 | private: 12 | }; 13 | 14 | class ProductA:public Product 15 | { 16 | public: 17 | ProductA(); 18 | ~ProductA(); 19 | 20 | }; 21 | 22 | class ProductB:public Product 23 | { 24 | public: 25 | ProductB(); 26 | ~ProductB(); 27 | }; 28 | 29 | #endif // PRODUCT_H 30 | -------------------------------------------------------------------------------- /ChainOfResponsibility/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Approver.h" 3 | 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | 9 | Approver* manager = new ProjectManager(); 10 | Approver* director = new Director(); 11 | Approver* vp = new VicePresident(); 12 | 13 | manager->SetApprover(director); 14 | director->SetApprover(vp); 15 | 16 | manager->HandleRequest(3000); 17 | manager->HandleRequest(6000); 18 | manager->HandleRequest(60000); 19 | 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /Observer/Observer.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Factory/AbstracFactory/include/ProductB.h: -------------------------------------------------------------------------------- 1 | #ifndef PRODUCTB_H 2 | #define PRODUCTB_H 3 | 4 | 5 | class ProductB 6 | { 7 | public: 8 | ProductB(); 9 | virtual ~ProductB(); 10 | protected: 11 | private: 12 | }; 13 | 14 | class ProductB1:public ProductB 15 | { 16 | public: 17 | ProductB1(); 18 | ~ProductB1(); 19 | }; 20 | 21 | class ProductB2:public ProductB 22 | { 23 | public: 24 | ProductB2(); 25 | virtual ~ProductB2(); 26 | }; 27 | #endif // PRODUCTB_H 28 | -------------------------------------------------------------------------------- /Singleton/Singleton.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Decorator/Decorator.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Prototype/Prototype.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Flyweight/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Flyweight.h" 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | FlyweightFactory* fac1 = new FlyweightFactory(); 8 | fac1->GetInstance("kevin"); 9 | fac1->GetInstance("kobe"); 10 | fac1->GetInstance("james"); 11 | fac1->GetInstance("kevin"); //The instance "kevin" which will not be created any more 12 | fac1->GetInstance("james"); 13 | fac1->GetInstance("wade"); 14 | cout << "*******************************" << endl; 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /Command/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Command.h" 3 | #include "ComputerFactory.h" 4 | #include "Receiver.h" 5 | 6 | using namespace std; 7 | 8 | int main() 9 | { 10 | CreateComputerCommand* PCcmd = new CreatePCCommand(); 11 | CreateComputerCommand* Laptopcmd = new CreateLaptopCommand(); 12 | 13 | Receiver receiver; 14 | receiver.AddTask(PCcmd); 15 | receiver.AddTask(Laptopcmd); 16 | receiver.Create(); 17 | 18 | receiver.DeleteTask(PCcmd); 19 | receiver.Create(); 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /Interpretor/Context.cpp: -------------------------------------------------------------------------------- 1 | #include "Context.h" 2 | 3 | Context::Context(string input):m_sInput(input), m_sOutput("") 4 | { 5 | 6 | } 7 | 8 | Context::~Context() 9 | { 10 | 11 | } 12 | 13 | void Context::SetInput(const string input) 14 | { 15 | m_sInput = input; 16 | } 17 | 18 | string Context::GetInput() const 19 | { 20 | return m_sInput; 21 | } 22 | 23 | void Context::SetOutput(const string output) 24 | { 25 | m_sOutput = output; 26 | } 27 | 28 | string Context::GetOutput() const 29 | { 30 | return m_sOutput; 31 | } 32 | -------------------------------------------------------------------------------- /Factory/AbstracFactory/include/ProductA.h: -------------------------------------------------------------------------------- 1 | #ifndef PRODUCTA_H 2 | #define PRODUCTA_H 3 | 4 | 5 | class ProductA 6 | { 7 | public: 8 | ProductA(); 9 | virtual ~ProductA(); 10 | protected: 11 | private: 12 | }; 13 | 14 | 15 | class ProductA1:public ProductA 16 | { 17 | public: 18 | ProductA1(); 19 | ~ProductA1(); 20 | }; 21 | 22 | class ProductA2:public ProductA 23 | { 24 | public: 25 | ProductA2(); 26 | virtual ~ProductA2(); 27 | }; 28 | 29 | 30 | #endif // PRODUCTA_H 31 | -------------------------------------------------------------------------------- /Interpretor/Context.h: -------------------------------------------------------------------------------- 1 | #ifndef CONTEXT_H 2 | #define CONTEXT_H 3 | #include 4 | using namespace std; 5 | 6 | class Context 7 | { 8 | public: 9 | Context(string input); 10 | virtual ~Context(); 11 | void SetInput(const string input); 12 | string GetInput() const; 13 | void SetOutput(const string output); 14 | string GetOutput() const; 15 | 16 | protected: 17 | 18 | private: 19 | string m_sInput; 20 | string m_sOutput; 21 | 22 | }; 23 | 24 | #endif // CONTEXT_H 25 | -------------------------------------------------------------------------------- /State/State.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1380372527 source:d:\programing\practice\design pattern\state\main.cpp 3 | 4 | "Context.h" 5 | "State.h" 6 | 7 | 1380372465 source:d:\programing\practice\design pattern\state\context.cpp 8 | "Context.h" 9 | 10 | 1380372497 d:\programing\practice\design pattern\state\context.h 11 | "State.h" 12 | 13 | 1380372497 source:d:\programing\practice\design pattern\state\state.cpp 14 | "State.h" 15 | 16 | 17 | 1380371628 d:\programing\practice\design pattern\state\state.h 18 | "Context.h" 19 | 20 | -------------------------------------------------------------------------------- /Strategy/Strategy.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1380351263 source:d:\programing\practice\design pattern\strategy\strategy.cpp 3 | "Strategy.h" 4 | 5 | 6 | 1380351153 d:\programing\practice\design pattern\strategy\strategy.h 7 | 8 | 1189868556 source:d:\programing\practice\design pattern\strategy\main.cpp 9 | 10 | 11 | 1380351186 source:d:\programing\practice\design pattern\strategy\context.cpp 12 | "Context.h" 13 | 14 | 15 | 1380351465 d:\programing\practice\design pattern\strategy\context.h 16 | "Strategy.h" 17 | 18 | -------------------------------------------------------------------------------- /Builder/Builder.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1378480047 source:d:\programing\practice\design pattern\builder\main.cpp 3 | 4 | "Director.h" 5 | 6 | 1378479336 source:d:\programing\practice\design pattern\builder\builder.cpp 7 | "Builder.h" 8 | 9 | 10 | 1378479021 d:\programing\practice\design pattern\builder\builder.h 11 | 12 | 1378477435 source:d:\programing\practice\design pattern\builder\director.cpp 13 | "Director.h" 14 | 15 | 16 | 1378477157 d:\programing\practice\design pattern\builder\director.h 17 | "Builder.h" 18 | 19 | -------------------------------------------------------------------------------- /Bridge/Bridge.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1378901992 source:d:\programing\practice\design pattern\bridge\shape.cpp 3 | "Shape.h" 4 | 5 | 6 | 1378901914 d:\programing\practice\design pattern\bridge\shape.h 7 | "Color.h" 8 | 9 | 1378901746 source:d:\programing\practice\design pattern\bridge\main.cpp 10 | 11 | "Color.h" 12 | "Shape.h" 13 | 14 | 1378900517 source:d:\programing\practice\design pattern\bridge\color.cpp 15 | "Color.h" 16 | 17 | 18 | 1378900369 d:\programing\practice\design pattern\bridge\color.h 19 | 20 | 21 | -------------------------------------------------------------------------------- /Command/Receiver.h: -------------------------------------------------------------------------------- 1 | #ifndef RECEIVER_H 2 | #define RECEIVER_H 3 | #include 4 | #include 5 | #include "Command.h" 6 | using namespace std; 7 | //class CreateComputerCommand; 8 | 9 | class Receiver 10 | { 11 | public: 12 | Receiver(); 13 | virtual ~Receiver(); 14 | void AddTask(CreateComputerCommand* rhl); 15 | void DeleteTask(CreateComputerCommand* rhl); 16 | void Create(); 17 | 18 | protected: 19 | 20 | private: 21 | list* m_pCreateComputerCommandList; 22 | }; 23 | 24 | #endif // RECEIVER_H 25 | -------------------------------------------------------------------------------- /Iterator/Iterator.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1381153477 source:d:\programing\practice\design pattern\iterator\iterator.cpp 3 | "Iterator.h" 4 | 5 | 1381153477 d:\programing\practice\design pattern\iterator\iterator.h 6 | "Container.h" 7 | 8 | 1381153137 source:d:\programing\practice\design pattern\iterator\main.cpp 9 | 10 | "Container.h" 11 | "Iterator.h" 12 | 13 | 1381153077 source:d:\programing\practice\design pattern\iterator\container.cpp 14 | "Container.h" 15 | 16 | 1381151970 d:\programing\practice\design pattern\iterator\container.h 17 | "Iterator.h" 18 | 19 | -------------------------------------------------------------------------------- /Observer/Observer.cpp: -------------------------------------------------------------------------------- 1 | #include "Observer.h" 2 | 3 | Observer::Observer() 4 | { 5 | //ctor 6 | } 7 | 8 | Observer::~Observer() 9 | { 10 | //dtor 11 | } 12 | 13 | ObserverA::ObserverA(Subject* sub):m_pSub(sub) 14 | { 15 | 16 | } 17 | 18 | ObserverA::~ObserverA() 19 | { 20 | 21 | } 22 | 23 | void ObserverA::update(Subject* suba) 24 | { 25 | suba->PrintState(); 26 | } 27 | 28 | ObserverB::ObserverB(Subject* sub):m_pSub(sub) 29 | { 30 | 31 | } 32 | 33 | ObserverB::~ObserverB() 34 | { 35 | 36 | } 37 | 38 | void ObserverB::update(Subject* subb) 39 | { 40 | subb->PrintState(); 41 | } 42 | -------------------------------------------------------------------------------- /Template/Template.h: -------------------------------------------------------------------------------- 1 | #ifndef TEMPLATE_H 2 | #define TEMPLATE_H 3 | 4 | 5 | class Template 6 | { 7 | public: 8 | Template(); 9 | virtual ~Template(); 10 | void TemplateMethod_Live(); 11 | virtual void Eat() = 0; 12 | virtual void Sleep() = 0; 13 | 14 | protected: 15 | private: 16 | }; 17 | 18 | class Cat:public Template 19 | { 20 | public: 21 | void Eat(); 22 | void Sleep(); 23 | }; 24 | 25 | class Dog:public Template 26 | { 27 | public: 28 | void Eat(); 29 | void Sleep(); 30 | }; 31 | 32 | #endif // TEMPLATE_H 33 | -------------------------------------------------------------------------------- /Mediator/Mediator.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1380642834 source:d:\programing\practice\design pattern\mediator\main.cpp 3 | 4 | "Mediator.h" 5 | "User.h" 6 | 7 | 1380643952 source:d:\programing\practice\design pattern\mediator\user.cpp 8 | "User.h" 9 | 10 | 1380643904 d:\programing\practice\design pattern\mediator\user.h 11 | 12 | "Mediator.h" 13 | 14 | 1380643922 source:d:\programing\practice\design pattern\mediator\mediator.cpp 15 | "Mediator.h" 16 | 17 | 1380643797 d:\programing\practice\design pattern\mediator\mediator.h 18 | "User.h" 19 | 20 | 21 | -------------------------------------------------------------------------------- /Visitor/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Visitor.h" 3 | #include "BlogList.h" 4 | #include "Element.h" 5 | 6 | using namespace std; 7 | 8 | int main() 9 | { 10 | Visitor* PCvis = new PCVisitor(); 11 | Visitor* Phonevis = new PhoneVisitor(); 12 | 13 | Element* blog1 = new ElementBlog("First Blog"); 14 | Element* blog2 = new ElementBlog("Second Blog"); 15 | 16 | BlogList* bloglist = new BlogList(); 17 | 18 | bloglist->AddBlog(blog1); 19 | bloglist->AddBlog(blog2); 20 | bloglist->StartVisit(PCvis); 21 | bloglist->StartVisit(Phonevis); 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /Factory/FactoryMethod/Factory.h: -------------------------------------------------------------------------------- 1 | #ifndef __FACTORY_H__ 2 | #define __FACTORY_H__ 3 | #include "Product.h" 4 | class Product; 5 | 6 | class Factory 7 | { 8 | public: 9 | virtual Product* CreateProduct1() = 0; 10 | virtual Product* CreateProduct2() = 0; 11 | virtual ~Factory(); 12 | protected: 13 | Factory(); 14 | 15 | }; 16 | 17 | class ConcreteFactory:public Factory 18 | { 19 | public: 20 | ConcreteFactory(); 21 | virtual ~ConcreteFactory(); 22 | virtual Product* CreateProduct1(); 23 | virtual Product* CreateProduct2(); 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /Observer/Observer.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1380508200 source:d:\programing\practice\design pattern\observer\main.cpp 3 | 4 | "Observer.h" 5 | "Subject.h" 6 | 7 | 1380505928 source:d:\programing\practice\design pattern\observer\subject.cpp 8 | "Subject.h" 9 | "Observer.h" 10 | 11 | 1380504592 d:\programing\practice\design pattern\observer\subject.h 12 | 13 | 14 | 15 | 1380504572 d:\programing\practice\design pattern\observer\observer.h 16 | "Subject.h" 17 | 18 | 1380508076 source:d:\programing\practice\design pattern\observer\observer.cpp 19 | "Observer.h" 20 | 21 | -------------------------------------------------------------------------------- /Template/Template.cpp: -------------------------------------------------------------------------------- 1 | #include "Template.h" 2 | #include 3 | using namespace std; 4 | 5 | 6 | Template::Template() 7 | { 8 | 9 | } 10 | 11 | Template::~Template() 12 | { 13 | 14 | } 15 | 16 | 17 | void Template::TemplateMethod_Live() 18 | { 19 | this->Eat(); 20 | this->Sleep(); 21 | } 22 | 23 | void Dog::Eat() 24 | { 25 | cout<<"Dog::Eat()."< 5 | 6 | 1381241347 d:\programing\practice\design pattern\interpretor\interpretor.h 7 | "Context.h" 8 | 9 | 1381241669 source:d:\programing\practice\design pattern\interpretor\main.cpp 10 | 11 | "Context.h" 12 | "Interpretor.h" 13 | 14 | 1381241776 source:d:\programing\practice\design pattern\interpretor\context.cpp 15 | "Context.h" 16 | 17 | 1381238246 d:\programing\practice\design pattern\interpretor\context.h 18 | 19 | 20 | -------------------------------------------------------------------------------- /Proxy/Proxy.h: -------------------------------------------------------------------------------- 1 | #ifndef PROXY_H 2 | #define PROXY_H 3 | 4 | class Object 5 | { 6 | public: 7 | virtual ~Object(); 8 | virtual void Request() = 0; 9 | protected: 10 | Object(); 11 | }; 12 | 13 | class SubObject:public Object 14 | { 15 | public: 16 | SubObject(); 17 | ~SubObject(); 18 | void Request(); 19 | }; 20 | 21 | 22 | 23 | class Proxy 24 | { 25 | public: 26 | Proxy(Object* rhl); 27 | virtual ~Proxy(); 28 | void Request(); 29 | 30 | protected: 31 | 32 | private: 33 | Object* m_pObject; 34 | }; 35 | 36 | #endif // PROXY_H 37 | -------------------------------------------------------------------------------- /State/State.h: -------------------------------------------------------------------------------- 1 | #ifndef STATE_H 2 | #define STATE_H 3 | #include "Context.h" 4 | 5 | class Context; 6 | class State 7 | { 8 | public: 9 | State(); 10 | virtual ~State(); 11 | virtual void Handle(Context* con); 12 | 13 | protected: 14 | private: 15 | }; 16 | 17 | class StateA:public State 18 | { 19 | public: 20 | StateA(); 21 | ~StateA(); 22 | void Handle(Context* con); 23 | }; 24 | 25 | class StateB:public State 26 | { 27 | public: 28 | StateB(); 29 | ~StateB(); 30 | void Handle(Context* con); 31 | }; 32 | 33 | 34 | 35 | #endif // STATE_H 36 | -------------------------------------------------------------------------------- /Factory/SimpleFactory/SimpleFactory.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1378472302 source:d:\programing\practice\design pattern\simplefactory\product.cpp 3 | "Product.h" 4 | 5 | 6 | 1378472193 d:\programing\practice\design pattern\simplefactory\product.h 7 | 8 | 1378474410 source:d:\programing\practice\design pattern\simplefactory\main.cpp 9 | 10 | "Factory.h" 11 | 12 | 1378474317 source:d:\programing\practice\design pattern\simplefactory\factory.cpp 13 | "Factory.h" 14 | 15 | "Product.h" 16 | 17 | 1378473472 d:\programing\practice\design pattern\simplefactory\factory.h 18 | 19 | 20 | -------------------------------------------------------------------------------- /Factory/FactoryMethod/Factory.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Factory/SimpleFactory/Product.cpp: -------------------------------------------------------------------------------- 1 | #include "Product.h" 2 | #include 3 | using namespace std; 4 | 5 | Product::Product() 6 | { 7 | cout<<"Product::Product()."< 3 | using namespace std; 4 | 5 | Object::Object() 6 | { 7 | 8 | } 9 | 10 | Object::~Object() 11 | { 12 | 13 | } 14 | 15 | 16 | SubObject::SubObject() 17 | { 18 | 19 | } 20 | 21 | SubObject::~SubObject() 22 | { 23 | 24 | } 25 | 26 | void SubObject::Request() 27 | { 28 | cout<<"SubObject::Request()."<Request(); 46 | } 47 | -------------------------------------------------------------------------------- /Visitor/Visitor.h: -------------------------------------------------------------------------------- 1 | #ifndef VISITOR_H 2 | #define VISITOR_H 3 | class Element; 4 | 5 | class Visitor 6 | { 7 | public: 8 | Visitor(); 9 | virtual ~Visitor(); 10 | virtual void VisitBlog(Element* ele) = 0; 11 | protected: 12 | private: 13 | }; 14 | 15 | class PCVisitor:public Visitor 16 | { 17 | public: 18 | PCVisitor(); 19 | ~PCVisitor(); 20 | void VisitBlog(Element* ele); 21 | }; 22 | 23 | class PhoneVisitor:public Visitor 24 | { 25 | public: 26 | PhoneVisitor(); 27 | ~PhoneVisitor(); 28 | void VisitBlog(Element* ele); 29 | }; 30 | 31 | #endif // VISITOR_H 32 | -------------------------------------------------------------------------------- /Facade/Facade.h: -------------------------------------------------------------------------------- 1 | #ifndef FACADE_H 2 | #define FACADE_H 3 | 4 | class SubSystem1 5 | { 6 | public: 7 | void Operation(); 8 | 9 | }; 10 | 11 | 12 | class SubSystem2 13 | { 14 | public: 15 | void Operation(); 16 | 17 | }; 18 | 19 | class SubSystem3 20 | { 21 | public: 22 | void Operation(); 23 | }; 24 | 25 | 26 | class Facade 27 | { 28 | public: 29 | Facade(); 30 | virtual ~Facade(); 31 | void OperationWrapper(); 32 | 33 | protected: 34 | 35 | private: 36 | SubSystem1* m_pSub1; 37 | SubSystem2* m_pSub2; 38 | SubSystem3* m_pSub3; 39 | }; 40 | 41 | #endif // FACADE_H 42 | -------------------------------------------------------------------------------- /Factory/AbstracFactory/src/ProductA.cpp: -------------------------------------------------------------------------------- 1 | #include "include/ProductA.h" 2 | #include 3 | using namespace std; 4 | 5 | ProductA::ProductA() 6 | { 7 | cout<<"ProductA::ProductA()."< 3 | using namespace std; 4 | 5 | ProductB::ProductB() 6 | { 7 | cout<<"ProductB::ProductB()."< 2 | #include "Observer.h" 3 | #include "Subject.h" 4 | 5 | using namespace std; 6 | 7 | int main() 8 | { 9 | Subject* suba = new SubjectA(); 10 | 11 | Observer* obs1 = new ObserverA(suba); 12 | Observer* obs2 = new ObserverB(suba); 13 | 14 | cout<<"************* From Observer1's point of view ************"<RegisterObserver(obs1); 16 | suba->SetState("Old State"); 17 | suba->NotifyObservers(); 18 | 19 | cout<<"*** From Both Observer1 and Observer2's point of view ***"<RegisterObserver(obs2); 21 | suba->SetState("New State"); 22 | suba->NotifyObservers(); 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /Visitor/BlogList.cpp: -------------------------------------------------------------------------------- 1 | #include "BlogList.h" 2 | using namespace std; 3 | 4 | BlogList::BlogList():m_pBlogList(new list()) 5 | { 6 | //ctor 7 | } 8 | 9 | BlogList::~BlogList() 10 | { 11 | //dtor 12 | } 13 | 14 | void BlogList::AddBlog(Element* ele) 15 | { 16 | m_pBlogList->push_back(ele); 17 | } 18 | 19 | void BlogList::DeleteBlog(Element* ele) 20 | { 21 | m_pBlogList->remove(ele); 22 | } 23 | 24 | void BlogList::StartVisit(Visitor* vis) 25 | { 26 | list::iterator iter = m_pBlogList->begin(); 27 | for(;iter!=m_pBlogList->end();iter++) 28 | (*iter)->Accept(vis); 29 | //for_each(m_pBlogList->begin();m_pBlogList->end();Start(vis)); 30 | } 31 | -------------------------------------------------------------------------------- /Factory/FactoryMethod/Product.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Product.h" 3 | using namespace std; 4 | Product::Product() 5 | { 6 | cout<<"Product::Product();"<VisitBlog(this); 43 | } 44 | -------------------------------------------------------------------------------- /Factory/FactoryMethod/Factory.cpp: -------------------------------------------------------------------------------- 1 | #include "Factory.h" 2 | #include 3 | using namespace std; 4 | 5 | Factory::Factory() 6 | { 7 | cout<<"Factory::Factory();"< 3 | using namespace std; 4 | 5 | State::State() 6 | { 7 | 8 | } 9 | 10 | State::~State() 11 | { 12 | 13 | } 14 | 15 | void State::Handle(Context* con) 16 | { 17 | 18 | } 19 | 20 | StateA::StateA() 21 | { 22 | 23 | } 24 | 25 | StateA::~StateA() 26 | { 27 | 28 | } 29 | 30 | StateB::StateB() 31 | { 32 | 33 | } 34 | 35 | StateB::~StateB() 36 | { 37 | 38 | } 39 | 40 | void StateA::Handle(Context* con) 41 | { 42 | cout<<"StateA:Handle(Context* con)."<ChangeState(new StateB); 44 | } 45 | 46 | void StateB::Handle(Context* con) 47 | { 48 | cout<<"StateB::Handle(Context* con)."<ChangeState(new StateA); 50 | } 51 | -------------------------------------------------------------------------------- /State/State.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Visitor/Visitor.cpp: -------------------------------------------------------------------------------- 1 | #include "Visitor.h" 2 | #include "Element.h" 3 | #include 4 | using namespace std; 5 | 6 | 7 | Visitor::Visitor() 8 | { 9 | //ctor 10 | } 11 | 12 | Visitor::~Visitor() 13 | { 14 | //dtor 15 | } 16 | 17 | PCVisitor::PCVisitor() 18 | { 19 | 20 | } 21 | 22 | PCVisitor::~PCVisitor() 23 | { 24 | 25 | } 26 | 27 | void PCVisitor::VisitBlog(Element* ele) 28 | { 29 | cout<<"Visit "<GetBlogName()<< " through PC."<GetBlogName()<<" through Phone."< 3 | using namespace std; 4 | 5 | CreateComputerCommand::CreateComputerCommand() 6 | { 7 | //ctor 8 | } 9 | 10 | CreateComputerCommand::~CreateComputerCommand() 11 | { 12 | //dtor 13 | } 14 | 15 | CreatePCCommand::CreatePCCommand() 16 | { 17 | 18 | } 19 | 20 | CreatePCCommand::~CreatePCCommand() 21 | { 22 | 23 | } 24 | 25 | void CreatePCCommand::Excute() 26 | { 27 | m_pComputerFactory->CreatePC(); 28 | } 29 | 30 | CreateLaptopCommand::CreateLaptopCommand() 31 | { 32 | 33 | } 34 | 35 | CreateLaptopCommand::~CreateLaptopCommand() 36 | { 37 | 38 | } 39 | 40 | void CreateLaptopCommand::Excute() 41 | { 42 | m_pComputerFactory->CreateLaptop(); 43 | } 44 | 45 | 46 | -------------------------------------------------------------------------------- /Builder/Builder.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Composite/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Compositor.h" 3 | 4 | using namespace std; 5 | 6 | int main() 7 | { 8 | AbstractFile *rootFolder=new Folder("root dir"); 9 | AbstractFile *Folder1=new Folder("dir1"); 10 | AbstractFile *Folder2=new Folder("dir2"); 11 | 12 | AbstractFile *file1=new File("file1"); 13 | AbstractFile *file2=new File("file2"); 14 | rootFolder->AddChild(Folder1); 15 | rootFolder->AddChild(Folder2); 16 | rootFolder->AddChild(file1); 17 | Folder1->AddChild(file2); 18 | rootFolder->PrintName(); 19 | Folder1->PrintName(); 20 | Folder2->PrintName(); 21 | file1->PrintName(); 22 | file2->PrintName(); 23 | 24 | cout << "Hello world!" << endl; 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /Visitor/Element.h: -------------------------------------------------------------------------------- 1 | #ifndef ELEMENT_H 2 | #define ELEMENT_H 3 | #include 4 | 5 | class Visitor; 6 | 7 | class Element 8 | { 9 | public: 10 | Element(); 11 | virtual ~Element(); 12 | virtual void Accept(Visitor* vis) = 0; 13 | virtual const std::string GetBlogName() = 0; 14 | 15 | protected: 16 | 17 | private: 18 | std::string m_sBlogName; 19 | 20 | }; 21 | 22 | class ElementBlog:public Element 23 | { 24 | public: 25 | ElementBlog(std::string BlogName=""); 26 | ~ElementBlog(); 27 | void Accept(Visitor* vis); 28 | const std::string GetBlogName(); 29 | 30 | private: 31 | std::string m_sBlogName; 32 | 33 | }; 34 | 35 | #endif // ELEMENT_H 36 | -------------------------------------------------------------------------------- /Iterator/Iterator.cpp: -------------------------------------------------------------------------------- 1 | #include "Iterator.h" 2 | 3 | Iterator::Iterator() 4 | { 5 | //ctor 6 | } 7 | 8 | Iterator::~Iterator() 9 | { 10 | //dtor 11 | } 12 | 13 | ConcreteIterator::ConcreteIterator(Container* con):m_pContainer(con), m_iIndex(0) 14 | { 15 | 16 | } 17 | 18 | ConcreteIterator::~ConcreteIterator() 19 | { 20 | 21 | } 22 | 23 | void ConcreteIterator::begin() 24 | { 25 | m_iIndex = 0; 26 | } 27 | 28 | bool ConcreteIterator::end() 29 | { 30 | return m_iIndex == m_pContainer->GetSize(); 31 | } 32 | 33 | void ConcreteIterator::next() 34 | { 35 | if(m_iIndex < m_pContainer->GetSize()) 36 | m_iIndex++; 37 | } 38 | 39 | DataType ConcreteIterator::GetCurrentItem() 40 | { 41 | return m_pContainer->GetItem(m_iIndex); 42 | } 43 | -------------------------------------------------------------------------------- /Factory/SimpleFactory/SimpleFactory.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Prototype/Prototype.h: -------------------------------------------------------------------------------- 1 | #ifndef PROTOTYPE_H 2 | #define PROTOTYPE_H 3 | 4 | 5 | class Prototype 6 | { 7 | public: 8 | Prototype(); 9 | virtual ~Prototype(); 10 | virtual Prototype* clone() const = 0; 11 | 12 | protected: 13 | 14 | private: 15 | }; 16 | 17 | class Prototype1:public Prototype 18 | { 19 | public: 20 | Prototype1(); 21 | ~Prototype1(); 22 | Prototype1(const Prototype1& pro); 23 | virtual Prototype* clone() const; 24 | 25 | }; 26 | 27 | class Prototype2:public Prototype 28 | { 29 | public: 30 | Prototype2(); 31 | ~Prototype2(); 32 | Prototype2(const Prototype2& pro); 33 | virtual Prototype* clone() const; 34 | 35 | }; 36 | #endif // PROTOTYPE_H 37 | -------------------------------------------------------------------------------- /Facade/Facade.cpp: -------------------------------------------------------------------------------- 1 | #include "Facade.h" 2 | #include 3 | using namespace std; 4 | 5 | Facade::Facade():m_pSub1(new SubSystem1), m_pSub2(new SubSystem2), m_pSub3(new SubSystem3) 6 | { 7 | 8 | } 9 | 10 | Facade::~Facade() 11 | { 12 | delete m_pSub1; 13 | delete m_pSub2; 14 | delete m_pSub3; 15 | } 16 | 17 | void SubSystem1::Operation() 18 | { 19 | cout<<"SubSystem1::Operation()."<Operation(); 37 | m_pSub2->Operation(); 38 | m_pSub3->Operation(); 39 | } 40 | -------------------------------------------------------------------------------- /Command/Receiver.cpp: -------------------------------------------------------------------------------- 1 | #include "Receiver.h" 2 | #include 3 | 4 | 5 | 6 | 7 | Receiver::Receiver():m_pCreateComputerCommandList(new list()) 8 | { 9 | 10 | } 11 | 12 | Receiver::~Receiver() 13 | { 14 | //dtor 15 | } 16 | 17 | void Receiver::AddTask(CreateComputerCommand* rhl) 18 | { 19 | m_pCreateComputerCommandList->push_back(rhl); 20 | } 21 | 22 | void Receiver::DeleteTask(CreateComputerCommand* rhl) 23 | { 24 | m_pCreateComputerCommandList->remove(rhl); 25 | } 26 | 27 | void Receiver::Create() 28 | { 29 | list::iterator iter = m_pCreateComputerCommandList->begin(); 30 | for(;iter!=m_pCreateComputerCommandList->end();iter++) 31 | { 32 | (*iter)->Excute(); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Observer/Observer.h: -------------------------------------------------------------------------------- 1 | #ifndef OBSERVER_H 2 | #define OBSERVER_H 3 | #include "Subject.h" 4 | class Subject; 5 | 6 | class Observer 7 | { 8 | public: 9 | Observer(); 10 | virtual ~Observer(); 11 | virtual void update(Subject* sub) = 0; 12 | protected: 13 | private: 14 | }; 15 | 16 | class ObserverA:public Observer 17 | { 18 | public: 19 | ObserverA(Subject* sub); 20 | ~ObserverA(); 21 | void update(Subject* sub); 22 | 23 | private: 24 | Subject* m_pSub; 25 | }; 26 | 27 | class ObserverB:public Observer 28 | { 29 | public: 30 | ObserverB(Subject* sub); 31 | ~ObserverB(); 32 | void update(Subject* sub); 33 | 34 | private: 35 | Subject* m_pSub; 36 | }; 37 | 38 | #endif // OBSERVER_H 39 | -------------------------------------------------------------------------------- /Interpretor/Interpretor.h: -------------------------------------------------------------------------------- 1 | #ifndef INTERPRETOR_H 2 | #define INTERPRETOR_H 3 | #include "Context.h" 4 | 5 | class AbstractExpression 6 | { 7 | public: 8 | AbstractExpression(); 9 | virtual ~AbstractExpression(); 10 | virtual void Interpreter(Context* con) = 0; 11 | protected: 12 | private: 13 | }; 14 | 15 | class TerminalExpression:public AbstractExpression 16 | { 17 | public: 18 | TerminalExpression(); 19 | ~TerminalExpression(); 20 | virtual void Interpreter(Context* con); 21 | }; 22 | 23 | class NonTerminalExpression:public AbstractExpression 24 | { 25 | public: 26 | NonTerminalExpression(); 27 | ~NonTerminalExpression(); 28 | virtual void Interpreter(Context* con); 29 | }; 30 | 31 | #endif // INTERPRETOR_H 32 | -------------------------------------------------------------------------------- /Iterator/Container.cpp: -------------------------------------------------------------------------------- 1 | #include "Container.h" 2 | 3 | Container::Container() 4 | { 5 | //ctor 6 | } 7 | 8 | Container::~Container() 9 | { 10 | //dtor 11 | } 12 | 13 | Iterator* Container::CreateIterator(Container* con) 14 | { 15 | 16 | } 17 | 18 | 19 | ConcreteContainer::ConcreteContainer(int size):m_iSize(size), m_pDataType(new DataType[m_iSize]) 20 | { 21 | for(int i=0;i 8 | 9 | 1380965382 source:d:\programing\practice\design pattern\visitor\main.cpp 10 | 11 | "Visitor.h" 12 | "BlogList.h" 13 | "Element.h" 14 | 15 | 1380965028 source:d:\programing\practice\design pattern\visitor\bloglist.cpp 16 | "BlogList.h" 17 | 18 | 1380964934 d:\programing\practice\design pattern\visitor\bloglist.h 19 | 20 | "Element.h" 21 | 22 | 1380965408 source:d:\programing\practice\design pattern\visitor\visitor.cpp 23 | "Visitor.h" 24 | "Element.h" 25 | 26 | 27 | 1380962735 d:\programing\practice\design pattern\visitor\visitor.h 28 | 29 | -------------------------------------------------------------------------------- /Iterator/Iterator.h: -------------------------------------------------------------------------------- 1 | #ifndef ITERATOR_H 2 | #define ITERATOR_H 3 | #include "Container.h" 4 | typedef int DataType; 5 | class Container; 6 | 7 | class Iterator 8 | { 9 | public: 10 | Iterator(); 11 | virtual ~Iterator(); 12 | virtual void begin() = 0; 13 | virtual bool end() = 0; 14 | virtual void next() = 0; 15 | virtual DataType GetCurrentItem() = 0; 16 | 17 | protected: 18 | 19 | private: 20 | }; 21 | 22 | 23 | class ConcreteIterator:public Iterator 24 | { 25 | public: 26 | ConcreteIterator(Container* con); 27 | ~ConcreteIterator(); 28 | void begin(); 29 | bool end(); 30 | void next(); 31 | DataType GetCurrentItem(); 32 | 33 | private: 34 | Container* m_pContainer; 35 | int m_iIndex; 36 | }; 37 | #endif // ITERATOR_H 38 | -------------------------------------------------------------------------------- /Iterator/Container.h: -------------------------------------------------------------------------------- 1 | #ifndef CONTAINER_H 2 | #define CONTAINER_H 3 | #include "Iterator.h" 4 | class Iterator; 5 | typedef int DataType; 6 | 7 | class Container 8 | { 9 | public: 10 | Container(); 11 | virtual ~Container(); 12 | virtual int GetSize() const = 0; 13 | virtual DataType GetItem(int index) const = 0; 14 | virtual Iterator* CreateIterator(Container* con) = 0; 15 | 16 | protected: 17 | 18 | private: 19 | 20 | }; 21 | 22 | class ConcreteContainer:public Container 23 | { 24 | public: 25 | ConcreteContainer(int size); 26 | ~ConcreteContainer(); 27 | int GetSize() const; 28 | DataType GetItem(int index) const; 29 | Iterator* CreateIterator(Container* con); 30 | 31 | private: 32 | DataType* m_pDataType; 33 | int m_iSize; 34 | 35 | }; 36 | 37 | #endif // CONTAINER_H 38 | -------------------------------------------------------------------------------- /Command/Command.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1380890814 source:d:\programing\practice\design pattern\command\computerfactory.cpp 3 | "ComputerFactory.h" 4 | 5 | 6 | 1380889890 d:\programing\practice\design pattern\command\computerfactory.h 7 | 8 | 1380900069 source:d:\programing\practice\design pattern\command\main.cpp 9 | 10 | "Command.h" 11 | "ComputerFactory.h" 12 | "Receiver.h" 13 | 14 | 1380900211 source:d:\programing\practice\design pattern\command\command.cpp 15 | "Command.h" 16 | 17 | 18 | 1380900153 d:\programing\practice\design pattern\command\command.h 19 | "ComputerFactory.h" 20 | 21 | 1380900272 source:d:\programing\practice\design pattern\command\receiver.cpp 22 | "Receiver.h" 23 | 24 | 25 | 1380894589 d:\programing\practice\design pattern\command\receiver.h 26 | 27 | 28 | "Command.h" 29 | 30 | -------------------------------------------------------------------------------- /Flyweight/Flyweight.h: -------------------------------------------------------------------------------- 1 | #ifndef FLYWEIGHT_H 2 | #define FLYWEIGHT_H 3 | #include 4 | #include 5 | using namespace std; 6 | 7 | 8 | 9 | class Flyweight 10 | { 11 | public: 12 | Flyweight(string status); 13 | virtual ~Flyweight(); 14 | virtual void operation(); 15 | string GetInstanceStatus() const; 16 | protected: 17 | 18 | private: 19 | 20 | string m_pStatus; 21 | }; 22 | 23 | class ConcreteFlyweight:public Flyweight 24 | { 25 | public: 26 | ConcreteFlyweight(string rhl); 27 | ~ConcreteFlyweight(); 28 | void operation(); 29 | }; 30 | 31 | class FlyweightFactory 32 | { 33 | public: 34 | FlyweightFactory(); 35 | ~FlyweightFactory(); 36 | Flyweight* GetInstance(string status); 37 | 38 | private: 39 | list m_lfly; 40 | }; 41 | 42 | 43 | #endif // FLYWEIGHT_H 44 | -------------------------------------------------------------------------------- /Adapter/ClassAdapter/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | class Target 5 | { 6 | public: 7 | Target(){} 8 | ~Target(){} 9 | void Request(){cout<<"Target::Request()."<SpecificRequest(); 34 | } 35 | }; 36 | 37 | 38 | int main() 39 | { 40 | Adapter Adap; 41 | Adap.Request(); 42 | cout << "Hello world!" << endl; 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /Command/Command.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMAND_H 2 | #define COMMAND_H 3 | #include "ComputerFactory.h" 4 | class ComputerFactory; 5 | 6 | class CreateComputerCommand 7 | { 8 | public: 9 | CreateComputerCommand(); 10 | virtual ~CreateComputerCommand(); 11 | virtual void Excute() = 0; 12 | 13 | protected: 14 | private: 15 | 16 | }; 17 | 18 | class CreatePCCommand:public CreateComputerCommand 19 | { 20 | public: 21 | CreatePCCommand(); 22 | ~CreatePCCommand(); 23 | virtual void Excute(); 24 | 25 | private: 26 | ComputerFactory* m_pComputerFactory; 27 | 28 | }; 29 | 30 | class CreateLaptopCommand:public CreateComputerCommand 31 | { 32 | public: 33 | CreateLaptopCommand(); 34 | ~CreateLaptopCommand(); 35 | void Excute(); 36 | 37 | protected: 38 | 39 | private: 40 | ComputerFactory* m_pComputerFactory; 41 | }; 42 | 43 | #endif // COMMAND_H 44 | -------------------------------------------------------------------------------- /Bridge/Color.h: -------------------------------------------------------------------------------- 1 | #ifndef COLOR_H 2 | #define COLOR_H 3 | #include 4 | using namespace std; 5 | 6 | class Color 7 | { 8 | public: 9 | Color(); 10 | virtual ~Color(); 11 | virtual std::string GetColorName(); 12 | 13 | protected: 14 | 15 | private: 16 | string m_sColorName; 17 | }; 18 | 19 | class Red:public Color 20 | { 21 | public: 22 | Red(); 23 | ~Red(); 24 | string GetColorName(); 25 | protected: 26 | 27 | private: 28 | string m_sColorName; 29 | }; 30 | 31 | class Green:public Color 32 | { 33 | public: 34 | Green(); 35 | ~Green(); 36 | string GetColorName(); 37 | private: 38 | string m_sColorName; 39 | }; 40 | 41 | class Blue:public Color 42 | { 43 | public: 44 | Blue(); 45 | ~Blue(); 46 | string GetColorName(); 47 | 48 | private: 49 | string m_sColorName; 50 | }; 51 | 52 | #endif // COLOR_H 53 | -------------------------------------------------------------------------------- /ChainOfResponsibility/Approver.h: -------------------------------------------------------------------------------- 1 | #ifndef APPROVER_H 2 | #define APPROVER_H 3 | 4 | 5 | class Approver 6 | { 7 | public: 8 | Approver(); 9 | virtual ~Approver(); 10 | virtual void HandleRequest(int num) = 0; 11 | void SetApprover(Approver* app); 12 | Approver* GetApprover() const; 13 | 14 | protected: 15 | 16 | private: 17 | Approver* m_pApprover; 18 | }; 19 | 20 | class ProjectManager:public Approver 21 | { 22 | public: 23 | ProjectManager(); 24 | ~ProjectManager(); 25 | void HandleRequest(int num); 26 | 27 | }; 28 | 29 | class Director:public Approver 30 | { 31 | public: 32 | Director(); 33 | ~Director(); 34 | void HandleRequest(int num); 35 | 36 | }; 37 | 38 | class VicePresident:public Approver 39 | { 40 | public: 41 | VicePresident(); 42 | ~VicePresident(); 43 | void HandleRequest(int num); 44 | 45 | }; 46 | 47 | #endif // APPROVER_H 48 | -------------------------------------------------------------------------------- /Decorator/Decorator.h: -------------------------------------------------------------------------------- 1 | #ifndef DECORATOR_H 2 | #define DECORATOR_H 3 | #include 4 | using namespace std; 5 | 6 | 7 | class Animal 8 | { 9 | public: 10 | Animal(); 11 | ~Animal(); 12 | virtual void eat(); 13 | 14 | protected: 15 | 16 | private: 17 | 18 | 19 | }; 20 | 21 | class Dog:public Animal 22 | { 23 | public: 24 | Dog(); 25 | ~Dog(); 26 | virtual void eat(); 27 | 28 | }; 29 | 30 | 31 | 32 | 33 | class Decorator:public Animal 34 | { 35 | public: 36 | Decorator(Animal* rhl); 37 | virtual ~Decorator(); 38 | virtual void eat(); 39 | 40 | protected: 41 | Animal* m_pAnimal; 42 | private: 43 | Decorator(); 44 | 45 | 46 | }; 47 | 48 | class ConcreteDecorator:public Decorator 49 | { 50 | public: 51 | ConcreteDecorator(Animal* rhl); 52 | ~ConcreteDecorator(); 53 | virtual void eat(); 54 | }; 55 | 56 | #endif // DECORATOR_H 57 | -------------------------------------------------------------------------------- /Interpretor/Interpretor.cpp: -------------------------------------------------------------------------------- 1 | #include "Interpretor.h" 2 | #include 3 | using namespace std; 4 | 5 | AbstractExpression::AbstractExpression() 6 | { 7 | //ctor 8 | } 9 | 10 | AbstractExpression::~AbstractExpression() 11 | { 12 | //dtor 13 | } 14 | 15 | void AbstractExpression::Interpreter(Context* con) 16 | { 17 | 18 | } 19 | 20 | TerminalExpression::TerminalExpression() 21 | { 22 | 23 | } 24 | 25 | TerminalExpression::~TerminalExpression() 26 | { 27 | 28 | } 29 | 30 | void TerminalExpression::Interpreter(Context* con) 31 | { 32 | con->SetOutput("Terminal: "+ con->GetInput()); 33 | cout<GetOutput()<SetOutput("Nonterminal: "+con->GetInput()); 50 | cout<GetOutput()<ReceiveMsg(str); 56 | } 57 | 58 | void ConcreteMediator::SendMsgFromB2A(string str) 59 | { 60 | m_pConUserA->ReceiveMsg(str); 61 | } 62 | -------------------------------------------------------------------------------- /Factory/FactoryMethod/Factory.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1378168388 source:d:\programing\practice\design pattern\factory\factory\product.cpp 3 | 4 | "Product.h" 5 | 6 | 1378168392 d:\programing\practice\design pattern\factory\factory\product.h 7 | 8 | 1378126645 source:d:\programing\practice\design pattern\factory\factory\main.cpp 9 | 10 | "Factory.h" 11 | "Product.h" 12 | 13 | 1378169555 d:\programing\practice\design pattern\factory\factory\factory.h 14 | "Product.h" 15 | 16 | 1378169555 source:d:\programing\practice\design pattern\factory\factory\factory.cpp 17 | "Factory.h" 18 | 19 | 20 | 1378169596 source:d:\programing\practice\design pattern\factory\factorymethod\main.cpp 21 | 22 | "Factory.h" 23 | "Product.h" 24 | 25 | 1378169555 d:\programing\practice\design pattern\factory\factorymethod\factory.h 26 | "Product.h" 27 | 28 | 1378168392 d:\programing\practice\design pattern\factory\factorymethod\product.h 29 | 30 | -------------------------------------------------------------------------------- /Factory/AbstracFactory/AbstracFactory.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1378303284 source:d:\programing\practice\design pattern\factory\abstracfactory\src\factory.cpp 3 | 4 | "include/Factory.h" 5 | "include/ProductA.h" 6 | "include/ProductB.h" 7 | 8 | 1378303284 d:\programing\practice\design pattern\factory\abstracfactory\include\factory.h 9 | 10 | 1378302894 d:\programing\practice\design pattern\factory\abstracfactory\include\producta.h 11 | 12 | 1378303101 d:\programing\practice\design pattern\factory\abstracfactory\include\productb.h 13 | 14 | 1378303821 source:d:\programing\practice\design pattern\factory\abstracfactory\src\producta.cpp 15 | "include/ProductA.h" 16 | 17 | 18 | 1378303818 source:d:\programing\practice\design pattern\factory\abstracfactory\src\productb.cpp 19 | "include/ProductB.h" 20 | 21 | 22 | 1378303533 source:d:\programing\practice\design pattern\factory\abstracfactory\main.cpp 23 | 24 | "include/Factory.h" 25 | 26 | -------------------------------------------------------------------------------- /Mediator/Mediator.h: -------------------------------------------------------------------------------- 1 | #ifndef MEDIATOR_H 2 | #define MEDIATOR_H 3 | #include "User.h" 4 | #include 5 | using namespace std; 6 | 7 | class User; 8 | class ConcreteUserA; 9 | class ConcreteUserB; 10 | class Mediator 11 | { 12 | public: 13 | Mediator(); 14 | virtual ~Mediator(); 15 | virtual void SendMsgFromA2B(string str); 16 | virtual void SendMsgFromB2A(string str); 17 | virtual void SetUserA(User* user); 18 | virtual void SetUserB(User* user); 19 | protected: 20 | 21 | private: 22 | 23 | }; 24 | 25 | class ConcreteMediator:public Mediator 26 | { 27 | public: 28 | ConcreteMediator(); 29 | ~ConcreteMediator(); 30 | void SendMsgFromA2B(string str); 31 | void SendMsgFromB2A(string str); 32 | void SetUserA(User* user); 33 | void SetUserB(User* user); 34 | 35 | private: 36 | User* m_pConUserA; 37 | User* m_pConUserB; 38 | 39 | 40 | }; 41 | 42 | #endif // MEDIATOR_H 43 | -------------------------------------------------------------------------------- /Mediator/User.cpp: -------------------------------------------------------------------------------- 1 | #include "User.h" 2 | 3 | User::User(Mediator* med):m_pMediator(med), m_sMsg("") 4 | { 5 | //m_sMsg = ""; 6 | } 7 | 8 | User::~User() 9 | { 10 | //dtor 11 | } 12 | 13 | 14 | 15 | ConcreteUserA::ConcreteUserA(Mediator* med):User(med) 16 | { 17 | 18 | } 19 | 20 | ConcreteUserA::~ConcreteUserA() 21 | { 22 | 23 | } 24 | 25 | void ConcreteUserA::SendMsg(string str) 26 | { 27 | this->m_pMediator->SendMsgFromA2B(str); 28 | } 29 | 30 | void ConcreteUserA::ReceiveMsg(string str) 31 | { 32 | cout<<"In ConcreteUserA, Msg is: "<SendMsgFromB2A(str); 49 | } 50 | 51 | void ConcreteUserB::ReceiveMsg(string msg) 52 | { 53 | cout<<"In ConcreteUserB, Msg is: "< 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Mediator/User.h: -------------------------------------------------------------------------------- 1 | #ifndef USER_H 2 | #define USER_H 3 | #include 4 | #include "Mediator.h" 5 | using namespace std; 6 | 7 | 8 | class Mediator; 9 | class User 10 | { 11 | public: 12 | User(Mediator* rhl); 13 | virtual ~User(); 14 | virtual void SendMsg(string str) = 0; 15 | virtual void ReceiveMsg(string str) = 0; 16 | 17 | protected: 18 | string m_sMsg; 19 | Mediator* m_pMediator; 20 | private: 21 | 22 | }; 23 | 24 | class ConcreteUserA:public User 25 | { 26 | public: 27 | ConcreteUserA(Mediator* med); 28 | ~ConcreteUserA(); 29 | void SendMsg(string str); 30 | void ReceiveMsg(string str); 31 | 32 | private: 33 | //Mediator* m_pMediator; 34 | 35 | 36 | }; 37 | 38 | class ConcreteUserB:public User 39 | { 40 | public: 41 | ConcreteUserB(Mediator* med); 42 | ~ConcreteUserB(); 43 | void SendMsg(string str); 44 | void ReceiveMsg(string str); 45 | private: 46 | //Mediator* m_pMediator; 47 | 48 | }; 49 | 50 | #endif // USER_H 51 | -------------------------------------------------------------------------------- /Adapter/InstanceAdapter/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | class Target 6 | { 7 | public: 8 | Target(){} 9 | ~Target(){} 10 | void Request(){cout<<"Target::Request()."<SpecificRequest(); 35 | } 36 | private: 37 | Adapter(); 38 | Adaptee* m_pAdaptee; 39 | 40 | }; 41 | 42 | int main() 43 | { 44 | Adaptee* adaptee = new Adaptee; 45 | Adapter adapter(adaptee); 46 | adapter.Request(); 47 | cout << "Hello world!" << endl; 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /Observer/Subject.h: -------------------------------------------------------------------------------- 1 | #ifndef SUBJECT_H 2 | #define SUBJECT_H 3 | #include 4 | #include 5 | using namespace std; 6 | 7 | class Observer; 8 | class Subject 9 | { 10 | public: 11 | Subject(); 12 | virtual ~Subject(); 13 | void RegisterObserver(Observer* obs); 14 | void DeRegisterObserver(Observer* obs); 15 | void NotifyObservers(); 16 | virtual void PrintState() = 0; 17 | virtual void SetState(string sta)=0; 18 | 19 | protected: 20 | 21 | private: 22 | list* Observer_list; 23 | }; 24 | 25 | class SubjectA:public Subject 26 | { 27 | public: 28 | SubjectA(); 29 | ~SubjectA(); 30 | void PrintState(); 31 | void SetState(string sta); 32 | 33 | private: 34 | string m_pState; 35 | 36 | }; 37 | 38 | class SubjectB:public Subject 39 | { 40 | public: 41 | SubjectB(); 42 | ~SubjectB(); 43 | void PrintState(); 44 | void SetState(string sta); 45 | 46 | private: 47 | string m_pState; 48 | }; 49 | 50 | #endif // SUBJECT_H 51 | -------------------------------------------------------------------------------- /Factory/AbstracFactory/src/Factory.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #include "include/Factory.h" 4 | #include "include/ProductA.h" 5 | #include "include/ProductB.h" 6 | 7 | Factory::Factory() 8 | { 9 | cout<<"Factory::Factory()."< 3 | using namespace std; 4 | 5 | Color::Color():m_sColorName("") 6 | { 7 | cout<<"Color::Color()."<m_sColorName; 18 | } 19 | 20 | Red::Red():m_sColorName("Red") 21 | { 22 | cout<<"Red::Red()"<m_sColorName; 33 | } 34 | 35 | Green::Green():m_sColorName("Green") 36 | { 37 | cout<<"Green::Green()."<m_sColorName; 48 | } 49 | 50 | Blue::Blue():m_sColorName("Blue") 51 | { 52 | cout<<"Blue::Blue()."<m_sColorName; 63 | } 64 | 65 | -------------------------------------------------------------------------------- /Composite/Compositor.h: -------------------------------------------------------------------------------- 1 | #ifndef COMPOSITOR_H 2 | #define COMPOSITOR_H 3 | #include 4 | #include 5 | using namespace std; 6 | 7 | 8 | class AbstractFile 9 | { 10 | public: 11 | AbstractFile(); 12 | ~AbstractFile(); 13 | virtual void AddChild(AbstractFile* rhl); 14 | virtual void RemoveChild(AbstractFile* rhl); 15 | virtual list* GetChild(); 16 | void PrintName() const; 17 | 18 | protected: 19 | string name; 20 | private: 21 | 22 | 23 | }; 24 | 25 | class Folder:public AbstractFile //compositor 26 | { 27 | public : 28 | Folder(string FolderName); 29 | ~Folder(); 30 | virtual void AddChild(AbstractFile* rhl); 31 | virtual void RemoveChild(AbstractFile* rhl); 32 | list* GetChild(); 33 | void PrintName() const; 34 | 35 | private: 36 | list FileSystem; 37 | }; 38 | 39 | class File:public AbstractFile //leaf 40 | { 41 | public: 42 | File(string FileName); 43 | ~File(); 44 | void PrintName() const; 45 | 46 | private: 47 | 48 | }; 49 | 50 | 51 | #endif // COMPOSITOR_H 52 | -------------------------------------------------------------------------------- /Builder/Builder.h: -------------------------------------------------------------------------------- 1 | #ifndef BUILDER_H 2 | #define BUILDER_H 3 | 4 | 5 | class Builder 6 | { 7 | public: 8 | Builder(); 9 | virtual ~Builder(); 10 | virtual void BuildCPU() const = 0; 11 | virtual void BuildMemory() const = 0; 12 | virtual void BuildDisk() const = 0; 13 | virtual void BuildKey() const = 0; 14 | virtual void BuildMouse() const = 0; 15 | 16 | protected: 17 | private: 18 | }; 19 | 20 | class PcBuilder:public Builder 21 | { 22 | public: 23 | PcBuilder(); 24 | ~PcBuilder(); 25 | 26 | void BuildCPU() const; 27 | void BuildMemory() const; 28 | void BuildDisk() const; 29 | void BuildKey() const; 30 | void BuildMouse() const; 31 | 32 | protected: 33 | 34 | private: 35 | }; 36 | 37 | 38 | class LaptopBuilder:public Builder 39 | { 40 | public: 41 | LaptopBuilder(); 42 | ~LaptopBuilder(); 43 | 44 | void BuildCPU() const; 45 | void BuildMemory() const; 46 | void BuildDisk() const; 47 | void BuildKey() const; 48 | void BuildMouse() const; 49 | 50 | protected: 51 | 52 | private: 53 | }; 54 | #endif // BUILDER_H 55 | -------------------------------------------------------------------------------- /Proxy/Proxy.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 41 | 42 | -------------------------------------------------------------------------------- /State/State.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 41 | 42 | -------------------------------------------------------------------------------- /Bridge/Bridge.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 41 | 42 | -------------------------------------------------------------------------------- /Facade/Facade.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 41 | 42 | -------------------------------------------------------------------------------- /Command/Command.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 41 | 42 | -------------------------------------------------------------------------------- /Memento/Memento.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 41 | 42 | -------------------------------------------------------------------------------- /Visitor/Visitor.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 41 | 42 | -------------------------------------------------------------------------------- /Iterator/Iterator.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 41 | 42 | -------------------------------------------------------------------------------- /Mediator/Mediator.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 41 | 42 | -------------------------------------------------------------------------------- /Strategy/Strategy.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 41 | 42 | -------------------------------------------------------------------------------- /Template/Template.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 41 | 42 | -------------------------------------------------------------------------------- /Composite/Composite.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 41 | 42 | -------------------------------------------------------------------------------- /Flyweight/Flyweight.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 41 | 42 | -------------------------------------------------------------------------------- /Factory/FactoryMethod/Factory.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 41 | 42 | -------------------------------------------------------------------------------- /Interpretor/Interpretor.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 41 | 42 | -------------------------------------------------------------------------------- /Decorator/Decorator.cpp: -------------------------------------------------------------------------------- 1 | #include "Decorator.h" 2 | #include 3 | using namespace std; 4 | 5 | Animal::Animal() 6 | { 7 | cout<<"Animal::Animal()."<eat(); 64 | } 65 | -------------------------------------------------------------------------------- /Adapter/ClassAdapter/ClassAdapter.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 41 | 42 | -------------------------------------------------------------------------------- /Bridge/Shape.h: -------------------------------------------------------------------------------- 1 | #ifndef SHAPE_H 2 | #define SHAPE_H 3 | #include "Color.h" 4 | class Color; 5 | 6 | class Shape 7 | { 8 | public: 9 | Shape(); 10 | virtual ~Shape(); 11 | virtual void DrawRed(); 12 | virtual void DrawGreen(); 13 | virtual void DrawBlue(); 14 | 15 | protected: 16 | 17 | private: 18 | 19 | 20 | 21 | }; 22 | 23 | class Circle:public Shape 24 | { 25 | public: 26 | Circle(Color* rhl); 27 | ~Circle(); 28 | void DrawRed(); 29 | void DrawGreen(); 30 | void DrawBlue(); 31 | 32 | private: 33 | Circle operator=(const Circle&); 34 | Color* m_pColor; 35 | 36 | }; 37 | 38 | class Rectangle:public Shape 39 | { 40 | public: 41 | Rectangle(Color* rhl); 42 | ~Rectangle(); 43 | void DrawRed(); 44 | void DrawGreen(); 45 | void DrawBlue(); 46 | 47 | 48 | private: 49 | Color* m_pColor; 50 | 51 | }; 52 | 53 | class Triangle:public Shape 54 | { 55 | public: 56 | Triangle(Color* rhl); 57 | ~Triangle(); 58 | void DrawRed(); 59 | void DrawGreen(); 60 | void DrawBlue(); 61 | 62 | 63 | private: 64 | Color* m_pColor; 65 | }; 66 | 67 | #endif // SHAPE_H 68 | -------------------------------------------------------------------------------- /Prototype/Prototype.cpp: -------------------------------------------------------------------------------- 1 | #include "Prototype.h" 2 | #include 3 | using namespace std; 4 | 5 | 6 | Prototype::Prototype() 7 | { 8 | cout<<"Prototype::Prototype()."< 2 | 3 | 4 | 5 | 41 | 42 | -------------------------------------------------------------------------------- /Adapter/InstanceAdapter/InstanceAdapter.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 41 | 42 | -------------------------------------------------------------------------------- /Observer/Subject.cpp: -------------------------------------------------------------------------------- 1 | #include "Subject.h" 2 | #include "Observer.h" 3 | 4 | class Observer; 5 | 6 | Subject::Subject() 7 | { 8 | Observer_list = new list; 9 | } 10 | 11 | Subject::~Subject() 12 | { 13 | //dtor 14 | } 15 | 16 | void Subject::RegisterObserver(Observer* obs) 17 | { 18 | Observer_list->push_front(obs); 19 | } 20 | 21 | void Subject::DeRegisterObserver(Observer* obs) 22 | { 23 | if(obs!=NULL) 24 | Observer_list->remove(obs); 25 | } 26 | 27 | void Subject::NotifyObservers() 28 | { 29 | list::iterator it; 30 | for(it=Observer_list->begin();it!=Observer_list->end();it++) 31 | (*it)->update(this); 32 | } 33 | 34 | 35 | SubjectA::SubjectA() 36 | { 37 | //m_pState = NULL; 38 | } 39 | 40 | SubjectA::~SubjectA() 41 | { 42 | 43 | } 44 | 45 | void SubjectA::SetState(string sta) 46 | { 47 | m_pState = sta; 48 | } 49 | 50 | void SubjectA::PrintState() 51 | { 52 | cout<<"In SubjectA, State is: "< 2 | 3 | 4 | 5 | 41 | 42 | -------------------------------------------------------------------------------- /Decorator/Decorator.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 43 | 44 | -------------------------------------------------------------------------------- /Prototype/Prototype.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 43 | 44 | -------------------------------------------------------------------------------- /Singleton/Singleton.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 43 | 44 | -------------------------------------------------------------------------------- /Builder/Builder.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 45 | 46 | -------------------------------------------------------------------------------- /Bridge/main.cpp: -------------------------------------------------------------------------------- 1 | //****************************************** 2 | //Author: Kevin Fu 3 | //Email: kevinfu1985@gmail.com 4 | //Date: 2013/09/12 5 | //File: Bridge factory(main.cpp), use to seperate the abstraction and implemention. 6 | //****************************************** 7 | #include 8 | #include "Color.h" 9 | #include "Shape.h" 10 | 11 | using namespace std; 12 | 13 | 14 | 15 | int main() 16 | { 17 | Color* red = new Red(); 18 | Color* green = new Green(); 19 | Color* blue = new Blue(); 20 | 21 | Shape* circle_red = new Circle(red); 22 | Shape* circle_green = new Circle(green); 23 | Shape* circle_blue = new Circle(blue); 24 | 25 | Shape* rectangle_red = new Rectangle(red); 26 | Shape* rectangle_green = new Triangle(green); 27 | Shape* rectangle_blue = new Rectangle(blue); 28 | 29 | Shape* triangle_red = new Triangle(red); 30 | Shape* triangle_green = new Triangle(green); 31 | Shape* triangle_blue = new Triangle(blue); 32 | 33 | 34 | circle_red->DrawRed(); 35 | circle_green->DrawGreen(); 36 | circle_blue->DrawBlue(); 37 | 38 | rectangle_red->DrawRed(); 39 | rectangle_blue->DrawBlue(); 40 | rectangle_green->DrawGreen(); 41 | 42 | triangle_red->DrawRed(); 43 | triangle_green->DrawGreen(); 44 | triangle_blue->DrawBlue(); 45 | 46 | cout << "Hello world!" << endl; 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /Observer/Observer.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 45 | 46 | -------------------------------------------------------------------------------- /Factory/SimpleFactory/SimpleFactory.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 45 | 46 | -------------------------------------------------------------------------------- /Builder/Builder.cpp: -------------------------------------------------------------------------------- 1 | #include "Builder.h" 2 | #include 3 | using namespace std; 4 | 5 | Builder::Builder() 6 | { 7 | 8 | } 9 | 10 | Builder::~Builder() 11 | { 12 | 13 | } 14 | 15 | PcBuilder::PcBuilder() 16 | { 17 | cout<<"PcBuilder::PcBuilder()"< 2 | 3 | using namespace std; 4 | 5 | class Memento 6 | { 7 | public: 8 | //Memento(){m_pState = "";} 9 | Memento(string sta){m_pState = sta;} 10 | ~Memento(){} 11 | void SetState(string sta){m_pState = sta;} 12 | string GetState(){return m_pState;} 13 | 14 | private: 15 | string m_pState; 16 | 17 | }; 18 | 19 | class Origion 20 | { 21 | public: 22 | Origion(){m_pState = "";} 23 | ~Origion(){} 24 | Memento* CreateMemento(){return new Memento(m_pState);} 25 | void RecoverFromMemento(Memento* mem){this->m_pState = mem->GetState();} 26 | void SetState(string sta){this->m_pState = sta;} 27 | string GetState(){return m_pState;} 28 | 29 | private: 30 | string m_pState; 31 | }; 32 | 33 | class RestoreMemento 34 | { 35 | public: 36 | RestoreMemento(){m_pMemento = NULL;} 37 | void SaveMemento(Memento* mem){m_pMemento = mem;} 38 | Memento* GetMemento(){return m_pMemento;} 39 | 40 | private: 41 | Memento* m_pMemento; 42 | }; 43 | 44 | 45 | int main() 46 | { 47 | Origion* ori = new Origion(); 48 | ori->SetState("State 1"); 49 | cout<<"First state: "<GetState()<SaveMemento(ori->CreateMemento()); 54 | 55 | ori->SetState("State 2"); 56 | cout<<"Second state: "<GetState()<GetMemento()->GetState()<* AbstractFile::GetChild() 29 | { 30 | 31 | } 32 | 33 | void AbstractFile::PrintName() const 34 | { 35 | cout<* Getchild(AbstractFile* File) 39 | { 40 | return NULL; 41 | } 42 | //*********************************** 43 | // Folder class implementation 44 | //*********************************** 45 | 46 | Folder::Folder(string FolderName) 47 | { 48 | this->name = FolderName; 49 | cout<<"Folder::Folder()."<name<* Folder::GetChild() 73 | { 74 | return &FileSystem; 75 | } 76 | //*********************************** 77 | // File class implementation 78 | //*********************************** 79 | 80 | File::File(string FileName) 81 | { 82 | this->name = FileName; 83 | cout<<"File::File()."<name< 3 | using namespace std; 4 | 5 | 6 | //***********implementation of class Approver*****************// 7 | Approver::Approver():m_pApprover(NULL) 8 | { 9 | //ctor 10 | } 11 | 12 | Approver::~Approver() 13 | { 14 | //dtor 15 | } 16 | 17 | void Approver::HandleRequest(int num) 18 | { 19 | 20 | } 21 | 22 | void Approver::SetApprover(Approver* app) 23 | { 24 | m_pApprover = app; 25 | } 26 | 27 | Approver* Approver::GetApprover() const 28 | { 29 | return m_pApprover; 30 | } 31 | 32 | 33 | //****************Implementation of class ProjectManager**************// 34 | 35 | ProjectManager::ProjectManager() 36 | { 37 | 38 | } 39 | 40 | ProjectManager::~ProjectManager() 41 | { 42 | 43 | } 44 | 45 | void ProjectManager::HandleRequest(int num) 46 | { 47 | if(num<5000 &&num> 0) 48 | cout<<"Approved by Project Manager."<GetApprover()->HandleRequest(num); 51 | } 52 | 53 | 54 | //***************Implementation of class Director**************// 55 | 56 | Director::Director() 57 | { 58 | 59 | } 60 | 61 | Director::~Director() 62 | { 63 | 64 | } 65 | 66 | void Director::HandleRequest(int num) 67 | { 68 | if(num<10000 && num>5000) 69 | cout<<"Approved by Director."<GetApprover()->HandleRequest(num); 72 | } 73 | 74 | 75 | 76 | //**************implementation of class VicePresident******************// 77 | 78 | VicePresident::VicePresident() 79 | { 80 | 81 | } 82 | 83 | VicePresident::~VicePresident() 84 | { 85 | 86 | } 87 | 88 | void VicePresident::HandleRequest(int num) 89 | { 90 | if(num>10000) 91 | cout<<"Approved by Vice President."<GetApprover()->HandleRequest(num); 94 | } 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /Bridge/Shape.cpp: -------------------------------------------------------------------------------- 1 | #include "Shape.h" 2 | #include 3 | using namespace std; 4 | 5 | 6 | Shape::Shape() 7 | { 8 | cout<<"Shape::Shape()."<GetColorName()<<"Circle"<GetColorName()<<"Circle"<GetColorName()<<"Circle"<GetColorName()<<"Rectangle"<GetColorName()<<"Rectangle"<GetColorName()<<"Rectangle"<GetColorName()<<"Rectangle"<GetColorName()<<"Rectangle"<GetColorName()<<"Rectangle"<::iterator fly_iter; 61 | for(fly_iter = m_lfly.begin();fly_iter!=m_lfly.end();fly_iter++) 62 | { 63 | if((*fly_iter)->GetInstanceStatus() == status ) 64 | { 65 | cout<<"This instance "<<"\""< 2 | 3 | 4 | 5 | 6 | 7 | UMLStandard 8 | 9 | 10 | 11 | 12 | Untitled 13 | 5 14 | 15 | Use Case Model 16 | UMLStandard 17 | useCaseModel 18 | 2Z4+fYKJRkmriwpCJA+oxwAA 19 | 1 20 | 21 | Main 22 | l2lU3GbR/kaVZuAR/O2lawAA 23 | 24 | 6Qm0D7DBoEWvIGsVk2zQ+gAA 25 | 26 | 27 | 28 | 29 | Analysis Model 30 | UMLStandard 31 | analysisModel 32 | 2Z4+fYKJRkmriwpCJA+oxwAA 33 | 1 34 | 35 | Main 36 | True 37 | RobustnessDiagram 38 | 0eX6YcN3y0eX2uWDWFUK+wAA 39 | 40 | ZXe9rqhE1EC9yvcFjuH/ZwAA 41 | 42 | 43 | 44 | 45 | Design Model 46 | UMLStandard 47 | designModel 48 | 2Z4+fYKJRkmriwpCJA+oxwAA 49 | 1 50 | 51 | Main 52 | True 53 | Z7kFtHpAv0G0u5PD0YBX2wAA 54 | 55 | BZiVubasx0CzBNb9fIvbDQAA 56 | 5 57 | 58 | clMaroon 59 | $00B9FFFF 60 | 568 61 | 160 62 | 151 63 | 94 64 | aghOz978yUGwqnEPqZKbxwAA 65 | 66 | 67 | 1 68 | Animal 69 | 70 | 71 | False 72 | 73 | 74 | False 75 | 76 | 77 | 78 | aghOz978yUGwqnEPqZKbxwAA 79 | 80 | 81 | aghOz978yUGwqnEPqZKbxwAA 82 | 83 | 84 | False 85 | aghOz978yUGwqnEPqZKbxwAA 86 | 87 | 88 | 89 | clMaroon 90 | $00B9FFFF 91 | 480 92 | 356 93 | 96 94 | 78 95 | 67xuQCmSk0mk5+GKL94gNwAA 96 | 97 | 98 | 1 99 | Cat 100 | 101 | 102 | False 103 | 104 | 105 | False 106 | 107 | 108 | 109 | 67xuQCmSk0mk5+GKL94gNwAA 110 | 111 | 112 | 67xuQCmSk0mk5+GKL94gNwAA 113 | 114 | 115 | False 116 | 67xuQCmSk0mk5+GKL94gNwAA 117 | 118 | 119 | 120 | clMaroon 121 | $00B9FFFF 122 | 732 123 | 352 124 | 91 125 | 78 126 | Q6QYwzjq1Uy8bkQ6kXP26QAA 127 | 128 | 129 | 1 130 | Dog 131 | 132 | 133 | False 134 | 135 | 136 | False 137 | 138 | 139 | 140 | Q6QYwzjq1Uy8bkQ6kXP26QAA 141 | 142 | 143 | Q6QYwzjq1Uy8bkQ6kXP26QAA 144 | 145 | 146 | False 147 | Q6QYwzjq1Uy8bkQ6kXP26QAA 148 | 149 | 150 | 151 | clMaroon 152 | $00B9FFFF 153 | 550,356;614,253 154 | ILhr3f6CrkuYrOsnLg0vVAAA 155 | 4yZMYUUhXkiddGZwltzc4QAA 156 | ZeyMM5fWA0iEU9qb1JglAQAA 157 | 158 | False 159 | 1.5707963267949 160 | 15 161 | ILhr3f6CrkuYrOsnLg0vVAAA 162 | 163 | 164 | False 165 | 1.5707963267949 166 | 30 167 | ILhr3f6CrkuYrOsnLg0vVAAA 168 | 169 | 170 | False 171 | -1.5707963267949 172 | 15 173 | ILhr3f6CrkuYrOsnLg0vVAAA 174 | 175 | 176 | 177 | clMaroon 178 | $00B9FFFF 179 | 749,352;677,253 180 | 2VUW6R3T+0S8/cTkRHcOCwAA 181 | 4yZMYUUhXkiddGZwltzc4QAA 182 | EV69TW0uR0Oml6QOm+9yqwAA 183 | 184 | False 185 | 1.5707963267949 186 | 15 187 | 2VUW6R3T+0S8/cTkRHcOCwAA 188 | 189 | 190 | False 191 | 1.5707963267949 192 | 30 193 | 2VUW6R3T+0S8/cTkRHcOCwAA 194 | 195 | 196 | False 197 | -1.5707963267949 198 | 15 199 | 2VUW6R3T+0S8/cTkRHcOCwAA 200 | 201 | 202 | 203 | 204 | 9 205 | 206 | Animal 207 | Z7kFtHpAv0G0u5PD0YBX2wAA 208 | 4 209 | 4yZMYUUhXkiddGZwltzc4QAA 210 | YbYdHjOXp02Su6Fp7j+6dAAA 211 | 0MP1xcJdLEOFrt0hQFhTmwAA 212 | rWrbkzO65EexIxjmpm5ClQAA 213 | 2 214 | ILhr3f6CrkuYrOsnLg0vVAAA 215 | 2VUW6R3T+0S8/cTkRHcOCwAA 216 | 3 217 | 218 | void TemplateMethod 219 | aghOz978yUGwqnEPqZKbxwAA 220 | 221 | 222 | virtual void Eat 223 | aghOz978yUGwqnEPqZKbxwAA 224 | 225 | 226 | virtual void Sleep 227 | aghOz978yUGwqnEPqZKbxwAA 228 | 229 | 230 | 231 | Cat 232 | Z7kFtHpAv0G0u5PD0YBX2wAA 233 | 4 234 | ZeyMM5fWA0iEU9qb1JglAQAA 235 | OVyyhjtKN02+O+Cq9ghv8QAA 236 | KHeHx0G1TEOVZHhYz085UAAA 237 | 7H59HY9yO0iMDcoG+c0oAQAA 238 | 1 239 | ILhr3f6CrkuYrOsnLg0vVAAA 240 | 2 241 | 242 | void Eat 243 | 67xuQCmSk0mk5+GKL94gNwAA 244 | 245 | 246 | void Sleep 247 | 67xuQCmSk0mk5+GKL94gNwAA 248 | 249 | 250 | 251 | Dog 252 | Z7kFtHpAv0G0u5PD0YBX2wAA 253 | 4 254 | EV69TW0uR0Oml6QOm+9yqwAA 255 | 4hp63CmZpE2v197eV7DLNwAA 256 | ye+UrLaZakaGKZwOG8nMNAAA 257 | 7Sv4eUmofEiK88pD3IljoQAA 258 | 1 259 | 2VUW6R3T+0S8/cTkRHcOCwAA 260 | 2 261 | 262 | void Eat 263 | Q6QYwzjq1Uy8bkQ6kXP26QAA 264 | 265 | 266 | void Sleep 267 | Q6QYwzjq1Uy8bkQ6kXP26QAA 268 | 269 | 270 | 271 | Z7kFtHpAv0G0u5PD0YBX2wAA 272 | 67xuQCmSk0mk5+GKL94gNwAA 273 | aghOz978yUGwqnEPqZKbxwAA 274 | 4 275 | waZNJEXlW0OdCApeGnPzjwAA 276 | E2UXRgZ61ECJcq3rntSJXQAA 277 | U1uzVRHph0qadUnCdi9HNAAA 278 | nnnCv7Eb1UWRYlzIZNY3AwAA 279 | 280 | 281 | Z7kFtHpAv0G0u5PD0YBX2wAA 282 | Q6QYwzjq1Uy8bkQ6kXP26QAA 283 | aghOz978yUGwqnEPqZKbxwAA 284 | 4 285 | 8E0zdu7LZEWdsReWH13qHAAA 286 | WJ2ElCgSnE6N/2esxP5+iwAA 287 | 9O3h9avTS0SdaFCFd2BJSwAA 288 | 2euddsCA0Uqd0l8RZrdCDQAA 289 | 290 | 291 | void 292 | Z7kFtHpAv0G0u5PD0YBX2wAA 293 | 294 | 295 | void TemplateMethod() 296 | Z7kFtHpAv0G0u5PD0YBX2wAA 297 | 298 | 299 | df 300 | Z7kFtHpAv0G0u5PD0YBX2wAA 301 | 302 | 303 | Signal1 304 | Z7kFtHpAv0G0u5PD0YBX2wAA 305 | 306 | 307 | 308 | Implementation Model 309 | UMLStandard 310 | implementationModel 311 | 2Z4+fYKJRkmriwpCJA+oxwAA 312 | 1 313 | 314 | Main 315 | 2ZSBAL8UdkaYnKdygxTmAgAA 316 | 317 | A93GqoF8nkW7sQOl3iIlFwAA 318 | 319 | 320 | 321 | 322 | Deployment Model 323 | UMLStandard 324 | deploymentModel 325 | 2Z4+fYKJRkmriwpCJA+oxwAA 326 | 1 327 | 328 | Main 329 | 0hIAYt9qX0SIc007hHcTiwAA 330 | 331 | EohA/hGEsEOg8Lc+Xv7KmgAA 332 | 333 | 334 | 335 | 336 | 337 | 338 | -------------------------------------------------------------------------------- /Memento/Memento.uml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | UMLStandard 8 | 9 | 10 | 11 | 12 | Untitled 13 | 5 14 | 15 | Use Case Model 16 | UMLStandard 17 | useCaseModel 18 | UcN5/Hmit02RwTgBILCZzwAA 19 | 1 20 | 21 | Main 22 | JYQDZxdGVEOO7FtjA8cWPgAA 23 | 24 | 92ykavzYUk2Hx6s2OMo9JwAA 25 | 26 | 27 | 28 | 29 | Analysis Model 30 | UMLStandard 31 | analysisModel 32 | UcN5/Hmit02RwTgBILCZzwAA 33 | 1 34 | 35 | Main 36 | True 37 | RobustnessDiagram 38 | ffertWnCPkaT/cp+Bn0zlgAA 39 | 40 | PPJ2vdMSY0GLni+CCi7FIQAA 41 | 42 | 43 | 44 | 45 | Design Model 46 | UMLStandard 47 | designModel 48 | UcN5/Hmit02RwTgBILCZzwAA 49 | 1 50 | 51 | Main 52 | True 53 | vo7DCKY5hkesMKYvgrez/wAA 54 | 55 | XgNCiccLSkG7prsRYVIxkQAA 56 | 5 57 | 58 | clMaroon 59 | $00B9FFFF 60 | 644 61 | 128 62 | 157 63 | 94 64 | y7nni7KzjUWsRK7cid+3+AAA 65 | 66 | 67 | 1 68 | Memento 69 | 70 | 71 | False 72 | 73 | 74 | False 75 | 76 | 77 | 78 | y7nni7KzjUWsRK7cid+3+AAA 79 | 80 | 81 | y7nni7KzjUWsRK7cid+3+AAA 82 | 83 | 84 | False 85 | y7nni7KzjUWsRK7cid+3+AAA 86 | 87 | 88 | 89 | clMaroon 90 | $00B9FFFF 91 | 260 92 | 116 93 | 270 94 | 126 95 | eE3OXnf110es67X0hvqj+gAA 96 | 97 | 98 | 1 99 | Origion 100 | 101 | 102 | False 103 | 104 | 105 | False 106 | 107 | 108 | 109 | eE3OXnf110es67X0hvqj+gAA 110 | 111 | 112 | eE3OXnf110es67X0hvqj+gAA 113 | 114 | 115 | False 116 | eE3OXnf110es67X0hvqj+gAA 117 | 118 | 119 | 120 | clMaroon 121 | $00B9FFFF 122 | 612 123 | 344 124 | 221 125 | 110 126 | 9lLODMyJxUOBrOxKggA5IQAA 127 | 128 | 129 | 1 130 | RestoreMemento 131 | 132 | 133 | False 134 | 135 | 136 | False 137 | 138 | 139 | 140 | 9lLODMyJxUOBrOxKggA5IQAA 141 | 142 | 143 | 9lLODMyJxUOBrOxKggA5IQAA 144 | 145 | 146 | False 147 | 9lLODMyJxUOBrOxKggA5IQAA 148 | 149 | 150 | 151 | clMaroon 152 | $00B9FFFF 153 | 529,176;644,175 154 | MFXaGh28CkqvIwM/JcQYvgAA 155 | yVAwAInLzEuVHOB3aeZaAgAA 156 | +u2ZJnRzBk+huSGkhA/7rwAA 157 | 158 | False 159 | 1.5707963267949 160 | 15 161 | MFXaGh28CkqvIwM/JcQYvgAA 162 | 163 | 164 | False 165 | 1.5707963267949 166 | 30 167 | MFXaGh28CkqvIwM/JcQYvgAA 168 | 169 | 170 | False 171 | -1.5707963267949 172 | 15 173 | MFXaGh28CkqvIwM/JcQYvgAA 174 | 175 | 176 | 177 | clMaroon 178 | $00B9FFFF 179 | 722,344;722,221 180 | QtAQZvle70qEFdoS2k2EXQAA 181 | yVAwAInLzEuVHOB3aeZaAgAA 182 | bbiAJhGa6kKORC5E/l2zUQAA 183 | 184 | False 185 | 1.5707963267949 186 | 15 187 | QtAQZvle70qEFdoS2k2EXQAA 188 | 189 | 190 | False 191 | 1.5707963267949 192 | 30 193 | QtAQZvle70qEFdoS2k2EXQAA 194 | 195 | 196 | False 197 | -1.5707963267949 198 | 15 199 | QtAQZvle70qEFdoS2k2EXQAA 200 | 201 | 202 | False 203 | -0.523598775598299 204 | 30 205 | epHead 206 | B80sr6+rJ0mFTuc5r1dhrgAA 207 | 208 | 209 | False 210 | 0.523598775598299 211 | 30 212 | epTail 213 | 0/0j3K6TBUimB8/W3CJ8OAAA 214 | 215 | 216 | False 217 | 0.523598775598299 218 | 25 219 | epHead 220 | B80sr6+rJ0mFTuc5r1dhrgAA 221 | 222 | 223 | False 224 | -0.523598775598299 225 | 25 226 | epTail 227 | 0/0j3K6TBUimB8/W3CJ8OAAA 228 | 229 | 230 | False 231 | -0.785398163397448 232 | 40 233 | epHead 234 | B80sr6+rJ0mFTuc5r1dhrgAA 235 | 236 | 237 | False 238 | 0.785398163397448 239 | 40 240 | epTail 241 | 0/0j3K6TBUimB8/W3CJ8OAAA 242 | 243 | 244 | False 245 | -1000 246 | -1000 247 | 50 248 | 8 249 | B80sr6+rJ0mFTuc5r1dhrgAA 250 | 251 | 252 | False 253 | -1000 254 | -1000 255 | 50 256 | 8 257 | 0/0j3K6TBUimB8/W3CJ8OAAA 258 | 259 | 260 | 261 | 262 | 5 263 | 264 | Memento 265 | vo7DCKY5hkesMKYvgrez/wAA 266 | 4 267 | yVAwAInLzEuVHOB3aeZaAgAA 268 | lREuY7F/ZkymSAY+RJDEVQAA 269 | WWoGfypy4UG9yUEAgPnU1gAA 270 | j4MP3VIBoUWVuZssQcWAqQAA 271 | 1 272 | MFXaGh28CkqvIwM/JcQYvgAA 273 | 2 274 | 275 | void SetState 276 | y7nni7KzjUWsRK7cid+3+AAA 277 | 1 278 | 279 | string sta 280 | RN22QuOUZkSfi/hkGGSwpQAA 281 | 282 | 283 | 284 | string GetState 285 | y7nni7KzjUWsRK7cid+3+AAA 286 | 287 | 1 288 | B80sr6+rJ0mFTuc5r1dhrgAA 289 | 1 290 | 291 | string m_pState 292 | y7nni7KzjUWsRK7cid+3+AAA 293 | 294 | 295 | 296 | Origion 297 | vo7DCKY5hkesMKYvgrez/wAA 298 | 4 299 | +u2ZJnRzBk+huSGkhA/7rwAA 300 | Zfh+VCn/3UCWg3WnnNxCqwAA 301 | ZT0NVToNWEeVqSnBwbsYeQAA 302 | g+xzLjlxjke02SzZ6sP4WQAA 303 | 1 304 | MFXaGh28CkqvIwM/JcQYvgAA 305 | 4 306 | 307 | Memento CreateMemento 308 | eE3OXnf110es67X0hvqj+gAA 309 | 310 | 311 | void RecoverFromMemento 312 | eE3OXnf110es67X0hvqj+gAA 313 | 1 314 | 315 | Memento mem 316 | dsyCZk1M9keZ+cy9E8fbTQAA 317 | 318 | 319 | 320 | void SetState 321 | eE3OXnf110es67X0hvqj+gAA 322 | 1 323 | 324 | string str 325 | Lyi4YhYYBE6OVAETrQeiYQAA 326 | 327 | 328 | 329 | string GetState 330 | eE3OXnf110es67X0hvqj+gAA 331 | 332 | 1 333 | 334 | string m_pState 335 | eE3OXnf110es67X0hvqj+gAA 336 | 337 | 338 | 339 | RestoreMemento 340 | vo7DCKY5hkesMKYvgrez/wAA 341 | 4 342 | bbiAJhGa6kKORC5E/l2zUQAA 343 | X9MTO8reRkuPv5uPAJY0tgAA 344 | aD/gJHJDXEmhxkPpeU4A+wAA 345 | c82BT/EmXkSFBFxBAbPGSQAA 346 | 2 347 | 348 | Memento* GetMemento 349 | 9lLODMyJxUOBrOxKggA5IQAA 350 | 351 | 352 | void SetMemento 353 | 9lLODMyJxUOBrOxKggA5IQAA 354 | 1 355 | 356 | Memento* mem 357 | 1CT7xXjfqEeFYDLr8LJAqQAA 358 | 359 | 360 | 1 361 | 0/0j3K6TBUimB8/W3CJ8OAAA 362 | 1 363 | 364 | Memento* mem 365 | 9lLODMyJxUOBrOxKggA5IQAA 366 | 367 | 368 | 369 | vo7DCKY5hkesMKYvgrez/wAA 370 | eE3OXnf110es67X0hvqj+gAA 371 | y7nni7KzjUWsRK7cid+3+AAA 372 | 4 373 | PngHUxBOwkaBF5X/xTi4RAAA 374 | rkviJfN/hUGyk6jBnzxLMgAA 375 | oXNOSdZCDESh7D06xp/IuQAA 376 | wqFb/iALXUmkmp0alt10CAAA 377 | 378 | 379 | vo7DCKY5hkesMKYvgrez/wAA 380 | 4 381 | v0yykMODbEWZUskkZTZhKgAA 382 | U3P0cra/EUGimpGIYNadPAAA 383 | mezm6tItQk2G8XTG/8H0GAAA 384 | xUWpoasDdUCgqrw1v8UkvAAA 385 | 2 386 | 387 | QtAQZvle70qEFdoS2k2EXQAA 388 | 9lLODMyJxUOBrOxKggA5IQAA 389 | 4 390 | ksoEm47P1kencgVuAw8hSwAA 391 | sU2+RTYDa0GQf1LBStT4cQAA 392 | LLpiOQxG1E6gN075iNtCtgAA 393 | 0Y0t7AcYdUi1c87mRLeimgAA 394 | 395 | 396 | akComposite 397 | QtAQZvle70qEFdoS2k2EXQAA 398 | y7nni7KzjUWsRK7cid+3+AAA 399 | 4 400 | 61MS3eyChk+LbGCSpnXRRwAA 401 | MWdwA8WIw029+v5NmoWrOwAA 402 | EMtYOZ0zfUaIWe1/GbJ9XgAA 403 | RiyT+UAqvk2EBv2bBz826QAA 404 | 405 | 406 | 407 | 408 | Implementation Model 409 | UMLStandard 410 | implementationModel 411 | UcN5/Hmit02RwTgBILCZzwAA 412 | 1 413 | 414 | Main 415 | AaEtQY/JXEScTckCjlrT/AAA 416 | 417 | avvvr3jeL0iV8VwD61cY8QAA 418 | 419 | 420 | 421 | 422 | Deployment Model 423 | UMLStandard 424 | deploymentModel 425 | UcN5/Hmit02RwTgBILCZzwAA 426 | 1 427 | 428 | Main 429 | wDHKQZjzik+4FZ4o9R9raAAA 430 | 431 | TCYwXF3/D0GmXqSZvaDNbwAA 432 | 433 | 434 | 435 | 436 | 437 | 438 | --------------------------------------------------------------------------------