Plus  - Minimal XML for C++ (Version 0.9.2) Giancarlo Niccolai
Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

mxml_attribute.h

Go to the documentation of this file.
00001 /*
00002    Mini XML lib PLUS for C++
00003 
00004    Attribute class
00005 
00006    Author: Giancarlo Niccolai <gian@niccolai.ws>
00007 
00008    $Id: mxml_attribute.h,v 1.2 2004/01/11 13:32:17 jonnymind Exp $
00009 */
00010 
00011 #ifndef MXML_ATTRIBUTE_H
00012 #define MXML_ATTRIBUTE_H
00013 
00014 #include <string>
00015 #include <iostream>
00016 #include <mxml_element.h>
00017 
00018 namespace MXML {
00019 
00025 class Attribute: public Element
00026 {
00027 private:
00029    std::string m_name;
00031    std::string m_value;
00032 
00033 public:
00044    Attribute( std::istream &in, int style=0, int line=1, int pos=0  );
00045 
00046 
00047    /* Creates a new attribute
00048       \todo chech for name validity and throw an error
00049       @param name the name of the newborn attribute
00050       @param value the value of the newborn attribute
00051    */
00052    Attribute( const std::string &name, const std::string &value ): Element()
00053    {
00054       m_name = name;
00055       m_value = value;
00056    }
00057 
00058    /* Copies an attribute. */
00059    Attribute( Attribute &src): Element( src )
00060    {
00061       m_name= src.m_name;
00062       m_value = src.m_value;
00063    };
00064 
00066    const std::string name() const { return m_name; }
00071    const std::string value() const { return m_value; }
00072 
00076    void name( const std::string &new_name ) { m_name = new_name; }
00077 
00081    void value( const std::string &new_value ) { m_value = new_value; }
00082 
00091    virtual void write( std::ostream &out, const int style ) const;
00092 };
00093 
00094 } // namespace
00095 
00096 #endif /* end of mxml_attribute.h */

Generated on Sun Apr 11 02:08:18 2004 for Mxml Plus by doxygen 1.3.5