예제 #1
0
파일: main.cpp 프로젝트: PLaGInc/Lab_3_q2
void RectangleActions(CRectangle &rect, ifstream &fin)
{
	string action;
	fin >> action;
	if (action == "Rectangle")
	{
		int width, height, left, top;
		fin >> left >> top >> width >> height;
		rect.SetLeft(left);
		rect.SetTop(top);
		rect.SetWidth(width);
		rect.SetHeight(height);
	}
예제 #2
0
void CProcessRectangles::ProcessRectangleCommand(const listArguments & arguments, CRectangle & rectangle)
{
    if (arguments.size() != AMOUNT_ARGUMENTS_FOR_COMMAND[static_cast<int>(IdCommand::Rectangle)])
    {
        throw invalid_argument(MESSAGE_INCORRECT_AMOUNT_ARGUMENTS
                               + to_string(AMOUNT_ARGUMENTS_FOR_COMMAND[static_cast<int>(IdCommand::Rectangle)]));
    }

    rectangle.SetLeft(stoi(arguments[1]));
    rectangle.SetTop(stoi(arguments[2]));
    rectangle.SetWidth(stoi(arguments[3]));
    rectangle.SetHeight(stoi(arguments[4]));
}