[英]C++ example of implementation composite and visitor pattern together
Now I'm developing a specialized vector editor. 现在我正在开发一个专门的矢量编辑器。 Can you tell me where I can see a good example (only C++ language ) of source (not standard book example) implementation composite and visitor pattern together. 你能告诉我在哪里可以看到一个很好的例子(只有C ++语言)的源(不是标准书示例)实现复合和访问者模式在一起。
A quick google search gave me these implementation examples of Composite Pattern: 快速谷歌搜索给了我这些复合模式的实现示例:
Composite + visitor isn't such a popular pair, in most cases you can see composite + iterator ... so you will have to try add them by your own hands, but it shouldn't be hard. 复合+访客不是那么受欢迎的一对,在大多数情况下你可以看到复合+迭代器...所以你必须尝试自己添加它们,但它应该不难。 In both patterns you have inteface implemented by concrete classes, so you have to fill your composite with visitor ideas 在这两种模式中,您都可以通过具体类来实现接口,因此您必须使用访问者的想法来填充复合材料
http://sourcemaking.com/design_patterns/composite/cpp/2 http://sourcemaking.com/design_patterns/composite/cpp/2
http://sourcemaking.com/design_patterns/composite/cpp/1 http://sourcemaking.com/design_patterns/composite/cpp/1
http://sourcemaking.com/design_patterns/visitor http://sourcemaking.com/design_patterns/visitor
gl :) gl :)
This example source code is based upon the file system example found in the book Pattern Hatching: Design Patterns Applied , by John Vlissides, which uses Composite and Visitor. 此示例源代码基于John Vlissides撰写的Pattern Hatching:Design Patterns Applied一书中的文件系统示例,该书使用Composite和Visitor。 (The code includes external iterator that is not in the book). (代码包括本书中没有的外部迭代器)。
Free slides detailing the example from the book are at Designing with Patterns . 详细介绍本书中的示例的免费幻灯片在Designing with Patterns中 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.