www.pudn.com > uoth_src.zip > RuneLibrary.h
#ifndef DSSI_RUNELIBRARY_H #define DSSI_RUNELIBRARY_H //----------------------------------------------------------------------------- // // @doc // // @module RuneLibrary.h - Rune library information | // // This module contains the rune library information // // Copyright (c) 2002 - Descartes Systems Sciences, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // 2. Neither the name of Descartes Systems Sciences, Inc nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // @end // // $History: ExpatImpl.h $ // //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // // Required include files // //----------------------------------------------------------------------------- #include#include "ExpatImpl.h" #include "RuneBook.h" //----------------------------------------------------------------------------- // // Forward definitions // //----------------------------------------------------------------------------- class CDataParser; //----------------------------------------------------------------------------- // // Class definition // //----------------------------------------------------------------------------- class CRuneLibrary { public: enum _Element { Unknown = 0, RuneLibrary = 1, RuneBook = 2, Name = 3, }; // @access Constructors and destructors public: // @cmember General constructor CRuneLibrary (); // @cmember Copy constructor CRuneLibrary (const CRuneLibrary &src) : m_fPerm (src .m_fPerm), m_strName (src .m_strName) { m_vRuneBooks .Append (src .m_vRuneBooks); } // @cmember General destructor ~CRuneLibrary (); // @cmember Public methods public: // @cmember Initialize void Init (bool fConstruct); // @cmember Start a treasure void OnStart (CDataParser *pParser, const XML_Char **papszAttrs); // @cmember Start an XML element void OnStartElement (CDataParser *pParser, const XML_Char *pszName, const XML_Char **papszAttrs); // @cmember End an XML element void OnEndElement (CDataParser *pParser, const XML_Char *pszName); // @cmember Write the rune library to the output stream void Write (FILE *fp); // @cmember Find a rune book CRuneBook *FindBook (LPCTSTR pszName); // @cmember Add a rune book CRuneBook *AddBook (LPCTSTR pszName); // @cmember Delete the given rune book void DeleteBook (CRuneBook *pRuneBook); // @cmember Public inline methods public: // @cmember Add a book to the library void AddRuneBook (const CRuneBook &sBook) { m_vRuneBooks .Add (sBook); } // @cmember Assignment operator const CRuneLibrary &operator = (const CRuneLibrary &src) { m_fPerm = src .m_fPerm; m_strName = src .m_strName; m_vRuneBooks .RemoveAll (); m_vRuneBooks .Append (src .m_vRuneBooks); return *this; } // @cmember Public static methods public: // @cmember Find a rune library static CRuneLibrary *Find (LPCTSTR pszName); // @cmember Add a rune library static CRuneLibrary *Add (LPCTSTR pszName); // @cmember Delete the given rune library static void Delete (CRuneLibrary *pRuneLibrary); // @cmember Get the current rune library static CRuneLibrary *GetCurrent (); // @cmember Set the current character static void SetCurrent (CRuneLibrary *pRuneLibrary); // @cmember Set the default current static void GetDefaultCurrent (); // @access Protected methods protected: // @cmember Get the element number _Element GetElement (const XML_Char *pszName); // @access Public members public: bool m_fPerm; CString m_strName; CAtlArray m_vRuneBooks; static CAtlArray gm_vRuneLibraries; }; #endif // DSSI_RUNELIBRARY_H