Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

Descriptors.h

00001 /*
00002  * Descriptors.h -- class interface for spell descriptors
00003  * Copyright (C) 2002  Eric Lemings <elemings@users.sourceforge.net>
00004  *
00005  * This software is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This software is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this software; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00018  * 02111-1307, USA
00019  *
00020  * RCS: $Id: Descriptors.h,v 1.1 2003/01/07 07:41:33 elemings Exp $
00021  */
00022 
00023 #ifdef __cplusplus
00024 
00025 #  ifndef OGS_MAGIC_DESCRIPTORS_H
00026 #    define OGS_MAGIC_DESCRIPTORS_H
00027 
00028 #    pragma interface
00029 
00030 #    include <bitset>
00031 #    include <string>
00032 
00033 #    include <ogs/magic/Namespace.h>
00034 
00035 OGS_BEGIN_MAGIC_NAMESPACE
00036 
00043 template <size_t Size>
00044 class DescriptorsBase: public std::bitset<Size> {
00045   public:
00053     typedef size_t Type;
00054 
00056     static const Type ACID = 0;
00057 
00059     static const Type CHAOTIC = 1;
00060 
00062     static const Type COLD = 2;
00063 
00065     static const Type DARKNESS = 3;
00066 
00068     static const Type DEATH = 4;
00069 
00071     static const Type ELECTRICITY = 5;
00072 
00074     static const Type EVIL = 6;
00075 
00077     static const Type FEAR = 7;
00078 
00080     static const Type FIRE = 8;
00081 
00083     static const Type FORCE = 9;
00084 
00086     static const Type GOOD = 10;
00087 
00089     static const Type LANGUAGE_DEPENDENT = 11;
00090 
00092     static const Type LAWFUL = 12;
00093 
00095     static const Type LIGHT = 13;
00096 
00098     static const Type MIND_AFFECTING = 14;
00099 
00101     static const Type SONIC = 15;
00102 
00104     static const Type TELEPORTATION = 16;
00105 
00106     static std::string getName (Type type);
00107 };
00108 
00117 template <size_t Size>
00118 std::string DescriptorsBase<Size>::getName (Type type) {
00119   return (type == ACID? "Acid":
00120           type == CHAOTIC? "Chaotic":
00121           type == COLD? "Cold":
00122           type == DARKNESS? "Darkness":
00123           type == DEATH? "Death":
00124           type == ELECTRICITY? "Electricity":
00125           type == EVIL? "Evil":
00126           type == FEAR? "Fear":
00127           type == FIRE? "Fire":
00128           type == FORCE? "Force":
00129           type == GOOD? "Good":
00130           type == LANGUAGE_DEPENDENT? "Language-Dependent":
00131           type == LAWFUL? "Lawful":
00132           type == LIGHT? "Light":
00133           type == MIND_AFFECTING? "Mind-Affecting":
00134           type == SONIC? "Sonic":
00135           type == TELEPORTATION? "Teleportation": "");
00136 }
00137 
00141 typedef DescriptorsBase<32> Descriptors;
00142 
00143 OGS_END_MAGIC_NAMESPACE
00144 
00145 #  endif /* !defined OGS_MAGIC_DESCRIPTORS_H */
00146 
00147 #endif /* defined __cplusplus */
00148 

Generated on Sun Apr 20 03:36:17 2003 for Open Gaming System (OGS) by doxygen1.3