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

            評論

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

            久久青青草原亚洲av无码| 一本色道久久HEZYO无码| 国内精品久久久人妻中文字幕| 亚洲午夜久久久影院伊人| 久久综合给久久狠狠97色| 久久综合九色综合网站| 中文字幕久久久久人妻| 久久国产精品99久久久久久老狼| 久久国产欧美日韩精品免费| 亚洲色欲久久久综合网东京热| 久久99亚洲网美利坚合众国| 26uuu久久五月天| 99热热久久这里只有精品68| 少妇精品久久久一区二区三区| 精品久久久久中文字幕一区| 国产午夜电影久久| 欧美一级久久久久久久大| 久久精品国产影库免费看| 66精品综合久久久久久久| 观看 国产综合久久久久鬼色 欧美 亚洲 一区二区 | 久久综合狠狠综合久久激情 | 久久天天躁狠狠躁夜夜2020| 久久久久免费看成人影片| 午夜精品久久久久久影视777| 国产午夜精品理论片久久影视 | 国产精品99久久精品| 欧美亚洲日本久久精品| 91精品国产91久久久久久蜜臀| 色综合久久无码中文字幕| 亚洲国产日韩欧美久久| 99久久无码一区人妻| 久久精品中文字幕无码绿巨人| 久久天天躁狠狠躁夜夜躁2014| 久久久网中文字幕| 一级做a爰片久久毛片人呢| 99久久精品国产高清一区二区| 久久久久久综合网天天| 久久99热这里只频精品6| 久久亚洲av无码精品浪潮| 久久99精品久久久久久噜噜| 国产99久久久国产精免费|