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

            97久久香蕉国产线看观看| 99麻豆久久久国产精品免费| 久久久久无码精品| 亚洲国产成人久久精品99| 久久AV高潮AV无码AV| 久久综合香蕉国产蜜臀AV| 久久国产精品久久国产精品| 久久综合狠狠综合久久97色| 热re99久久精品国99热| 伊人久久大香线蕉AV一区二区| 久久久久高潮毛片免费全部播放 | 久久久久亚洲精品中文字幕| 新狼窝色AV性久久久久久| 久久久久九国产精品| 久久久久亚洲精品天堂| 性高朝久久久久久久久久| 色综合久久最新中文字幕| 亚洲精品无码成人片久久| 亚洲国产精品嫩草影院久久| 99久久精品久久久久久清纯| 欧美熟妇另类久久久久久不卡| 人妻丰满?V无码久久不卡| 91久久精品国产91性色也| 国内精品伊人久久久久AV影院| 久久久久久久精品成人热色戒| 久久国产免费直播| 超级碰久久免费公开视频| 久久精品国产精品国产精品污| 日本强好片久久久久久AAA| 亚洲午夜久久久久久噜噜噜| 亚洲国产日韩综合久久精品| 久久久久免费视频| 国内精品伊人久久久久影院对白| 久久久久亚洲av无码专区喷水| 无码人妻久久一区二区三区免费| 久久久无码精品亚洲日韩蜜臀浪潮| 日本精品久久久久久久久免费| 污污内射久久一区二区欧美日韩 | 国产精品无码久久综合| 亚洲女久久久噜噜噜熟女| 久久精品中文闷骚内射|