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 name="robots" content="noindex">
<title>swobject.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body bgcolor="#ffffff">
<!-- Generated by Doxygen 1.1.5 on Thu May 24 19:50:26 2001 -->
<center>
<a class="qindex" href="index.html">Main Page</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="functions.html">Compound Members</a> </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 <utilfuns.h></font>
00005 <font class="preprocessor">#if !defined(__GNUC__) && !defined(_WIN32_WCE)
</font>00006 <font class="preprocessor"></font><font class="preprocessor">#else
</font>00007 <font class="preprocessor"></font><font class="preprocessor">#include <unixstr.h></font>
00008 <font class="preprocessor">#endif
</font>00009 <font class="preprocessor"></font>
00010 <font class="preprocessor">#include <defs.h></font>
00011 <font class="preprocessor">#include <string.h></font>
00012
00013 <font class="preprocessor">#define SWDYNAMIC_CAST(className, object) (className *)((object->getClass()->isAssignableFrom(#className))?object:0)
</font>00014 <font class="preprocessor"></font>
00015 <font class="keyword">class </font>SWDLLEXPORT SWClass {
00016 <font class="keyword">private</font>:
00017 <font class="keyword">const</font> <font class="keywordtype">char</font> **descends;
00018
00019 <font class="keyword">public</font>:
00020 SWClass (<font class="keyword">const</font> <font class="keywordtype">char</font> **descends)<font class="keyword"> </font>{
00021 this->descends = descends;
00022 }
00023
00024 <font class="keywordtype">bool</font> isAssignableFrom (<font class="keyword">const</font> <font class="keywordtype">char</font> *className)<font class="keyword"> const </font>{
00025 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i = 0; descends[i]; i++) {
00026 <font class="keywordflow">if</font> (!stricmp (descends[i], className))
00027 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00028 }
00029 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00030 }
00031 };
00032
00033
00034 <font class="keyword">class </font>SWObject {
00035 <font class="keyword">protected</font>:
00036 SWClass * myclass;
00037
00038 <font class="keyword">public</font>:
00039 <font class="keyword">const</font> SWClass *getClass ()<font class="keyword"> const </font>{
00040 <font class="keywordflow">return</font> myclass;
00041 }
00042 };
00043
00044 <font class="preprocessor">#endif
</font></div></pre><hr><address><small>Generated at Thu May 24 19:50:26 2001 for The Sword Project by
<a href="http://www.stack.nl/~dimitri/doxygen/index.html">
<img src="doxygen.gif" alt="doxygen" align=center border=0
width=110 height=53></a>1.1.5 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>,
© 1997-2000</small></address>
</body>
</html>
|