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

            久久亚洲精品中文字幕| 精品永久久福利一区二区| 亚洲欧美精品伊人久久| 精品无码人妻久久久久久| 国产精品欧美久久久久天天影视| 国产高潮国产高潮久久久91| 久久一本综合| 久久国产亚洲精品无码| 91亚洲国产成人久久精品网址| 久久久久国产精品嫩草影院| 亚洲AV无码久久| 久久无码一区二区三区少妇| 老色鬼久久亚洲AV综合| 久久精品国产黑森林| 青草国产精品久久久久久| 久久夜色撩人精品国产小说| 99久久久精品免费观看国产| 国产美女亚洲精品久久久综合 | 国产麻豆精品久久一二三| 久久国产精品一区| 国产精品久久久久9999| 久久婷婷色综合一区二区| 精品无码久久久久久国产| 精品久久久久久久无码| 伊人久久精品无码二区麻豆| 精品久久国产一区二区三区香蕉 | 国产精品99久久不卡| 99久久免费国产精品特黄| 久久国产精品99精品国产| 色天使久久综合网天天| 亚洲国产精品婷婷久久| 国内精品久久久久影院一蜜桃| 国产精品久久久久久久久久影院| 99久久婷婷国产综合精品草原| 国产国产成人精品久久| 成人资源影音先锋久久资源网| 色8久久人人97超碰香蕉987| 亚洲国产精品一区二区久久hs| 东方aⅴ免费观看久久av| 狠狠色丁香久久婷婷综合| 7777久久久国产精品消防器材|