00001 /// \file CATXMLFactory.cpp 00002 /// \brief XML Factory base 00003 /// \ingroup CAT 00004 /// 00005 /// Copyright (c) 2003-2007 by Michael Ellison. 00006 /// See COPYING.txt for the \ref gaslicense License (MIT License). 00007 /// 00008 // $Author: mikeellison $ 00009 // $Date: 2008-01-14 02:13:38 -0600 (Mon, 14 Jan 2008) $ 00010 // $Revision: $ 00011 // $NoKeywords: $ 00012 00013 #include "CATXMLFactory.h" 00014 00015 CATXMLFactory::CATXMLFactory() 00016 {} 00017 00018 CATXMLFactory::~CATXMLFactory() 00019 {} 00020 00021 CATXMLObject* CATXMLFactory::CreateObject( const CATWChar* objectType) 00022 { 00023 CATXMLObject* newObject = new CATXMLObject(objectType); 00024 return newObject; 00025 } 00026 00027 00028 CATResult CATXMLFactory::Create( const CATWChar* objectType, 00029 CATXMLAttribs* attributes, 00030 CATXMLObject* parent, 00031 CATXMLObject*& newObject) 00032 { 00033 newObject = CreateObject(objectType); 00034 00035 if (newObject == 0) 00036 return CAT_ERR_XML_CREATE_FAILED; 00037 00038 00039 newObject->SetAttributes(attributes); 00040 if (parent) 00041 { 00042 parent->AddChild(newObject); 00043 } 00044 00045 return CAT_SUCCESS; 00046 }