00001 /* 00002 * ExNihilo 3D Engine 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * 00018 * Please read AUTHORS file !!! 00019 * 00020 * $Id: ExManagerGizmo.cpp,v 1.5 2002/08/01 01:18:22 data Exp $ 00021 * 00022 */ 00023 00024 #include "ExManagerGizmo.h" 00025 00026 ExManagerGizmo::ExManagerGizmo(void) 00027 { 00028 Guard(ExManagerGizmo::ExManagerGizmo(void)) 00029 UnGuard 00030 } 00031 00032 00033 ExManagerGizmo::~ExManagerGizmo(void) 00034 { 00035 Guard(ExManagerGizmo::~ExManagerGizmo(void)) 00036 UnGuard 00037 } 00038 00039 00040 void ExManagerGizmo::Reset(void) 00041 { 00042 Guard(void ExManagerGizmo::Reset(void)) 00043 m_VecGizmo.clear(); 00044 UnGuard 00045 } 00046 00047 00048 void ExManagerGizmo::Init(void) 00049 { 00050 Guard(void ExManagerGizmo::Init(void)) 00051 UnGuard 00052 } 00053 00054 00055 bool ExManagerGizmo::Init(char * FileName) 00056 { 00057 Guard(bool ExManagerGizmo::Init(char * FileName)) 00058 //openf file and load object 00059 return true; 00060 UnGuard 00061 } 00062 00063 00064 ExId ExManagerGizmo::NewObject(void) 00065 { 00066 Guard(ExId ExManagerGizmo::NewObject(void)) 00067 ExCGizmo NewGizmo; 00068 m_VecGizmo.push_back(NewGizmo); 00069 return NewGizmo.GetId(); 00070 UnGuard 00071 } 00072 00073 00074 ExCGizmo * ExManagerGizmo::Get(char * Name) 00075 { 00076 Guard(ExCGizmo * ExManagerGizmo::Get(char * Name)) 00077 int i=0; 00078 for(m_ItVecGizmo=m_VecGizmo.begin();m_ItVecGizmo!=m_VecGizmo.end();m_ItVecGizmo++,i++) 00079 { 00080 if(strcmp(m_ItVecGizmo->GetName(),Name)==0) 00081 { 00082 return &m_VecGizmo.at(i); 00083 } 00084 } 00085 return NULL; 00086 UnGuard 00087 } 00088 00089 00090 ExCGizmo * ExManagerGizmo::Get(ExId Id) 00091 { 00092 Guard(ExCGizmo * ExManagerGizmo::Get(ExId Id)) 00093 int i=0; 00094 for(m_ItVecGizmo=m_VecGizmo.begin();m_ItVecGizmo!=m_VecGizmo.end();m_ItVecGizmo++,i++) 00095 { 00096 if(m_ItVecGizmo->GetId()==Id) 00097 { 00098 return &m_VecGizmo.at(i); 00099 } 00100 } 00101 return NULL; 00102 UnGuard 00103 } 00104 00105 00106 ExId ExManagerGizmo::Add(ExCGizmo Object) 00107 { 00108 Guard(ExId ExManagerGizmo::Add(ExCGizmo Object)) 00109 m_VecGizmo.push_back(Object); 00110 return Object.GetId(); 00111 UnGuard 00112 } 00113 00114 00115 bool ExManagerGizmo::Remove(ExId Id) 00116 { 00117 Guard(bool ExManagerGizmo::Remove(ExId Id)) 00118 for(m_ItVecGizmo=m_VecGizmo.begin();m_ItVecGizmo!=m_VecGizmo.end();m_ItVecGizmo++) 00119 { 00120 if(m_ItVecGizmo->GetId()==Id) 00121 { 00122 m_VecGizmo.erase(m_ItVecGizmo); 00123 return true; 00124 } 00125 } 00126 return false; 00127 UnGuard 00128 } 00129 00130 00131 ExId ExManagerGizmo::GetIdByName(char *Name) 00132 { 00133 Guard(ExId ExManagerGizmo::GetIdByName(char *Name)) 00134 for(m_ItVecGizmo=m_VecGizmo.begin();m_ItVecGizmo!=m_VecGizmo.end();m_ItVecGizmo++) 00135 { 00136 if(strcmp(m_ItVecGizmo->GetName(),Name)==0) 00137 { 00138 return m_ItVecGizmo->GetId(); 00139 } 00140 } 00141 return -1; 00142 UnGuard 00143 } 00144 00145 00146 char * ExManagerGizmo::GetNameById(ExId Id) 00147 { 00148 Guard(char * ExManagerGizmo::GetNameById(ExId Id)) 00149 for(m_ItVecGizmo=m_VecGizmo.begin();m_ItVecGizmo!=m_VecGizmo.end();m_ItVecGizmo++) 00150 { 00151 if(m_ItVecGizmo->GetId()==Id) 00152 { 00153 return m_ItVecGizmo->GetName(); 00154 } 00155 } 00156 return NULL; 00157 UnGuard 00158 }