newspeoplefor developersdocumentationdownloads

animtable.cc

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------
00002 //  graphics/animtable.cc
00003 //  (C) 2005 Radon Labs GmbH
00004 //------------------------------------------------------------------------------
00005 #include "graphics/animtable.h"
00006 
00007 namespace Graphics
00008 {
00009 ImplementRtti(Graphics::AnimTable, Foundation::RefCounted);
00010 ImplementFactory(Graphics::AnimTable);
00011 
00012 AnimTable* AnimTable::Singleton = 0;
00013 
00014 //------------------------------------------------------------------------------
00017 AnimTable::AnimTable()
00018 {
00019     n_assert(0 == Singleton);
00020     Singleton = this;
00021 }
00022 
00023 //------------------------------------------------------------------------------
00026 AnimTable::~AnimTable()
00027 {
00028     n_assert(Singleton);
00029     Singleton = 0;
00030 }
00031 
00032 //------------------------------------------------------------------------------
00035 bool
00036 AnimTable::Open()
00037 {
00038     return this->xmlSpreadsheet.Open();
00039 }
00040 
00041 //------------------------------------------------------------------------------
00044 void
00045 AnimTable::Close()
00046 {
00047     this->xmlSpreadsheet.Close();
00048 }
00049 
00050 //------------------------------------------------------------------------------
00053 const nString&
00054 AnimTable::Lookup(const nString& id, const nString& animName) const
00055 {
00056     nXmlTable& xmlTable = this->xmlSpreadsheet.TableAt(0);
00057     int idColIndex = xmlTable.FindColIndex(id);
00058     n_assert(idColIndex >= 0);
00059 
00060     int row;
00061     int num = xmlTable.NumRows();
00062     for (row = 1; row < num; row++)
00063     {
00064         if (xmlTable.Cell(row, 0).AsString() == animName)
00065         {
00066             return xmlTable.Cell(row, idColIndex).AsString();
00067         }
00068     }
00069     n_error("AnimTable::Lookup(): could not resolve id(%s), animName(%s) in file '%s'!", id.Get(), animName.Get(), this->GetFilename().Get());
00070     static const nString dummyStr;
00071     return dummyStr;
00072 }
00073 
00074 }; // namespace Graphics

Copyright © 1999-2005 by the contributing authors. Ideas, requests, problems: Send feedback.