• <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   管理


            狠狠精品干练久久久无码中文字幕| 99精品伊人久久久大香线蕉| 久久亚洲国产成人影院| 国产欧美久久久精品影院| 亚洲av成人无码久久精品| 国产精品毛片久久久久久久| 亚洲午夜久久影院| 看全色黄大色大片免费久久久| A级毛片无码久久精品免费| 91视频国产91久久久| 亚洲AⅤ优女AV综合久久久| 99久久无色码中文字幕| 亚洲国产精品成人久久蜜臀 | 国产综合久久久久| 狠狠色综合久久久久尤物| 天天爽天天狠久久久综合麻豆| 办公室久久精品| 国产精品久久波多野结衣| 狠狠色婷婷久久一区二区| 久久精品国产精品亚洲下载| 久久国产精品77777| 伊人久久成人成综合网222| 日韩精品久久久久久| 婷婷五月深深久久精品| 欧美日韩精品久久久免费观看| 7国产欧美日韩综合天堂中文久久久久| 久久精品综合网| 亚洲а∨天堂久久精品9966| 久久国产免费观看精品| 91精品国产综合久久久久久 | 69SEX久久精品国产麻豆| 午夜欧美精品久久久久久久| 久久只这里是精品66| 香蕉99久久国产综合精品宅男自 | 精品久久久久久国产三级| 熟妇人妻久久中文字幕| 中文字幕日本人妻久久久免费| 亚洲欧美一区二区三区久久| 要久久爱在线免费观看| 亚洲精品无码久久毛片| 伊人久久精品影院|