Show korientation.h syntax highlighted
/*
Copyright (C) 2003, 2004, 2005 by Luca Cappa
Written by Luca Cappa groton@users.sourceforge.net
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __KORIENTATION_H__
#define __KORIENTATION_H__
#include "kconstant.h"
class KOrientation : public KConstant<KOrientation>
{
friend class KConstant<KOrientation>;
protected:
KOrientation (const char* p_name) : KConstant<KOrientation> (p_name)
{
#ifdef KAS_OLD_WAY
KOrientation l_temp[] = {KOrientation::EAST, KOrientation::NORTH,
KOrientation::SOUTH, KOrientation::WEST};
SetWholeArray (l_temp, sizeof(l_temp)/sizeof (KOrientation));
//??KOrientation::INVALID = KOrientation ("INVALID");
#endif // KAS_OLD_WAY
};
public:
KOrientation () : KConstant<KOrientation> ()
{
}
KOrientation const & operator= (KOrientation const & p_t2) const
{
SetName (p_t2.m_name);
return *this;
}
KOrientation RotateClockwise ()
{
if (*this == KOrientation::NORTH)
return KOrientation::EAST;
else if (*this == KOrientation::EAST)
return KOrientation::SOUTH;
else if (*this == KOrientation::SOUTH)
return KOrientation::WEST;
else if (*this == KOrientation::WEST)
return KOrientation::NORTH;
return KOrientation::INVALID;
}
static const KOrientation NORTH;
static const KOrientation SOUTH;
static const KOrientation EAST;
static const KOrientation WEST;
};
#endif // __KORIENTATION_H__
See more files for this project here