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

            評論

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

            无遮挡粉嫩小泬久久久久久久| 国产精品免费看久久久香蕉| 国产A级毛片久久久精品毛片| 18岁日韩内射颜射午夜久久成人| 久久婷婷五月综合国产尤物app| 99久久精品日本一区二区免费| 成人a毛片久久免费播放| 国内精品伊人久久久久妇| 精品永久久福利一区二区| 久久久久这里只有精品| MM131亚洲国产美女久久| 久久久久久极精品久久久| 久久精品人人做人人爽97| 午夜肉伦伦影院久久精品免费看国产一区二区三区 | 区亚洲欧美一级久久精品亚洲精品成人网久久久久 | 久久青青草原亚洲av无码app| 97精品伊人久久久大香线蕉| 亚洲中文字幕久久精品无码APP| 996久久国产精品线观看| 漂亮人妻被中出中文字幕久久| 日本三级久久网| 91精品国产高清久久久久久io | 激情伊人五月天久久综合| 久久婷婷色香五月综合激情| 国产成人无码精品久久久久免费| 久久精品人人做人人爽电影蜜月 | 亚洲AV无码久久| 少妇无套内谢久久久久| 无码人妻少妇久久中文字幕| 精品无码久久久久久久动漫| 一级做a爰片久久毛片16| 国产精品视频久久| 97热久久免费频精品99| 91精品国产高清91久久久久久| 精品免费久久久久久久| 久久亚洲春色中文字幕久久久| 精品综合久久久久久97| 久久精品国产久精国产果冻传媒| 欧美黑人激情性久久| 亚洲欧美伊人久久综合一区二区| 久久婷婷国产剧情内射白浆|