In my C++ project I want to refer to a specific set of functions with strings.
Basically I want to announce certain abilities of a class to a string-array.
Like this:
class Dog{
public:
doBark(){}
doPoop(){}
doLick(){}
doWalk(){}
doRun(){}
otherFunction(){}
getAbilities(){}
}
And getActions() should return a string array (or vector) with the function names starting with "do".
In case any one wonders why: In a framework I use I can only use a certain set of types such as strings. My objects should tell the framework what they can do, so that tasks can be planned accord to their ability. Later, strings should be mapped back to functions, about which I already found useful answers on here.
Now my question: Is this even possible? If yes, how?
class ActionGetter { virtual string getActions() = 0; }(of course using proper syntax), inheriting, and overriding thegetActions()method on a per class basis. If someone knows of an easier way let's hear it.