• <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  回復  更多評論
              

            2021久久国自产拍精品| 久久99精品久久久久久秒播| 久久久国产精华液| 2020国产成人久久精品| 亚洲中文字幕无码一久久区| 久久亚洲精品无码AV红樱桃| 国产精品激情综合久久| 国产99久久久国产精品小说| 2021久久国自产拍精品| 亚洲国产成人乱码精品女人久久久不卡 | 久久婷婷色香五月综合激情| 久久不见久久见免费影院www日本| 久久噜噜电影你懂的| 久久中文字幕视频、最近更新| 久久久久亚洲AV无码网站| 久久国产精品视频| 久久99精品久久久久久久不卡 | 久久精品国产99久久香蕉| A级毛片无码久久精品免费| 久久精品成人| 国产精品久久久久久吹潮| 一本大道久久东京热无码AV| 四虎国产精品免费久久5151| 狠狠综合久久综合88亚洲| 亚洲人成无码网站久久99热国产| 国内精品人妻无码久久久影院| 色综合久久久久综合99| 久久精品国产72国产精福利| 国产精品久久成人影院| 性高湖久久久久久久久| 亚洲精品乱码久久久久久中文字幕| 久久精品夜色噜噜亚洲A∨ | 无码人妻少妇久久中文字幕| 久久99精品国产麻豆宅宅| 亚洲AV无码久久| 亚洲午夜无码久久久久| 久久久无码精品亚洲日韩蜜臀浪潮| 亚洲国产精品无码久久久久久曰| 久久精品国产WWW456C0M| 久久久久人妻精品一区三寸蜜桃| 伊人久久综合热线大杳蕉下载|