156 lines
2.5 KiB
C++
156 lines
2.5 KiB
C++
#ifndef _GUITAR_ACTION_HPP_
|
|
#define _GUITAR_ACTION_HPP_
|
|
#ifndef _COMMON_STRING_HPP_
|
|
#include <common/string.hpp>
|
|
#endif
|
|
#ifndef _COMMON_ARRAY_HPP_
|
|
#include <common/array.hpp>
|
|
#endif
|
|
|
|
class Action
|
|
{
|
|
public:
|
|
typedef enum Attribute{None,Pick,PullOff,Bend,HammerOn,Release,SlideDown,SlideUp};
|
|
Action();
|
|
Action(Attribute action);
|
|
Action(const String &strAction);
|
|
virtual ~Action();
|
|
Attribute getAction(void)const;
|
|
void setAction(Attribute action);
|
|
String toString(void)const;
|
|
const Action &fromString(const String &string);
|
|
String toStringShort(void)const;
|
|
static Array<String> enumerate(void);
|
|
private:
|
|
Attribute mAction;
|
|
};
|
|
|
|
inline
|
|
Action::Action()
|
|
: mAction(None)
|
|
{
|
|
}
|
|
|
|
inline
|
|
Action::Action(Attribute action)
|
|
: mAction(action)
|
|
{
|
|
}
|
|
|
|
inline
|
|
Action::Action(const String &strAction)
|
|
{
|
|
fromString(strAction);
|
|
}
|
|
|
|
inline
|
|
Action::~Action()
|
|
{
|
|
}
|
|
|
|
inline
|
|
Action::Attribute Action::getAction(void)const
|
|
{
|
|
return mAction;
|
|
}
|
|
|
|
inline
|
|
void Action::setAction(Attribute action)
|
|
{
|
|
mAction=action;
|
|
}
|
|
|
|
inline
|
|
String Action::toStringShort(void)const
|
|
{
|
|
switch(mAction)
|
|
{
|
|
case PullOff :
|
|
return "p";
|
|
break;
|
|
case Bend :
|
|
return "b";
|
|
break;
|
|
case HammerOn :
|
|
return "h";
|
|
break;
|
|
case Release :
|
|
return "r";
|
|
break;
|
|
case SlideDown :
|
|
return "s";
|
|
break;
|
|
case SlideUp :
|
|
return "s";
|
|
break;
|
|
case Pick :
|
|
case None :
|
|
default :
|
|
return "";
|
|
break;
|
|
}
|
|
}
|
|
|
|
inline
|
|
String Action::toString(void)const
|
|
{
|
|
switch(mAction)
|
|
{
|
|
case Pick :
|
|
return "Pick";
|
|
break;
|
|
case PullOff :
|
|
return "PullOff";
|
|
break;
|
|
case Bend :
|
|
return "Bend";
|
|
break;
|
|
case HammerOn :
|
|
return "HammerOn";
|
|
break;
|
|
case Release :
|
|
return "Release";
|
|
break;
|
|
case SlideDown :
|
|
return "SlideDown";
|
|
break;
|
|
case SlideUp :
|
|
return "SlideUp";
|
|
break;
|
|
case None :
|
|
default :
|
|
return "None";
|
|
break;
|
|
}
|
|
}
|
|
|
|
inline
|
|
const Action &Action::fromString(const String &string)
|
|
{
|
|
if(string=="Pick")mAction=Pick;
|
|
else if(string=="PullOff")mAction=PullOff;
|
|
else if(string=="Bend")mAction=Bend;
|
|
else if(string=="HammerOn")mAction=HammerOn;
|
|
else if(string=="Release")mAction=Release;
|
|
else if(string=="SlideDown")mAction=SlideDown;
|
|
else if(string=="SlideUp")mAction=SlideUp;
|
|
else mAction=None;
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
Array<String> Action::enumerate(void)
|
|
{
|
|
Array<String> actions;
|
|
actions.size(7);
|
|
actions[0]="Pick";
|
|
actions[1]="PullOff";
|
|
actions[2]="Bend";
|
|
actions[3]="HammerOn";
|
|
actions[4]="Release";
|
|
actions[5]="SlideDown";
|
|
actions[6]="SlideUp";
|
|
return actions;
|
|
}
|
|
#endif
|