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

            力為的技術博客

            聯系 聚合 管理
              154 Posts :: 1 Stories :: 561 Comments :: 0 Trackbacks

            Using Variant to Store Point

            ?

            ??????Variant is a very powerful data type to store 'any' data. With the help of COM class _variant_t, VARIANT bacomes very easy to use. But _variant_t dosen't support all kinds of data type, for example, point data with two or three elements. Variant can hold pointer, but the memory management becomes a stubborn problem when copying variant. I'm trying to find a better way to solve the problem, but I don't want to rewrite a variant. So,? dose the way exist?

            ??????Many UI-libs use variant to hold data of properties, such as BCGPControlBar, and they do support point displaying. Actually the point elements are formated to a string so that they be stored into one property. But it's very boring to parse values between points and variant, so it's a good idea to write a adapter for them. This adapter takes charge to format point data to string, extract point data from string, and ex-convert with _variant_t.

            if we have a point class like this:

            ?

            class ?Point3D
            {
            public :
            Point3D()
            {}
            Point3D(
            double ?x,? double ?y,? double ?z);
            double ?x();
            double ?y();
            double ?z();
            private :
            double ?x,?y,?z;
            }
            ;

            ?

            we can write our point adapter as following:

            ?

            class ?PointAdapter
            {
            private :
            CString?m_strData;
            public :
            PointAdapter();
            PointAdapter(
            const ?Point3D & ?point);
            PointAdapter(
            const ?_variant_t & ?point);

            operator ?Point3D() const ;
            operator ?_variant_t() const ;
            }
            ;

            ?

            now, we can use the classes:

            ?

            Point3D?point( 1 , 2 , 3 );
            _variant_t?var?
            = ?PointAdapter(point);
            Point3D?point2?
            = ?PointAdapter(var);



            ?

            posted on 2006-08-30 15:30 力為 閱讀(1930) 評論(1)  編輯 收藏 引用 所屬分類: 4. C++ FAQ3. VC&MFC&Qt

            評論

            # re: 用variant存point數據 2006-08-31 00:02 萬連文
            struct直接導出,VB可以使用,不過好像有warning  回復  更多評論
              

            99国产欧美久久久精品蜜芽| 人妻无码αv中文字幕久久| 精品综合久久久久久88小说| 久久久国产精华液| 久久AV高潮AV无码AV| 精品无码久久久久久午夜| 热久久这里只有精品| 香蕉99久久国产综合精品宅男自 | 国产69精品久久久久久人妻精品 | 久久精品这里只有精99品| 亚洲国产小视频精品久久久三级 | 精品一区二区久久| 久久男人AV资源网站| 久久久久人妻一区精品性色av| 久久免费高清视频| 一本色道久久88综合日韩精品 | 久久无码高潮喷水| 精品久久一区二区| 亚洲AV伊人久久青青草原| 国产精品一久久香蕉国产线看观看| 精品国产乱码久久久久久浪潮| 久久伊人精品一区二区三区| 久久综合丁香激情久久| 久久综合亚洲色HEZYO社区| 青青国产成人久久91网| 久久久久久久波多野结衣高潮| 91精品无码久久久久久五月天| 久久精品国产2020| 久久青青国产| 久久精品视频免费| 久久久精品国产sm调教网站 | 久久精品视频免费| 久久精品国产亚洲av麻豆图片| 狠狠精品干练久久久无码中文字幕| 奇米影视7777久久精品| 97香蕉久久夜色精品国产| 国内精品伊人久久久久网站| 久久99国产精品尤物| 97精品依人久久久大香线蕉97| 久久亚洲色一区二区三区| 欧美综合天天夜夜久久|