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

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

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

    下面是GuiBoundsComposition類型的反射。我們可以看到gacui_tpimp_GuiBoundsComposition繼承自了TypeDescriptor。當(dāng)我們調(diào)用GetTypeProvider->FindType(L"GuiBoundsComposition")->GetTypeDescriptor()的時(shí)候,就會(huì)返回下面的這個(gè)對(duì)象。
  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 };

    如果反射出來的函數(shù)不能被調(diào)用那自然是沒有意義的,所以AddMethod的時(shí)候會(huì)提供一個(gè)handler,而handler就是下面的靜態(tài)成員函數(shù)了。靜態(tài)成員函數(shù)的實(shí)現(xiàn)就是從thisObject拿到GuiBoundsComposition*之后,去調(diào)用對(duì)應(yīng)的函數(shù)。這個(gè)部分是可以自動(dòng)生成的,只是現(xiàn)在還沒寫完。

    反射只是一部分,dll的接口也要生成,因?yàn)镚acUI的實(shí)現(xiàn)使用了很多模板和自定義異常,而模板和異常跨越dll邊界是很危險(xiǎn)的,所以需要用自動(dòng)生成的代碼來把這些東西隔離開(包括一場),從而實(shí)現(xiàn)安全調(diào)用。下面就是自動(dòng)生成的dll接口代碼,而同樣,函數(shù)也暫時(shí)沒有實(shí)現(xiàn)的內(nèi)容:
 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接口的部分生成比較簡單,因?yàn)轭愃苅nt這樣的類型可以直接使用,而不像反射一樣還得給一個(gè)對(duì)象來告訴你這個(gè)是int。

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

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

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

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

  回復(fù)  更多評(píng)論
  
