00001 // vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c:cindent: 00002 /* 00003 * Copyright (C) 2005 Dell Inc. 00004 * by Michael Brown <Michael_E_Brown@dell.com> 00005 * Licensed under the Open Software License version 2.1 00006 * 00007 * Alternatively, you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published 00009 * by the Free Software Foundation; either version 2 of the License, 00010 * or (at your option) any later version. 00011 00012 * This program is distributed in the hope that it will be useful, but 00013 * WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00015 * See the GNU General Public License for more details. 00016 */ 00017 00018 00019 #ifndef SMBIOSXMLIMPL_H 00020 #define SMBIOSXMLIMPL_H 00021 00022 // compat header should always be first header 00023 #include "smbios/compat.h" 00024 00025 #include "XmlUtils.h" 00026 #include "smbios/ISmbiosXml.h" 00027 #include "SmbiosImpl.h" 00028 00029 namespace smbios 00030 { 00031 class SmbiosTableXml : public virtual SmbiosTable 00032 { 00033 public: 00034 // ITERATORS! 00035 using SmbiosTable::operator[]; 00036 virtual iterator operator[]( const std::string & ); 00037 virtual const_iterator operator[]( const std::string & ) const; 00038 00039 virtual std::ostream & streamify(std::ostream & cout ) const; 00040 00041 // CONSTRUCTORS/DESTRUCTORS 00042 virtual ~SmbiosTableXml(); 00043 explicit SmbiosTableXml(std::vector<SmbiosStrategy *> initStrategyList, bool strictValidation = 0); 00044 00045 void setXmlFilePath( std::string ); 00046 int getTypeForString( const std::string )const; 00047 const std::string getStringForType( const int )const; 00048 00049 const XML_NAMESPACE DOMDocument *getXmlDoc() const; 00050 00051 protected: 00052 // Private, should never construct empty object. 00053 SmbiosTableXml (); 00054 00055 00056 protected: 00057 std::string xmlFile; 00058 00059 // parser owns all XML entities. When it is deleted, everything 00060 // goes with it. 00061 XML_NAMESPACE DOMBuilder *parser; 00062 00063 // The doc is owned by the parser. We do not have to clean it up 00064 // it is deleted when the parser is released. We keep a ref 00065 // here for speed purposes 00066 XML_NAMESPACE DOMDocument *doc; 00067 00068 // indicates if XML subsystem has been initialized and should be 00069 // terminated. 00070 bool xmlInitialized; 00071 00072 private: 00073 SmbiosTableXml (const SmbiosTableXml & source); 00074 SmbiosTableXml & operator = (const SmbiosTableXml & source); 00075 }; 00076 } 00077 00078 #endif /* SMBIOSXMLIMPL_H */ 00079