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

            国产精品久久久久9999| 精品久久久久久久久久中文字幕 | 国产精品久久永久免费| 国产精品久久亚洲不卡动漫| 亚洲国产精久久久久久久| 精品一久久香蕉国产线看播放| 久久天天躁狠狠躁夜夜av浪潮| 7777精品久久久大香线蕉| 国内精品久久久久影院日本| 久久精品国产亚洲一区二区三区| 综合久久国产九一剧情麻豆| 9999国产精品欧美久久久久久 | 大美女久久久久久j久久| 久久www免费人成看片| 久久香蕉一级毛片| 区久久AAA片69亚洲| 九九久久精品无码专区| 精品久久久久久久久午夜福利| 无码乱码观看精品久久| 99久久国产综合精品网成人影院| 久久久久久国产精品无码超碰| 久久无码国产| 青青青国产精品国产精品久久久久 | 久久久久av无码免费网| 国内精品久久久久久麻豆 | 人妻中文久久久久| 91久久香蕉国产熟女线看| 久久天堂AV综合合色蜜桃网| 久久亚洲精品国产亚洲老地址 | 久久久久久亚洲精品影院| 国产成人精品久久| 7国产欧美日韩综合天堂中文久久久久 | 久久精品免费全国观看国产| 久久91精品综合国产首页| 国产精品久久久天天影视香蕉| 国产亚洲欧美成人久久片| 99久久久精品免费观看国产| 7777久久亚洲中文字幕| 久久亚洲国产精品一区二区| 久久99精品综合国产首页| 中文精品久久久久国产网址|