# re: GacUI從pdb生成反射和dll接口首戰(zhàn)告捷 2012-02-22 21:17 | phoenixbing
如意金箍棒。重三萬六千斤。我頂。  回復(fù)  更多評(píng)論
  
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            免费中文日韩| 亚洲欧美日韩国产综合| 欧美gay视频激情| 亚洲国产视频直播| 国产日韩亚洲欧美| 国产精品日韩| 影音先锋国产精品| 亚洲精品一区二区三区福利| 亚洲精品欧美一区二区三区| 日韩特黄影片| 久久www免费人成看片高清| 久久久久成人网| 欧美成人午夜免费视在线看片| 久久婷婷亚洲| 亚洲麻豆视频| 欧美亚洲免费| 欧美日韩另类丝袜其他| 好看的亚洲午夜视频在线| 亚洲国产成人精品女人久久久| av成人免费在线观看| 欧美1区视频| 亚洲在线免费| 欧美日韩国产一区二区三区| 久热这里只精品99re8久| 欧美专区18| 亚洲片区在线| 亚洲天堂网在线观看| 国产美女精品视频| 久久久综合免费视频| 一区二区不卡在线视频 午夜欧美不卡在| 亚洲精品裸体| 亚洲欧洲在线观看| 久久综合99re88久久爱| 激情综合自拍| 米奇777超碰欧美日韩亚洲| 亚洲精品国产精品久久清纯直播| 亚洲欧美日韩一区二区在线 | 亚洲欧美国产毛片在线| 欧美国产免费| 91久久综合| 亚洲欧洲日本国产| 国产精品国产三级国产专播精品人| 亚洲国产精品成人综合| 亚洲欧洲另类| 国产精品免费久久久久久| 午夜精品短视频| 久久久久欧美精品| 夜夜爽av福利精品导航| 亚洲综合国产精品| 国内伊人久久久久久网站视频| 久久久精彩视频| 欧美大成色www永久网站婷| 亚洲午夜精品久久久久久app| 亚洲小视频在线观看| 黑人巨大精品欧美一区二区| 亚洲第一区色| 国产亚洲在线| 亚洲伦理久久| 亚洲人成在线播放| 欧美一区二区在线| 一本色道久久88综合日韩精品| 午夜精品区一区二区三| 99ri日韩精品视频| 久久在线91| 免费在线欧美视频| 狠狠干狠狠久久| 欧美亚洲视频| 性感少妇一区| 国产精品综合av一区二区国产馆| 欧美国产日韩在线观看| 亚洲天堂视频在线观看| 亚洲激情中文1区| 欧美成人精品在线观看| 美女诱惑黄网站一区| 国产在线精品一区二区夜色| 一区二区高清在线| 亚洲欧美精品伊人久久| 麻豆成人综合网| 国产精品人人做人人爽| 亚洲一区二区精品| 久久精品国产亚洲精品| 国产日韩亚洲欧美综合| 久久高清国产| 亚洲第一区在线| 亚洲免费在线观看视频| 国产欧美一区二区色老头| 久久成年人视频| 亚洲福利视频专区| 亚洲欧美激情精品一区二区| 国产欧美一区二区视频| 老色鬼精品视频在线观看播放| 亚洲高清网站| 久久精品卡一| 亚洲一区免费| 亚洲精品视频一区二区三区| 国产精品免费在线| 美女成人午夜| 欧美伊人久久久久久久久影院 | 亚洲精品1234| 午夜亚洲视频| 一本久道久久综合中文字幕| 极品日韩av| 国产女同一区二区| 欧美日韩免费高清| 欧美日韩1区2区| 日韩视频专区| 宅男噜噜噜66国产日韩在线观看| 国产精品伊人日日| 欧美日韩国产综合视频在线观看 | 欧美午夜电影完整版| 蜜臀va亚洲va欧美va天堂| 另类春色校园亚洲| 久久精品久久综合| 欧美一激情一区二区三区| 亚洲免费伊人电影在线观看av| 亚洲人成亚洲人成在线观看| 欧美成熟视频| 91久久久久久| 亚洲精品资源| 亚洲欧美一区二区三区极速播放| 日韩亚洲国产精品| 制服丝袜亚洲播放| 欧美一区午夜视频在线观看| 久久久九九九九| 欧美精品福利在线| 国产乱码精品一区二区三区五月婷 | 欧美电影免费观看大全| 欧美激情一区二区三区在线| 欧美大片va欧美在线播放| 欧美国产成人在线| 一片黄亚洲嫩模| 久久国内精品自在自线400部| 欧美+亚洲+精品+三区| 国产精品九九| 日韩亚洲一区在线播放| 国产精品美女黄网| 国产精品视频一| 亚洲国产高清一区| 欧美一区二区免费观在线| 欧美激情bt| 久久激情视频久久| 国产精品久久久久av| 日韩视频在线播放| 欧美www视频| 老妇喷水一区二区三区| 国产香蕉97碰碰久久人人| 亚洲欧美激情视频| 国产精品99久久久久久久久| 久久性色av| 在线观看欧美成人| 免费成人高清视频| 久久成人亚洲| 影音先锋亚洲精品| 久久精品免费观看| 久久久99国产精品免费| 国产一区二区三区的电影| 性伦欧美刺激片在线观看| 日韩写真视频在线观看| 欧美视频在线视频| 亚洲小少妇裸体bbw| 一本色道久久综合狠狠躁篇怎么玩 | 嫩草影视亚洲| 欧美ab在线视频| 亚洲综合三区| 欧美怡红院视频| 亚洲破处大片| 亚洲深爱激情| 在线欧美福利| 这里只有精品视频| 在线观看日韩一区| 亚洲人被黑人高潮完整版| 欧美午夜片在线免费观看| 久久久一区二区| 欧美系列亚洲系列| 亚洲福利视频专区| 国产一区二区在线观看免费播放| 国产欧美日韩三区| 亚洲高清在线播放| 国产亚洲精品综合一区91| 亚洲美女黄网| 亚洲精品在线免费观看视频| 欧美一级午夜免费电影| 99精品99久久久久久宅男| 欧美一区二区播放| 欧美一区1区三区3区公司| 欧美日韩国产黄| 亚洲免费观看高清在线观看| 亚洲成人资源网| 久久电影一区| 麻豆精品视频在线观看| 国产日本精品| 亚洲免费视频成人| 亚洲夜间福利| 国产精品视频999| 亚洲在线网站| 暖暖成人免费视频| 99re66热这里只有精品3直播| 久久只精品国产| 亚洲国产精品成人va在线观看| 在线看片成人|