青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

隨筆-341  評論-2670  文章-0  trackbacks-0
    從pdb讀取類聲明花了很久,從類聲明產生反射和dll接口花的時間更久啊,很多細節問題需要解決。文章的代碼已經保存在了Vczh Library++3.0(\Tools\Release\SideProjects\GacUI\GacUI.sln)。

    反射和dll接口的工作進行了一半?,F在把類、函數、屬性和各種類型都聲稱了出來,但是還欠缺函數的實現。反射使用了lazy的做法,當訪問到一個Type的成員的時候,才會對Type進行初始化。不過初始化的內容也很簡單,只是把一些對方放倒一個列表里面,從而當你想知道一個Type有哪些屬性和函數什么的可以很快查出來。dll的接口也差不多。現在分別展示反射和dll接口的代碼。首先是反射的:

    下面是GuiBoundsComposition類型的反射。我們可以看到gacui_tpimp_GuiBoundsComposition繼承自了TypeDescriptor。當我們調用GetTypeProvider->FindType(L"GuiBoundsComposition")->GetTypeDescriptor()的時候,就會返回下面的這個對象。
  1 class gacui_tpimp_GuiBoundsComposition : public TypeDescriptor
  2 {
  3 protected:
  4 void FillTypeContent()
  5 {
  6     AddBaseType((gacui_tpimp_type_cache_table.cache_GuiGraphicsSite));
  7     AddConstructor(
  8         (new MethodDescriptor(L"GuiBoundsComposition", IMemberDescriptor::Normal))
  9         ->ReturnType((gacui_tpimp_type_cache_table.cache_GuiBoundsComposition)->GetPointerType())
 10         ->Handler(MethodDescriptor::HandlerFuncType(&gacui_tpimp_GuiBoundsComposition::method_handler_GuiBoundsComposition_0))
 11     );
 12     AddMethod(
 13         (new MethodDescriptor(L"GetAffectionFromParent", IMemberDescriptor::Virtual))
 14         ->ReturnType((gacui_tpimp_type_cache_table.cache_GuiGraphicsComposition_member_ParentSizeAffection))
 15         ->Handler(MethodDescriptor::HandlerFuncType(&gacui_tpimp_GuiBoundsComposition::method_handler_GetAffectionFromParent_1))
 16     );
 17     AddMethod(
 18         (new MethodDescriptor(L"GetPreferredBounds", IMemberDescriptor::Virtual))
 19         ->ReturnType((gacui_tpimp_type_cache_table.cache_Rect))
 20         ->Handler(MethodDescriptor::HandlerFuncType(&gacui_tpimp_GuiBoundsComposition::method_handler_GetPreferredBounds_2))
 21     );
 22     AddMethod(
 23         (new MethodDescriptor(L"GetBounds", IMemberDescriptor::Virtual))
 24         ->ReturnType((gacui_tpimp_type_cache_table.cache_Rect))
 25         ->Handler(MethodDescriptor::HandlerFuncType(&gacui_tpimp_GuiBoundsComposition::method_handler_GetBounds_3))
 26     );
 27     AddMethod(
 28         (new MethodDescriptor(L"ClearAlignmentToParent", IMemberDescriptor::Normal))
 29         ->ReturnType((gacui_tpimp_type_cache_table.primary_Void))
 30         ->Handler(MethodDescriptor::HandlerFuncType(&gacui_tpimp_GuiBoundsComposition::method_handler_ClearAlignmentToParent_4))
 31     );
 32     AddMethod(
 33         (new MethodDescriptor(L"IsAlignedToParent", IMemberDescriptor::Normal))
 34         ->ReturnType((gacui_tpimp_type_cache_table.primary_Bool))
 35         ->Handler(MethodDescriptor::HandlerFuncType(&gacui_tpimp_GuiBoundsComposition::method_handler_IsAlignedToParent_5))
 36     );
 37     AddMethod(
 38         (new MethodDescriptor(L"operator=", IMemberDescriptor::Normal))
 39         ->ReturnType((gacui_tpimp_type_cache_table.cache_GuiBoundsComposition)->GetReferenceType())
 40         ->Parameter(L"value", (gacui_tpimp_type_cache_table.cache_GuiBoundsComposition)->GetConstReferenceType())
 41         ->Handler(MethodDescriptor::HandlerFuncType(&gacui_tpimp_GuiBoundsComposition::method_handler_operator_assign_6))
 42     );
 43     AddMethod(
 44         (new MethodDescriptor(L"SetBounds", IMemberDescriptor::Normal))
 45         ->ReturnType((gacui_tpimp_type_cache_table.primary_Void))
 46         ->Parameter(L"value", (gacui_tpimp_type_cache_table.cache_Rect))
 47         ->Handler(MethodDescriptor::HandlerFuncType(&gacui_tpimp_GuiBoundsComposition::method_handler_SetBounds_7))
 48     );
 49     AddProperty(
 50         (new PropertyDescriptor(L"AlignmentToParent", IMemberDescriptor::Normal))
 51         ->PropertyType((gacui_tpimp_type_cache_table.cache_Margin))
 52         ->Getter(
 53             (new MethodDescriptor(L"GetAlignmentToParent", IMemberDescriptor::Normal))
 54             ->ReturnType((gacui_tpimp_type_cache_table.cache_Margin))
 55             ->Handler(MethodDescriptor::HandlerFuncType(&gacui_tpimp_GuiBoundsComposition::method_handler_GetAlignmentToParent_8))
 56         )
 57         ->Setter(
 58             (new MethodDescriptor(L"SetAlignmentToParent", IMemberDescriptor::Normal))
 59             ->ReturnType((gacui_tpimp_type_cache_table.primary_Void))
 60             ->Parameter(L"value", (gacui_tpimp_type_cache_table.cache_Margin))
 61             ->Handler(MethodDescriptor::HandlerFuncType(&gacui_tpimp_GuiBoundsComposition::method_handler_SetAlignmentToParent_9))
 62         )
 63     );
 64     AddProperty(
 65         (new PropertyDescriptor(L"BoundsChanged", IMemberDescriptor::Normal))
 66         ->PropertyType((gacui_tpimp_type_cache_table.cache_GuiGraphicsEvent_of_GuiEventArgs))
 67         ->Getter(
 68             (new MethodDescriptor(L"get_BoundsChanged", IMemberDescriptor::Normal))
 69             ->ReturnType((gacui_tpimp_type_cache_table.cache_GuiGraphicsEvent_of_GuiEventArgs))
 70             ->Handler(MethodDescriptor::HandlerFuncType(&gacui_tpimp_GuiBoundsComposition::method_handler_get_BoundsChanged_10))
 71         )
 72         ->Setter(
 73             (new MethodDescriptor(L"set_BoundsChanged", IMemberDescriptor::Normal))
 74             ->ReturnType((gacui_tpimp_type_cache_table.primary_Void))
 75             ->Parameter(L"value", (gacui_tpimp_type_cache_table.cache_GuiGraphicsEvent_of_GuiEventArgs))
 76             ->Handler(MethodDescriptor::HandlerFuncType(&gacui_tpimp_GuiBoundsComposition::method_handler_set_BoundsChanged_11))
 77         )
 78     );
 79 }
 80             
 81 private:
 82                 
 83 static DescriptableValue method_handler_GuiBoundsComposition_0(const DescriptableValue& thisObject, const collections::IReadonlyList<DescriptableValue>& parameters)
 84 {
 85     throw 0;
 86 }
 87                 
 88 static DescriptableValue method_handler_GetAffectionFromParent_1(const DescriptableValue& thisObject, const collections::IReadonlyList<DescriptableValue>& parameters)
 89 {
 90     throw 0;
 91 }
 92                 
 93 static DescriptableValue method_handler_GetPreferredBounds_2(const DescriptableValue& thisObject, const collections::IReadonlyList<DescriptableValue>& parameters)
 94 {
 95     throw 0;
 96 }
 97                 
 98 static DescriptableValue method_handler_GetBounds_3(const DescriptableValue& thisObject, const collections::IReadonlyList<DescriptableValue>& parameters)
 99 {
100     throw 0;
101 }
102                 
103 static DescriptableValue method_handler_ClearAlignmentToParent_4(const DescriptableValue& thisObject, const collections::IReadonlyList<DescriptableValue>& parameters)
104 {
105     throw 0;
106 }
107                 
108 static DescriptableValue method_handler_IsAlignedToParent_5(const DescriptableValue& thisObject, const collections::IReadonlyList<DescriptableValue>& parameters)
109 {
110     throw 0;
111 }
112                 
113 static DescriptableValue method_handler_operator_assign_6(const DescriptableValue& thisObject, const collections::IReadonlyList<DescriptableValue>& parameters)
114 {
115     throw 0;
116 }
117                 
118 static DescriptableValue method_handler_SetBounds_7(const DescriptableValue& thisObject, const collections::IReadonlyList<DescriptableValue>& parameters)
119 {
120     throw 0;
121 }
122                 
123 static DescriptableValue method_handler_GetAlignmentToParent_8(const DescriptableValue& thisObject, const collections::IReadonlyList<DescriptableValue>& parameters)
124 {
125     throw 0;
126 }
127                 
128 static DescriptableValue method_handler_SetAlignmentToParent_9(const DescriptableValue& thisObject, const collections::IReadonlyList<DescriptableValue>& parameters)
129 {
130     throw 0;
131 }
132                 
133 static DescriptableValue method_handler_get_BoundsChanged_10(const DescriptableValue& thisObject, const collections::IReadonlyList<DescriptableValue>& parameters)
134 {
135     throw 0;
136 }
137                 
138 static DescriptableValue method_handler_set_BoundsChanged_11(const DescriptableValue& thisObject, const collections::IReadonlyList<DescriptableValue>& parameters)
139 {
140     throw 0;
141 }
142             
143 public:
144 };

    如果反射出來的函數不能被調用那自然是沒有意義的,所以AddMethod的時候會提供一個handler,而handler就是下面的靜態成員函數了。靜態成員函數的實現就是從thisObject拿到GuiBoundsComposition*之后,去調用對應的函數。這個部分是可以自動生成的,只是現在還沒寫完。

    反射只是一部分,dll的接口也要生成,因為GacUI的實現使用了很多模板和自定義異常,而模板和異??缭絛ll邊界是很危險的,所以需要用自動生成的代碼來把這些東西隔離開(包括一場),從而實現安全調用。下面就是自動生成的dll接口代碼,而同樣,函數也暫時沒有實現的內容:
 1 /***********************************************************************
 2 GuiBoundsComposition
 3 ***********************************************************************/
 4 
 5     class GACUI_API GuiBoundsComposition : public GuiGraphicsSite
 6     {
 7     public:
 8     
 9     public:
10         
11         static rptr<GuiBoundsComposition> Create();
12         
13         GuiGraphicsComposition :: ParentSizeAffection GetAffectionFromParent();
14         Rect GetPreferredBounds();
15         Rect GetBounds();
16         void ClearAlignmentToParent();
17         bool IsAlignedToParent();
18         rptr<GuiBoundsComposition> operator=(rptr<GuiBoundsComposition> value);
19         void SetBounds(Rect value);
20         
21         Margin GetAlignmentToParent();
22         void SetAlignmentToParent(Margin value);
23         GuiGraphicsEvent_of_GuiEventArgs on_BoundsChanged();
24         
25     };
26 
27 /***********************************************************************
28 GuiBoundsComposition
29 ***********************************************************************/
30 
31     rptr<GuiBoundsComposition> GuiBoundsComposition::Create()
32     {
33         throw 0;
34     }
35     
36     GuiGraphicsComposition :: ParentSizeAffection GuiBoundsComposition::GetAffectionFromParent()
37     {
38         throw 0;
39     }
40     
41     Rect GuiBoundsComposition::GetPreferredBounds()
42     {
43         throw 0;
44     }
45     
46     Rect GuiBoundsComposition::GetBounds()
47     {
48         throw 0;
49     }
50     
51     void GuiBoundsComposition::ClearAlignmentToParent()
52     {
53         throw 0;
54     }
55     
56     bool GuiBoundsComposition::IsAlignedToParent()
57     {
58         throw 0;
59     }
60     
61     rptr<GuiBoundsComposition> GuiBoundsComposition::operator=(rptr<GuiBoundsComposition> value)
62     {
63         throw 0;
64     }
65     
66     void GuiBoundsComposition::SetBounds(Rect value)
67     {
68         throw 0;
69     }
70     
71     Margin GuiBoundsComposition::GetAlignmentToParent()
72     {
73         throw 0;
74     }
75     void GuiBoundsComposition::SetAlignmentToParent(Margin value)
76     {
77         throw 0;
78     }
79     
80     GuiGraphicsEvent_of_GuiEventArgs GuiBoundsComposition::on_BoundsChanged()
81     {
82         throw 0;
83     }

    dll接口的部分生成比較簡單,因為類似int這樣的類型可以直接使用,而不像反射一樣還得給一個對象來告訴你這個是int。

    之所要這兩部分,是因為GacUI不僅允許用戶直接操作某個控件,也需要同時允許界面使用XML描述,或者以后對腳本的支持。C++訪問控件不需要反射,而XML和腳本則需要。XML描述界面是很重要的,因為這不僅可以用來支持皮膚、資源等高級抽象,還可以圍繞XML開發一個跟Blend Expression(當然不可能有那么高級= =b)的GUI編輯器。

    接下來會繼續給這些函數生成實現。這部分完成之后,GacUI就真正可以通過dll的方法來運行了。一旦把功能都坐進了dll,那么實現類似visual studio那樣的可以把界面插件分散在各個dll里面的編輯器框架,也消除了技術上的困難。
