/***************************************************************************
*   Copyright (C) 2004 by Hans Oischinger                                 *
*   hans.oischinger@kdemail.net                                           *
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
*                                                                         *
*   This program is distributed in the hope that it will be useful,       *
*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
*   GNU General Public License for more details.                          *
*                                                                         *
*   You should have received a copy of the GNU General Public License     *
*   along with this program; if not, write to the                         *
*   Free Software Foundation, Inc.,                                       *
*   51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA.             *
***************************************************************************/
#ifndef ATTRIBUTE_H
#define ATTRIBUTE_H

class AVisitor;
/**
Abstract base class for all Attributes
 
@author Hans Oischinger
*/
class Attribute
{
public:
  // Simple Introspection mechanism
  enum AttributeType
  {
    ATTR_NULL,
    ATTR_LENGTH,
    ATTR_NUMBER,
    ATTR_ENUM,
    ATTR_FILL,
    ATTR_STROKE,
    ATTR_COLOR,
    ATTR_TRANSFORM,
    ATTR_ANGLE,
    ATTR_REF,
    ATTR_TIME
  };

  Attribute( AttributeType type );
  virtual ~Attribute();
  Attribute( const Attribute & );

  virtual Attribute &operator=(const Attribute &);
  virtual Attribute* clone() = 0;

  AttributeType attributeType() const { return m_attrType; }

  // Accept a AVisitor.
  virtual void accept( AVisitor& ) = 0;

  // isValid() returns false if contents are invalid (e.g. constructed via default constructor)
  virtual bool isValid() const { return m_valid; }
  // Validity can be set from outside if needed
  virtual void setValid( bool b = true ) { m_valid = b; }

protected:
  AttributeType m_attrType;
  bool m_valid;
};

#endif
