c++ cli - C++: What would be an appropriate solution to forming a collection of different data types? -
I am writing a command line interpreter and I am trying to prepare the format for individual commands. I have the name of the command, the maximum number of parameters and the minimum amount of parameters. I have a kind of compilation, one kind of prototype, what kind of parameters were my first idea to declare generic without a vector, but then I realized that it is not Java.
Say I have a command like "test.dat 2 read" I would like a structure that shows that the typical reading command has a string and then there is an integer.
Any thoughts?
I'm not really clear what you are asking, so I'm getting this wrong.
From your description, it seems that you have an abstract idea of the command, and according to the parameters they have the name and the required structure. From your description, it seems that you can type identifiers and signals Want a list of whether they are optional or not.
Then, you can only instantate a command object for each order that you expect to work with, and add them all into the collection of commands.
Alternatively, use the map archive to map commands into real command objects. Each order object can actually hold reference to the handler object to execute the command.
Comments
Post a Comment