• <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中文字幕| 国产精品女同久久久久电影院| 无码人妻精品一区二区三区久久久 | 久久er国产精品免费观看8| 一本色道久久88加勒比—综合| 青青青国产精品国产精品久久久久| 久久99精品久久久久久齐齐| 色综合久久中文字幕综合网| 久久精品一区二区国产| 日本五月天婷久久网站| 国产成人久久久精品二区三区| 亚洲国产成人精品久久久国产成人一区二区三区综 | 久久久久久久久无码精品亚洲日韩| 国产精品久久久久久吹潮| 波多野结衣久久一区二区| 国产高清美女一级a毛片久久w| 精品熟女少妇AV免费久久| 精品久久久久中文字幕一区| 久久久久久狠狠丁香| 99久久国产主播综合精品| 久久99精品久久久久久动态图| 久久久久久曰本AV免费免费| 欧美一级久久久久久久大| 久久久精品人妻无码专区不卡| 亚洲午夜久久影院| 久久性生大片免费观看性| 伊人热热久久原色播放www| 欧美日韩中文字幕久久久不卡| 青草久久久国产线免观| 亚洲精品乱码久久久久久按摩| 久久水蜜桃亚洲av无码精品麻豆| 性做久久久久久久| 日韩精品久久久久久| 一本久久综合亚洲鲁鲁五月天| 国产成年无码久久久免费| 国产成人综合久久综合| 亚洲精品美女久久久久99小说 | 亚洲国产日韩欧美久久| 久久综合综合久久综合| 欧美亚洲日本久久精品| 国产一区二区精品久久|