• <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 力為 閱讀(1938) 評論(1)  編輯 收藏 引用 所屬分類: 4. C++ FAQ3. VC&MFC&Qt

            評論

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

            欧洲人妻丰满av无码久久不卡 | 国产精品久久毛片完整版| 久久精品天天中文字幕人妻| 99久久免费国产特黄| 青青草国产97免久久费观看| 丁香色欲久久久久久综合网| 色噜噜狠狠先锋影音久久| 国内精品久久久久影院老司| 青青国产成人久久91网| 日韩欧美亚洲综合久久| 韩国免费A级毛片久久| 最新久久免费视频| 青青青国产成人久久111网站| 久久九九久精品国产免费直播| 亚洲一区中文字幕久久| 欧美牲交A欧牲交aⅴ久久| 亚洲另类欧美综合久久图片区| 久久大香香蕉国产| 久久久亚洲裙底偷窥综合 | 日韩精品国产自在久久现线拍 | 大香网伊人久久综合网2020| 老色鬼久久亚洲AV综合| 精品综合久久久久久97| 欧美久久久久久| 亚洲中文字幕伊人久久无码| 精品久久久久国产免费| 久久伊人精品青青草原高清| 久久大香香蕉国产| 99久久99这里只有免费费精品 | 久久久久99精品成人片| 国产精品成人精品久久久| 国产美女久久久| 国产一级持黄大片99久久| 久久精品国产91久久综合麻豆自制| 亚洲精品国产字幕久久不卡 | 久久精品中文字幕有码| 久久精品女人天堂AV麻| 久久无码AV中文出轨人妻| 青春久久| 久久婷婷成人综合色综合| 97久久天天综合色天天综合色hd|