Teuchos_XMLObjectImplem.hpp

Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //                    Teuchos: Common Tools Package
00005 //                 Copyright (2004) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 #ifndef TEUCHOS_XMLOBJECTIMPLEM_H
00030 #define TEUCHOS_XMLOBJECTIMPLEM_H
00031 
00036 #include "Teuchos_Hashtable.hpp"
00037 #include "Teuchos_RefCountPtr.hpp"
00038 
00039 namespace Teuchos
00040 {
00041 
00042   class XMLObject;
00043 
00048   class XMLObjectImplem
00049     {
00050     public:
00052       XMLObjectImplem(const string& string);
00053 
00055       XMLObjectImplem* deepCopy() const ;
00056 
00058             void addAttribute(const string& name, const string& value);
00059 
00061       void addChild(const XMLObject& child);
00062 
00064       void addContent(const string& contentLine);
00065 
00067       string toString() const ;
00068 
00070       const string& getTag() const {return tag_;}
00071 
00073       string header() const ;
00074 
00076       string footer() const {return "</" + getTag() + ">";}
00077 
00079       bool hasAttribute(const string& name) const 
00080         {return attributes_.containsKey(name);}
00081 
00083       const string& getAttribute(const string& name) const 
00084         {return attributes_.get(name);}
00085 
00087       int numChildren() const ;
00088 
00090       const XMLObject& getChild(int i) const ;
00091 
00093       int numContentLines() const {return content_.length();}
00094 
00096       const string& getContentLine(int i) const {return content_[i];}
00097 
00098     private:
00099       string tag_;
00100       Hashtable<string, string> attributes_;
00101       Array<XMLObject> children_;
00102       Array<string> content_;
00103     };
00104 
00105 }
00106 
00107 #endif
00108 

Generated on Thu Sep 18 12:42:50 2008 for Teuchos - Trilinos Tools Package by doxygen 1.3.9.1