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

            評論

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

            久久无码人妻一区二区三区午夜 | 色综合久久中文字幕综合网| 99久久国产热无码精品免费| 无码超乳爆乳中文字幕久久| 伊人久久大香线蕉亚洲| 久久婷婷五月综合国产尤物app| 久久久久久久亚洲Av无码| 久久亚洲精品无码VA大香大香| 狠狠色噜噜色狠狠狠综合久久| 久久婷婷五月综合国产尤物app| 亚洲精品99久久久久中文字幕| 亚洲日韩中文无码久久| 国内精品久久久久影院免费| 国内精品久久久久久久涩爱 | 久久av高潮av无码av喷吹| 免费久久人人爽人人爽av| 国产L精品国产亚洲区久久| 久久这里的只有是精品23| 久久综合给久久狠狠97色| 色8激情欧美成人久久综合电| 国产精品久久久久久久久免费| 无码任你躁久久久久久老妇App| 久久精品中文无码资源站| 精品国产日韩久久亚洲| 国产叼嘿久久精品久久| 99久久超碰中文字幕伊人| 久久精品中文騷妇女内射| 77777亚洲午夜久久多人| 久久五月精品中文字幕| 成人亚洲欧美久久久久| 国产成人综合久久精品尤物| 99久久精品国产一区二区蜜芽| 日韩乱码人妻无码中文字幕久久 | 久久亚洲AV成人出白浆无码国产| 精品乱码久久久久久夜夜嗨| 欧美亚洲国产精品久久蜜芽| 久久婷婷五月综合97色| 国产精品毛片久久久久久久| 久久99热只有频精品8| 久久精品国产亚洲AV嫖农村妇女| 精品久久久中文字幕人妻|