blob: 5ae0ec0da0f056040aa78ace649fa925c5e26970 (
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
58
59
|
<!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.17 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> </center>
<hr><h1>swobject.h</h1><div class="fragment"><pre>00001 <span class="preprocessor">#ifndef SWOBJECT_H</span>
00002 <span class="preprocessor"></span><span class="preprocessor">#define SWOBJECT_H</span>
00003 <span class="preprocessor"></span>
00004 <span class="preprocessor">#include <utilfuns.h></span>
00005 <span class="preprocessor">#if !defined(__GNUC__) && !defined(_WIN32_WCE)</span>
00006 <span class="preprocessor"></span><span class="preprocessor">#else</span>
00007 <span class="preprocessor"></span><span class="preprocessor">#include <unixstr.h></span>
00008 <span class="preprocessor">#endif</span>
00009 <span class="preprocessor"></span>
00010 <span class="preprocessor">#include <defs.h></span>
00011 <span class="preprocessor">#include <string.h></span>
00012
00013 SWORD_NAMESPACE_START
00014 <span class="preprocessor">#define SWDYNAMIC_CAST(className, object) (className *)((object)?((object->getClass()->isAssignableFrom(#className))?object:0):0)</span>
00015 <span class="preprocessor"></span>
<a name="l00019"></a><a class="code" href="classsword_1_1_s_w_class.html">00019</a> <span class="keyword">class </span>SWDLLEXPORT <a class="code" href="classsword_1_1_s_w_class.html">SWClass</a> {
00020 <span class="keyword">private</span>:
00021 <span class="keyword">const</span> <span class="keywordtype">char</span> **descends;
00022
00023 <span class="keyword">public</span>:
00024 <a class="code" href="classsword_1_1_s_w_class.html">SWClass</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> **descends) {
00025 this->descends = descends;
00026 }
00027
00028 <span class="keywordtype">bool</span> isAssignableFrom(<span class="keyword">const</span> <span class="keywordtype">char</span> *className)<span class="keyword"> const </span>{
00029 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; descends[i]; i++) {
00030 <span class="keywordflow">if</span> (!stricmp(descends[i], className))
00031 <span class="keywordflow">return</span> <span class="keyword">true</span>;
00032 }
00033 <span class="keywordflow">return</span> <span class="keyword">false</span>;
00034 }
00035 };
00036
<a name="l00042"></a><a class="code" href="classsword_1_1_s_w_object.html">00042</a> <span class="keyword">class </span><a class="code" href="classsword_1_1_s_w_object.html">SWObject</a> {
00043 <span class="keyword">protected</span>:
00044 <a class="code" href="classsword_1_1_s_w_class.html">SWClass</a> * myclass;
00045
00046 <span class="keyword">public</span>:
<a name="l00050"></a><a class="code" href="classsword_1_1_s_w_object.html#a0">00050</a> <span class="keyword">const</span> <a class="code" href="classsword_1_1_s_w_class.html">SWClass</a> *getClass ()<span class="keyword"> const </span>{
00051 <span class="keywordflow">return</span> myclass;
00052 }
00053 };
00054
00055 SWORD_NAMESPACE_END
00056 <span class="preprocessor">#endif</span>
</pre></div><hr><address style="align: right;"><small>Generated on Thu Oct 31 12:11:28 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.17 </small></address>
</body>
</html>
|