XmlCharData.hpp

Go to the documentation of this file.
00001 /*
00002 Copyright 2007, 2008, 2009, 2010, 2011 Instituto de Sistemas e Robotica, Instituto Superior Tecnico
00003 
00004 This file is part of MeRMaID.
00005 
00006 MeRMaID is free software: you can redistribute it and/or modify
00007 it under the terms of the GNU Lesser General Public License as published by
00008 the Free Software Foundation, either version 3 of the License, or
00009 (at your option) any later version.
00010 
00011 MeRMaID 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 Lesser General Public License for more details.
00015 
00016 You should have received a copy of the GNU Lesser General Public License
00017 along with MeRMaID.  If not, see <http://www.gnu.org/licenses/>.
00018 */
00019 
00020 
00021 
00022 /**
00023  * @Filename XmlCharData.hpp
00024  * @Description XmlCharData declaration file.
00025  * @Status Implementing
00026  * @Version $Id: XmlCharData.hpp 1 2011-03-04 18:13:18Z jreis $
00027  * @Maintainer Nelson Ramos (nmsra@mega.ist.utl.pt)
00028  */
00029 
00030 #ifndef __XML_XMLCHARDATA_H_
00031 #define __XML_XMLCHARDATA_H_
00032 
00033 namespace mermaid
00034 {
00035   namespace support
00036   {
00037     namespace xml
00038     {
00039       class XmlCharData;
00040     }
00041   }
00042 }
00043 
00044 #include <string>
00045 
00046 #include <boost/shared_ptr.hpp>
00047 
00048 #include "XmlItem.hpp"
00049 
00050 namespace mermaid
00051 {
00052   namespace support
00053   {
00054     namespace xml
00055     {
00056       using std::string;
00057       using boost::shared_ptr;
00058       
00059       typedef vector<shared_ptr<XmlCharData> > XmlCharDataVector;
00060       
00061       /**
00062       * @Class XmlCharData XmlCharData.h "XmlCharData.h"
00063       * @Description Class that holds CharData from XML files.
00064       * @Description Inherits from string.
00065       * @Author Marco Barbosa
00066       */
00067       class XmlCharData : public XmlItem
00068       {
00069         public:
00070           /**
00071           * Constructor
00072           * Creates an empty XmlCharData instance.
00073           */
00074           XmlCharData();
00075           
00076           /**
00077           * Constructor
00078           * Creates an XmlCharData instance from a C-like string.
00079           * @Argument c C-like string
00080           */
00081           XmlCharData (const char*c);
00082           
00083           virtual XmlCharData * clone();
00084           
00085           /**
00086           * Constructor
00087           * Creates an XmlCharData instance from a string.
00088           * @Argument s string
00089           */
00090           XmlCharData (string s);
00091           
00092           /**
00093           * Copy constructor.
00094           */
00095           XmlCharData (const XmlCharData &c);
00096           
00097           /**
00098           * Checks if instance is filled only with blank characters.
00099           * @Returns TRUE if instance is filled only with blanks,
00100           * FALSE otherwise.
00101           */
00102           const bool isBlank() const;
00103           
00104           /**
00105           * Removes blank characters from the beginning and end.
00106           */
00107           void removeEndBlanks();
00108           
00109           /**
00110           * @Description Method to convert value to string
00111           */
00112           virtual operator string() const;
00113           
00114           /**
00115            * @Description Method to check if XmlItem is of type XmlCharData
00116            * @Returns True
00117            */
00118           virtual const bool isXmlCharData() const;
00119           
00120         private:
00121           string string_;
00122       }; // class XmlCharData
00123     } // namespace xml
00124   } // namespace support
00125 } // namespace mermaid
00126 
00127 #endif // __XML_XMLCHARDATA_H_
Generated on Fri Mar 4 22:14:58 2011 for MeRMaID::support by  doxygen 1.6.3