How do I associate a string read in from a file to an enum value?

Problem

The issue I'm having is that I am to read in data from a file and display it in a list. I cannot seem to get my EnumMap to work as intended though. The enum is declared in the header but I cannot get it to work in the cpp file. I have an idea as to how this would work but I believe it hinges on the EnumMap sequence.

Links to pastebin:

GrItem: http://pastebin.com/0tvQ5yQA

StoreItem.h: http://pastebin.com/NpiSXRpG

The code, in short I'm having difficulty with is:

1
2
3
4
5
6
7
8
9
10
11
std::map<std::string, GrItem::taxCategory> EnumMap;
	EnumMap = enumMap;

	// Initialize
	EnumMap["alcohol"] = alcohol;
	EnumMap["food"] = food;
	EnumMap["general merchansise"] = genMerchandise;
	EnumMap["medicine"] = medicine;

	// Convert strings to enums
	std::string key = "alcohol";


The intent of the whole program is to read in a list of string items, associate them with values and print them out formatted to the screen. I cannot seem to do the part where I actually use the enum part.

Any help would be appreciated, thanks.
Topic archived. No new replies allowed.