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

            热99RE久久精品这里都是精品免费| 无码日韩人妻精品久久蜜桃 | 久久久久一本毛久久久| 久久er热视频在这里精品| 69SEX久久精品国产麻豆| 中文字幕成人精品久久不卡| 久久久99精品成人片中文字幕| 天堂无码久久综合东京热| 97久久国产综合精品女不卡| 久久伊人精品青青草原高清| 婷婷久久五月天| 亚洲天堂久久精品| 久久影视综合亚洲| 久久精品国产网红主播| 要久久爱在线免费观看| 精品综合久久久久久88小说| 国产精品久久久久久福利漫画| 久久精品国产黑森林| 日韩av无码久久精品免费| 99久久99久久精品国产片果冻| 99久久久国产精品免费无卡顿| 亚洲精品午夜国产VA久久成人| 久久精品国产99国产电影网| 久久强奷乱码老熟女网站| 伊人热热久久原色播放www| 91久久精品91久久性色| 亚洲精品国产字幕久久不卡 | 欧美日韩精品久久久久| 99久久99久久精品免费看蜜桃 | 日韩十八禁一区二区久久| 久久精品国内一区二区三区| 亚洲AV乱码久久精品蜜桃| 久久精品国产久精国产一老狼| 久久久久亚洲精品无码网址| 久久99精品国产99久久6| 大美女久久久久久j久久| 精品久久国产一区二区三区香蕉 | 久久国产精品-国产精品| 久久影院综合精品| 亚洲国产精品无码久久久蜜芽 | 精品久久人人爽天天玩人人妻|