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

Component.h

00001 /*
00002  * Component.h -- class interface for spell components
00003  * Copyright (C) 2003  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: Component.h,v 1.2 2003/02/27 22:42:17 elemings Exp $
00021  */
00022 
00023 #ifdef __cplusplus
00024 
00025 #  ifndef OGS_MAGIC_COMPONENT_H
00026 #    define OGS_MAGIC_COMPONENT_H
00027 
00028 #    include <string>
00029 
00030 #    include <ogs/magic/Namespace.h>
00031 
00032 OGS_BEGIN_MAGIC_NAMESPACE
00033 
00043 class Component {
00044   public:
00046     enum Type {
00052       VERBAL = 1,
00053 
00058       SOMANTIC = 2,
00059 
00064       MATERIAL = 3,
00065 
00070       FOCUS = 4,
00071 
00076       DIVINE_FOCUS = 5,
00077 
00082       EXPERIENCE_COST = 6
00083     };
00084 
00085     static Component Verbal ();
00086     static Component Somantic ();
00087     static Component DivineFocus ();
00088 
00089     Type getType () const;
00090     std::string getAbbreviation () const;
00091 
00092   protected:
00093     Component (Type type);
00094 
00095   private:
00096     Type _type;
00097 
00098     static bool isValid (int value);
00099 };
00100 
00106 inline Component Component::Verbal () {
00107   return (Component (Component::VERBAL));
00108 }
00109 
00115 inline Component Component::Somantic () {
00116   return (Component (Component::SOMANTIC));
00117 }
00118 
00124 inline Component Component::DivineFocus () {
00125   return (Component (Component::DIVINE_FOCUS));
00126 }
00127 
00133 inline Component::Type Component::getType () const {
00134   return (this->_type);
00135 }
00136 
00142 inline std::string Component::getAbbreviation () const {
00143   return (this->_type == VERBAL? "V":
00144           this->_type == SOMANTIC? "S":
00145           this->_type == MATERIAL? "M":
00146           this->_type == FOCUS? "F":
00147           this->_type == DIVINE_FOCUS? "DF":
00148           this->_type == EXPERIENCE_COST? "XP": "");
00149 }
00150 
00157 inline bool Component::isValid (int value) {
00158   return (value == VERBAL ||
00159           value == SOMANTIC ||
00160           value == MATERIAL ||
00161           value == FOCUS ||
00162           value == DIVINE_FOCUS ||
00163           value == EXPERIENCE_COST);
00164 }
00165 
00166 OGS_END_MAGIC_NAMESPACE
00167 
00168 #  endif /* !defined OGS_MAGIC_COMPONENT_H */
00169 
00170 #endif /* defined __cplusplus */
00171 

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