/***************************************************************************
 *   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.             *
 ***************************************************************************/
#include "enumeration.h"

// Visitors
#include "visitors/avisitor.h"

Enumeration::Enumeration()
    : Attribute( Attribute::ATTR_ENUM ),
    m_value(0)
{}

Enumeration::~Enumeration()
{}

Enumeration::Enumeration( unsigned int value )
    : Attribute( Attribute::ATTR_ENUM ),
    m_value(0)
{
  m_value = value;
  setValid();
}

Enumeration::Enumeration( const Enumeration& other )
  : Attribute( Attribute::ATTR_ENUM ),
    m_value(0)
{
  (*this) = other;
}

Enumeration & Enumeration::operator =( const Enumeration& other )
{
  Attribute::operator=(other);
  m_value = other.value();
  return *this;
}

Attribute* Enumeration::clone( )
{
  Enumeration* retElem = new Enumeration();
  *retElem = *this;
  return ( retElem );
}

void Enumeration::setValue( unsigned int value )
{
  m_value = value;
  setValid();
}

void Enumeration::accept( AVisitor &a )
{
  a.visit(*this);
}
