aboutsummaryrefslogtreecommitdiffstats
path: root/doc/api-documentation/html/swobject_8h-source.html
blob: 785840c567ecdf863136e5d5a494eea8f7fa2842 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!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>swobject.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="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</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>swobject.h</h1><div class="fragment"><pre>00001 <font class="preprocessor">#ifndef SWOBJECT_H</font>
00002 <font class="preprocessor"></font><font class="preprocessor">#define SWOBJECT_H</font>
00003 <font class="preprocessor"></font>
00004 <font class="preprocessor">#include &lt;utilfuns.h&gt;</font>
00005 <font class="preprocessor">#if !defined(__GNUC__) &amp;&amp; !defined(_WIN32_WCE)</font>
00006 <font class="preprocessor"></font><font class="preprocessor">#else</font>
00007 <font class="preprocessor"></font><font class="preprocessor">#include &lt;unixstr.h&gt;</font>
00008 <font class="preprocessor">#endif</font>
00009 <font class="preprocessor"></font>
00010 <font class="preprocessor">#include &lt;defs.h&gt;</font>
00011 <font class="preprocessor">#include &lt;string.h&gt;</font>
00012 
00013 <font class="preprocessor">#define SWDYNAMIC_CAST(className, object) (className *)((object)?((object-&gt;getClass()-&gt;isAssignableFrom(#className))?object:0):0)</font>
00014 <font class="preprocessor"></font>
<a name="l00018"></a><a class="code" href="class_s_w_class.html">00018</a> <font class="keyword">class </font>SWDLLEXPORT <a class="code" href="class_s_w_class.html">SWClass</a> {
00019 <font class="keyword">private</font>:
00020         <font class="keyword">const</font> <font class="keywordtype">char</font> **descends;
00021 
00022 <font class="keyword">public</font>:
00023         <a class="code" href="class_s_w_class.html">SWClass</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> **descends) {
00024                 this-&gt;descends = descends;
00025         }
00026 
00027         <font class="keywordtype">bool</font> isAssignableFrom(<font class="keyword">const</font> <font class="keywordtype">char</font> *className)<font class="keyword"> const </font>{
00028                 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i = 0; descends[i]; i++) {
00029                         <font class="keywordflow">if</font> (!stricmp(descends[i], className))
00030                                 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00031                 }
00032                 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00033         }
00034 };
00035 
<a name="l00041"></a><a class="code" href="class_s_w_object.html">00041</a> <font class="keyword">class </font><a class="code" href="class_s_w_object.html">SWObject</a> {
00042 <font class="keyword">protected</font>:
00043         <a class="code" href="class_s_w_class.html">SWClass</a> * myclass;
00044      
00045 <font class="keyword">public</font>:
<a name="l00049"></a><a class="code" href="class_s_w_object.html#a0">00049</a>         <font class="keyword">const</font> <a class="code" href="class_s_w_class.html">SWClass</a> *<a class="code" href="class_s_w_object.html#a0">getClass</a> ()<font class="keyword"> const </font>{
00050                 <font class="keywordflow">return</font> myclass;
00051         }
00052 };
00053 
00054 <font class="preprocessor">#endif</font>
</pre></div><hr><address align="right"><small>Generated on Thu Jun 20 22:13:00 2002 for The Sword Project 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>