posted on 2012-02-21 10:33 陳梓瀚(vczh) 閱讀(3585) 評論(3)  編輯 收藏 引用 所屬分類: GacUI

評論:
# re: GacUI從pdb生成反射和dll接口首戰告捷 2012-02-22 19:28 | marvin
看得出,你很用心

C++語言加反射很累。記得有一個庫
http://acdk.sourceforge.net/

  回復  更多評論
  
# re: GacUI從pdb生成反射和dll接口首戰告捷 2012-02-22 21:17 | phoenixbing
如意金箍棒。重三萬六千斤。我頂。  回復  更多評論
  
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            欧美大成色www永久网站婷| 日韩午夜电影| 久久亚洲国产精品日日av夜夜| 国产精品欧美久久久久无广告| 一本色道久久综合亚洲91| 亚洲欧洲精品一区二区三区不卡| 免费成人高清| 一本久久a久久精品亚洲| 日韩一级黄色av| 国产精品美女诱惑| 久久激情综合| 免费不卡在线观看| 99精品国产福利在线观看免费| 亚洲精品三级| 国产欧美一区二区三区国产幕精品| 亚洲在线电影| 欧美一区二区视频97| 依依成人综合视频| 亚洲精品国产精品国自产在线| 国产精品成人观看视频国产奇米| 久久精品国产一区二区电影| 久久久久在线| 亚洲网址在线| 久久精品在线| 亚洲图片欧美一区| 久久狠狠久久综合桃花| 亚洲精品乱码久久久久久黑人| 99国产一区| 一区二区三区在线不卡| 99视频精品在线| 狠色狠色综合久久| 一级日韩一区在线观看| 依依成人综合视频| 国产精品99久久久久久久女警| 很黄很黄激情成人| 夜夜嗨av一区二区三区网页| 在线观看视频一区二区| 亚洲午夜91| 亚洲啪啪91| 久久国产精品久久w女人spa| 亚洲系列中文字幕| 久久综合色婷婷| 欧美一级黄色网| 欧美日韩国产在线播放网站| 久色婷婷小香蕉久久| 国产精品a久久久久| 欧美高清在线观看| 国产一区在线播放| 一区二区不卡在线视频 午夜欧美不卡在| 国语自产精品视频在线看抢先版结局 | 国产精品亚洲视频| 亚洲激情小视频| 亚洲丶国产丶欧美一区二区三区| 亚洲一区中文| 亚洲一区在线观看免费观看电影高清| 免费人成网站在线观看欧美高清| 久久久久久久激情视频| 国产精品久久久久久久久果冻传媒 | 国产视频丨精品|在线观看| 亚洲精品亚洲人成人网| 最新成人在线| 欧美成在线视频| 欧美国产专区| 亚洲电影免费观看高清完整版在线观看 | 欧美三级视频在线| 亚洲高清在线观看一区| 亚洲国产毛片完整版| 久久久美女艺术照精彩视频福利播放| 欧美一区二区黄色| 国产精品女人网站| 亚洲一区欧美激情| 午夜一区在线| 国产欧美视频一区二区三区| 午夜国产精品视频免费体验区| 亚洲欧美一区在线| 国产精品人成在线观看免费 | 久久本道综合色狠狠五月| 国产精品久久毛片a| 一区二区三区福利| 欧美一级黄色网| 国产亚洲精品久| 久久久蜜桃精品| 欧美国产免费| 一区二区三区精密机械公司 | 欧美精品www| 最新日韩欧美| 亚洲已满18点击进入久久| 国产精品国产三级国产普通话三级| 一区二区三区日韩欧美| 久久精品99无色码中文字幕| 国模私拍一区二区三区| 蜜臀av国产精品久久久久| 欧美好骚综合网| 亚洲视频在线观看免费| 国产精品久久久99| 欧美在线亚洲| 亚洲日本无吗高清不卡| 亚洲欧美日本国产有色| 狠狠久久五月精品中文字幕| 欧美电影在线免费观看网站| 亚洲一区二区三区乱码aⅴ蜜桃女 亚洲一区二区三区乱码aⅴ | 国产精品久久久久一区| 欧美在线一级视频| 亚洲韩国精品一区| 欧美一区二区啪啪| 亚洲欧洲日本一区二区三区| 国产精品欧美风情| 另类国产ts人妖高潮视频| 一本久道久久综合婷婷鲸鱼| 久久夜精品va视频免费观看| 一区二区三区毛片| 激情一区二区三区| 欧美日韩在线精品| 久久亚洲图片| 亚洲综合三区| 亚洲日本一区二区| 久久综合一区二区| 亚洲综合色自拍一区| 亚洲福利电影| 国产午夜精品一区理论片飘花| 欧美不卡视频一区发布| 欧美影片第一页| 一区电影在线观看| 亚洲国产高清在线观看视频| 久久免费国产精品| 亚洲欧美大片| 在线亚洲欧美| 日韩一级在线| 91久久精品久久国产性色也91 | 你懂的一区二区| 西瓜成人精品人成网站| 亚洲最新视频在线| 亚洲日本精品国产第一区| 久久视频一区二区| 久久精品一级爱片| 香蕉久久国产| 午夜欧美大尺度福利影院在线看| 日韩亚洲欧美综合| 亚洲精品一级| 亚洲人成在线播放网站岛国| 亚洲二区视频在线| 在线不卡免费欧美| 国内精品视频一区| 国产性猛交xxxx免费看久久| 国产精品一区毛片| 国产伦精品一区二区三区高清版 | 裸体女人亚洲精品一区| 久久精品在线免费观看| 久久国产精品一区二区三区四区| 性欧美办公室18xxxxhd| 亚洲欧美日韩国产综合| 亚洲欧美日本在线| 亚洲欧美美女| 欧美在线播放视频| 久久国产综合精品| 美女图片一区二区| 你懂的国产精品| 欧美日韩123| 国产精品激情av在线播放| 国产精品网站视频| 国产亚洲欧美另类中文| 狠狠色狠狠色综合日日tαg | 国产精品免费观看视频| 国产精品免费看| 国产亚洲高清视频| 激情av一区| 日韩视频免费| 亚洲欧美日本国产有色| 久久精品女人| 亚洲国产精品嫩草影院| av不卡在线| 欧美在线播放| 欧美电影美腿模特1979在线看| 欧美日韩在线播| 国产一区二区三区av电影| 亚洲黄网站黄| 午夜精品久久一牛影视| 久久久久欧美精品| 亚洲日本欧美天堂| 欧美一区二区三区免费观看| 巨乳诱惑日韩免费av| 国产精品久久久久999| 国产主播一区二区三区| 亚洲毛片在线看| 久久久久久自在自线| 亚洲日韩视频| 久久精品国产96久久久香蕉| 欧美人成在线| 一区二区视频免费完整版观看| 一区二区欧美视频| 美女视频黄a大片欧美| 9色精品在线| 欧美成人精品在线观看| 国产精品亚洲аv天堂网| 亚洲精选大片| 久久久人成影片一区二区三区 | 久久久99免费视频| 亚洲精品影院| 欧美wwwwww| 一区精品在线播放|