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

            AV色综合久久天堂AV色综合在| 久久午夜福利无码1000合集| 久久狠狠高潮亚洲精品| 久久人人爽人人爽AV片| 日本欧美国产精品第一页久久| 久久这里只有精品视频99| 久久久SS麻豆欧美国产日韩| 亚洲成色WWW久久网站| 久久se精品一区二区| 亚洲第一永久AV网站久久精品男人的天堂AV | 99久久国产综合精品五月天喷水| 国产精品VIDEOSSEX久久发布| 亚洲天堂久久久| 久久免费高清视频| 久久精品人妻中文系列| 久久91亚洲人成电影网站| 精品久久久久久无码不卡| 伊人久久综在合线亚洲2019| 丁香色欲久久久久久综合网| 93精91精品国产综合久久香蕉| 久久婷婷色综合一区二区| 精品久久久久久久久久中文字幕| 亚洲av日韩精品久久久久久a| 久久国产成人| 91久久精品无码一区二区毛片| 色诱久久久久综合网ywww | 色噜噜狠狠先锋影音久久| 亚洲国产精品无码久久SM| 热99RE久久精品这里都是精品免费 | 日韩人妻无码精品久久久不卡| 伊人伊成久久人综合网777| 精品久久久无码中文字幕| 国产欧美久久久精品| 久久精品国产亚洲AV无码娇色| 亚洲国产天堂久久综合| 久久久久这里只有精品| 久久亚洲精品视频| 国产精品免费看久久久香蕉| 精品久久久久久国产潘金莲| 久久综合给合久久狠狠狠97色| 亚洲AV无码成人网站久久精品大|