Coding the BlueprintObjectParser class
This class will have the code that actually reads the text from the level1.txt
file we have discussed. It will parse one object at a time, as identified by the start and end tags we saw previously.
Create a new header file in the Header Files/FileIO
filter called BlueprintObjectParser.h
and add the following code:
#pragma once #include "GameObjectBlueprint.h" #include <string> using namespace std; class BlueprintObjectParser { private: Â Â Â Â string extractStringBetweenTags( Â Â Â Â Â Â Â Â string stringToSearch, string startTag, string endTag); public: Â Â Â Â void parseNextObjectForBlueprint( Â Â Â Â Â Â Â Â ifstream& reader, GameObjectBlueprint& bp); };
The extractStringBetweenTags
private function will capture the content between two tags. The parameters are three string
instances. The first string
is a full line...