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

            亚洲国产精品无码久久SM | 囯产精品久久久久久久久蜜桃| 国产综合免费精品久久久| 亚洲乱码日产精品a级毛片久久| 无码人妻精品一区二区三区久久 | 色综合合久久天天给综看| 久久久久久精品免费免费自慰| 久久国产精品久久| 久久久久亚洲av成人网人人软件| 999久久久免费精品国产| 亚洲欧美成人久久综合中文网 | 99久久精品这里只有精品| 一本久久a久久精品亚洲| 久久人人爽人爽人人爽av| 日韩精品久久久肉伦网站 | 精品国产乱码久久久久软件| 久久99精品国产一区二区三区| 精品久久久久久无码不卡| 久久精品中文字幕一区| 国产激情久久久久影院老熟女免费 | 亚洲愉拍99热成人精品热久久| 日本精品久久久久影院日本| 久久精品九九亚洲精品天堂 | 亚洲嫩草影院久久精品| 国产精品久久亚洲不卡动漫| 影音先锋女人AV鲁色资源网久久| 久久久久国色AV免费观看| 99久久精品费精品国产| 91性高湖久久久久| 青青草原综合久久大伊人精品| 2021久久精品国产99国产精品| 亚洲日本va中文字幕久久| 亚洲精品乱码久久久久久蜜桃不卡 | 久久夜色精品国产www| 久久久久国产一区二区三区| 久久精品夜色噜噜亚洲A∨| 久久99精品国产麻豆婷婷| 亚洲欧洲精品成人久久曰影片| 国产精品乱码久久久久久软件| 久久久精品久久久久影院| 精品久久久久久中文字幕大豆网|