• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 100,  comments - 15,  trackbacks - 0
            /*
             * 5_9_Strategy.cpp
             *  
             *  Created on: 2010-9-25
             *      Author: wyiu
             
            */

            class Compositor
            {
            public:
                
            virtual int compose(Coord natural[], Coord stretch[], Coord shrink[],
                                
            int componentCount, int lineWidth, int breaks) = 0;

            protected:
                Compositor();

            };

            //------------------------------------------------------------------------
            class Composition
            {
            public:
                Composition(Compositor 
            *);
                
            void repair();

            private:
                Compositor 
            *_compositor;
                Component 
            *_components;
                
            int _componentCount;
                
            int _lineWidth;
                
            int *_lineBreaks;
                
            int _lineCount;
            };

            void Composition::repair()
            {
                Coord 
            *natural;
                Coord 
            *stretchability;
                Coord 
            *shrinkability;
                
            int componentCount;
                
            int *breaks;

                
            //prepare the arrays with the desired component sizes
                
            //

                
            //determine where the breaks are:
                int breakCount;
                breakCount 
            = _compositor->compose(natural, stretchability, shrinkability,
                                                    componentCount, _lineWidth, breaks);

                
            //lay out components according to breaks
                
            //
            }

            //--------------------------------------------------------------------
            //subclass of Compositor
            class SimpleCompositor : public Compositor
            {
            public:
                SimpleCompositor();

                
            virtual int compose(Coord natural[], Coord stretch[], Coord shrink[],
                                
            int componentCount, int lineWidth, int breaks);

                
            //
            };

            class TeXCompositor : public Compositor
            {
            public:
                TeXCompositor();

                
            virtual int compose(Coord natural[], Coord stretch[], Coord shrink[],
                                
            int componentCount, int lineWidth, int breaks);

                
            //
            };

            class ArrayCompositor : public Compositor
            {
            public:
                ArrayCompositor();

                
            virtual int compose(Coord natural[], Coord stretch[], Coord shrink[],
                                
            int componentCount, int lineWidth, int breaks);

                
            //
            };

            //-----------------------------------------
            //using example
            int main()
            {
                
            //

                Composition 
            *quick = new Composition(new SimpleCompositor);
                Composition 
            *slick = new Composition(new TeXCompositor);
                Composition 
            *iconic = new Composition(new ArrayCompositor);

                
            //.

                
            return 0;
            }
            posted on 2010-10-04 12:27 wyiu 閱讀(316) 評(píng)論(0)  編輯 收藏 引用 所屬分類: Design Pattern

            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            国产一区二区三区久久精品| 亚洲va久久久噜噜噜久久男同| 国产精品久久精品| 99久久婷婷国产综合精品草原| 91久久精品国产91性色也| 亚洲午夜无码久久久久小说| 久久亚洲精品成人无码网站| a级毛片无码兔费真人久久| 久久99热这里只有精品国产| 亚洲午夜精品久久久久久人妖| 亚洲午夜久久久| 日本三级久久网| 亚洲欧美成人综合久久久| 久久久久噜噜噜亚洲熟女综合| 久久婷婷五月综合成人D啪| 久久精品视频网| 久久精品人人做人人妻人人玩| 色婷婷久久综合中文久久一本| 国产精品一久久香蕉国产线看观看| 久久久久亚洲AV成人网人人软件| 欧美丰满熟妇BBB久久久| 日本欧美国产精品第一页久久| 久久99国产精一区二区三区| 波多野结衣AV无码久久一区| 尹人香蕉久久99天天拍| 久久精品国产精品亚洲下载| 9191精品国产免费久久| 久久国产乱子伦免费精品| 97久久国产综合精品女不卡| 色妞色综合久久夜夜| 久久亚洲国产成人影院网站| 国产A级毛片久久久精品毛片| 国产精品一区二区久久不卡| 久久久久亚洲AV无码专区体验| 无码精品久久久天天影视 | 久久这里只精品国产99热| 99精品国产99久久久久久97| 久久久亚洲裙底偷窥综合| 伊人久久综合成人网| 久久国产精品77777| 久久se精品一区二区|