⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 field_8h-source.html

📁 java 反射机制详解示例,实现类属性及方法修改
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>field.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.15 --><center><a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; </center><hr><h1>field.h</h1><div class="fragment"><pre>00001 <font class="preprocessor">#ifndef __FIELD_H__</font>00002 <font class="preprocessor"></font><font class="preprocessor">#define __FIELD_H__</font>00003 <font class="preprocessor"></font>00004 <font class="preprocessor">#include &lt;string.h&gt;</font>00005 00009 <font class="keyword">enum</font> RTTIFieldFlags { 00010     RTTI_FLD_INSTANCE  = 0x0001, 00011     RTTI_FLD_STATIC    = 0x0002, 00012     RTTI_FLD_CONST     = 0x0004, 00013     RTTI_FLD_PUBLIC    = 0x0010, 00014     RTTI_FLD_PROTECTED = 0x0020, 00015     RTTI_FLD_PRIVATE   = 0x0040, 00016     RTTI_FLD_VIRTUAL   = 0x0100, <font class="comment">// used for virtual base classes</font>00017     RTTI_FLD_VOLATILE  = 0x0200, 00018     RTTI_FLD_TRANSIENT = 0x040000019 }; 00020 00021 <a name="l00025"></a><a class="code" href="classRTTIFieldDescriptor.html">00025</a> <font class="keyword">class </font><a class="code" href="classRTTIFieldDescriptor.html">RTTIFieldDescriptor</a> { 00026   <font class="keyword">public</font>:<a name="l00031"></a><a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora0">00031</a>     <font class="keywordtype">char</font> <font class="keyword">const</font>* <a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora0">getName</a>() { 00032         <font class="keywordflow">return</font> name;00033     }00034 <a name="l00042"></a><a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora1">00042</a>     <font class="keywordtype">void</font> <a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora1">setValue</a>(<font class="keywordtype">void</font>* obj, <font class="keywordtype">void</font>* buf) { 00043         memcpy((<font class="keywordtype">char</font>*)obj + offs, buf, size);00044     }00045 <a name="l00053"></a><a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora2">00053</a>     <font class="keywordtype">void</font> <a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora2">getValue</a>(<font class="keywordtype">void</font>* obj, <font class="keywordtype">void</font>* buf) { 00054         memcpy(buf, (<font class="keywordtype">char</font>*)obj + offs, size);00055     }00056 <a name="l00061"></a><a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora3">00061</a>     <a class="code" href="classRTTIClassDescriptor.html">RTTIClassDescriptor</a>* <a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora3">getDelcaringClass</a>() { 00062         <font class="keywordflow">return</font> declaringClass;00063     }00064     <a name="l00069"></a><a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora4">00069</a>     <font class="keywordtype">int</font> <a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora4">getOffset</a>() { 00070         <font class="keywordflow">return</font> offs;00071     }00072         <a name="l00077"></a><a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora5">00077</a>     <font class="keywordtype">int</font> <a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora5">getSize</a>() { 00078         <font class="keywordflow">return</font> size;00079     }00080         <a name="l00085"></a><a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora6">00085</a>     <a class="code" href="classRTTIType.html">RTTIType</a>* <a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora6">getType</a>() { 00086         <font class="keywordflow">return</font> type;00087     }00088 <a name="l00093"></a><a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora7">00093</a>     <font class="keywordtype">int</font> <a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora7">getFlags</a>() { 00094         <font class="keywordflow">return</font> flags;00095     }00096 00097 <a name="l00106"></a><a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora8">00106</a>     <a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora8">RTTIFieldDescriptor</a>(<font class="keywordtype">char</font> <font class="keyword">const</font>* name, <font class="keywordtype">int</font> offs, <font class="keywordtype">int</font> size, <font class="keywordtype">int</font> flags, <a class="code" href="classRTTIType.html">RTTIType</a>* type) { 00107         this-&gt;name = name;00108         this-&gt;offs = offs;00109         this-&gt;size = size;00110         this-&gt;type = type;00111         this-&gt;flags = flags;00112         next = NULL; 00113         chain = &amp;next;00114     }00115 <a name="l00122"></a><a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora9">00122</a>     <a class="code" href="classRTTIFieldDescriptor.html">RTTIFieldDescriptor</a>&amp; <a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora9">operator, </a>(<a class="code" href="classRTTIFieldDescriptor.html">RTTIFieldDescriptor</a>&amp; field) {00123         *chain = &amp;field;00124         chain = &amp;field.<a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptorn7">next</a>;00125         <font class="keywordflow">return</font> *<font class="keyword">this</font>;00126     }00127 <a name="l00132"></a><a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora10">00132</a>     <font class="keywordtype">int</font> <a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora10">getIndex</a>() { 00133         <font class="keywordflow">return</font> index;00134     }00135     <a name="l00139"></a><a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora11">00139</a>     <a class="code" href="classRTTIFieldDescriptor.html#RTTIFieldDescriptora11">~RTTIFieldDescriptor</a>() { 00140         type-&gt;<a class="code" href="classRTTIType.html#RTTITypeb0">destroy</a>();00141     }00142   <font class="keyword">protected</font>:00143     <font class="keyword">friend</font> <font class="keyword">class </font><a class="code" href="classRTTIType.html">RTTIType</a>;00144     <font class="keyword">friend</font> <font class="keyword">class </font><a class="code" href="classRTTIClassDescriptor.html">RTTIClassDescriptor</a>;00145     <font class="keyword">friend</font> <font class="keyword">class </font>RTTIBfdRepository;00146 00147     <font class="keywordtype">int</font>         flags;00148     <font class="keywordtype">int</font>         index;00149     <a class="code" href="classRTTIType.html">RTTIType</a>*   type;00150     <font class="keywordtype">int</font>         offs;00151     <font class="keywordtype">int</font>         size;00152     <font class="keywordtype">char</font> <font class="keyword">const</font>* name;00153 00154     <a class="code" href="classRTTIClassDescriptor.html">RTTIClassDescriptor</a>*  declaringClass;00155 00156     <a class="code" href="classRTTIFieldDescriptor.html">RTTIFieldDescriptor</a>*  next;00157     <a class="code" href="classRTTIFieldDescriptor.html">RTTIFieldDescriptor</a>** chain;00158 };00159 00160 <font class="preprocessor">#endif</font></pre></div><hr><address align="right"><small>Generated on Fri Apr 26 17:39:24 2002 for CppReflection by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.15 </small></address></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -