XMLtoken.h

Go to the documentation of this file.
00001 //# XMLtoken.h: Representation of a single XML token.
00002 //# Copyright (C) 2005
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: $
00027 #ifndef XMLTOKEN_H_
00028 #define XMLTOKEN_H_
00029 
00030 #include <vector>
00031 #include <map>
00032 
00033 #include <casa/BasicSL/String.h>
00034 
00035 namespace casa {
00036 
00037 // <summary>
00038 // Representation of a single XML token.
00039 // </summary>
00040 //
00041 // <synopsis>
00042 // XMLtoken encapsulates an XML token which includes a name, zero or more
00043 // attributes, and optional content which can be a String or one or more
00044 // XMLtokens.
00045 // </synopsis>
00046 
00047 class XMLtoken {
00048 public:
00049         // Constructor that takes the tag name.
00050     XMLtoken(String n);
00051 
00052     ~XMLtoken();
00053 
00054     
00055     // Returns the attributes for this tag.
00056     std::map<String, String>* getAttributes();
00057 
00058     // Returns the list of content tags, or an empty list if there are none.
00059     std::vector<XMLtoken*>* getTags();
00060 
00061     // Returns this tag's name.
00062     const String getName();
00063 
00064     // Sets the String content of this tag to the given value.
00065     void setContent(String c);
00066 
00067     // Returns the String content of this tag, or blank if there is none.
00068     const String getContent();
00069 
00070     
00071     // Returns the value for the given attribute, or blank if the attribute
00072     // is invalid.
00073     String getAttribute(String attr);
00074     
00075 private:
00076         // Tag name.
00077     const String name;
00078     
00079     // String content (or blank for none).
00080     String content;
00081 
00082     // Token content (empty list for none).
00083     std::vector<XMLtoken*> tags;
00084     
00085     // Tag attributes.
00086     std::map<String, String> attributes;
00087 };
00088 
00089 }
00090 
00091 #endif /* XMLTOKEN_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1