BasicXMLable.hxx

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG)
00003  *                         UNIVERSITAT POMPEU FABRA
00004  *
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00023 // Class BasicXMLable
00024 // Abstract class that defines some common implementation issues for
00025 // many XMLables that contains as member variables the XML name and
00026 // whether is an XML element or not.
00027 
00028 #ifndef _BasicXMLable_h
00029 #define _BasicXMLable_h
00030 
00031 #include "XMLable.hxx"
00032 #include "Assert.hxx"
00033 #include <ctype.h>
00034 #include <string>
00035 
00036 namespace CLAM {
00037 
00046 class BasicXMLable : public XMLable {
00047 // Attributes
00048 private:
00049         const char * myXMLName;
00050         bool amIXMLElement;
00051 // Construction/Destruction
00052 public:
00066         BasicXMLable (const char * name=0, bool isXMLElement=false);
00067         
00068         virtual ~BasicXMLable();
00069 // Accessors
00070 public:
00071         //* @return A pointer to the XMLName
00072         const char * XMLName() const
00073         {
00074                 return myXMLName;
00075         }
00076         //* @return Whether the object represents an XML element or not
00077         bool IsXMLElement() const
00078         {
00079                 return myXMLName && amIXMLElement;
00080         }
00081         //* @return Whether the object represents an XML attribute or not
00082         bool IsXMLAttribute() const
00083         {
00084                 return myXMLName && !amIXMLElement;
00085         }
00086         bool IsXMLText() const
00087         {
00088                 return myXMLName==0;
00089         }
00090         //* @return A string with the XML content
00091         virtual std::string XMLContent() const=0;
00092 // Testing
00093 public:
00094         //* Check the internal status for a class instance is valid
00095         bool FulfilsInvariant();
00096 };
00097 
00098 }
00099 
00100 #endif//_BasicXMLable_h
00101 
Generated by  doxygen 1.6.3