Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //create
- void CommandParser::create(const std::vector<std::string>& shapeInput)
- {
- if (!shapeInput.empty())
- { //can a sstream be treated as a string
- //TODO create a sstream with xml shape syntax and send it to create shape tag or better yet create cirle /rect etc..
- if (createInputShape(shapeInput))
- std::cout << "Successfully created shape at (" << shapes.size() - 1 << ") position.\n";
- else
- std::cerr << "Enter the correct shape format \n";
- }
- }
- bool CommandParser::createInputShape(const std::vector<std::string>& shapeInput)
- {
- if(shapeInput[0]=="rectangle")
- {
- int rectMin = 8; //no of elements a rectangle needs to have
- if (shapeInput.size() != rectMin) return false;
- std::string rectShape = "<rect x=\"" + shapeInput[1] + "\"y=\" " + shapeInput[2] + "\"width=\"" +
- shapeInput[3] + "\" height=\" " + shapeInput[4] + "\" fill=\" " + shapeInput[5] +
- +"\" stroke=\" " + shapeInput[6] + "\" stroke-width=\" " + shapeInput[7] = "\" >";
- createShape(rectShape);
- return true;
- }
- if(shapeInput[0]=="circle")
- {
- }
- if(shapeInput[0]=="ellipse")
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement