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

            評論

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

            久久久久久亚洲Av无码精品专口| 国产精品一区二区久久精品| 国产AV影片久久久久久| 国产一区二区精品久久凹凸| 久久av免费天堂小草播放| 久久国产精品一区| 亚洲中文字幕无码一久久区| 99久久中文字幕| 亚洲国产成人精品91久久久| 久久精品人人做人人爽电影蜜月 | 伊人久久五月天| 久久亚洲2019中文字幕| 国产亚洲精品久久久久秋霞| 国产精品99久久免费观看| 久久久久亚洲AV无码专区网站| 日韩欧美亚洲综合久久| 亚洲国产精品久久久久网站 | 99久久精品午夜一区二区| 国内精品免费久久影院| 久久人人爽人人爽人人片AV不| 久久精品国产只有精品66| 精品久久久久久国产| 一本一道久久综合狠狠老| 日本欧美国产精品第一页久久| 国产精品久久久久久影院 | 2021久久国自产拍精品| 99久久这里只精品国产免费| 香港aa三级久久三级老师2021国产三级精品三级在 | 精品国产福利久久久| 97久久婷婷五月综合色d啪蜜芽| 成人亚洲欧美久久久久| 国内精品久久久人妻中文字幕| 亚洲国产成人久久一区WWW| 亚洲狠狠久久综合一区77777| 色偷偷88888欧美精品久久久| 香蕉久久夜色精品国产2020| 草草久久久无码国产专区| 久久成人国产精品二三区| 国产精品久久网| 九九99精品久久久久久| 秋霞久久国产精品电影院|