-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListCommand.cpp
More file actions
executable file
·46 lines (40 loc) · 1.41 KB
/
ListCommand.cpp
File metadata and controls
executable file
·46 lines (40 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//------------------------------------------------------------------------------
/// Filename: ListCommand.cpp
/// Description: Base Class for ListCommands
/// Authors:
/// Robin Ankele(0931951)
/// Tutor: Manuel Weber
/// Group: 24
/// Created: 08.09.2011
/// Last change: 18.09.2011
//------------------------------------------------------------------------------
#include <iostream>
#include "ListCommand.h"
#include "UserInterface.h"
#include "Database.h"
#include "SVGObject.h"
//------------------------------------------------------------------------------
ListCommand::ListCommand(UserInterface *ui,
Database *db): Command(ui,db)
{
name_.assign("list");
}
//------------------------------------------------------------------------------
ListCommand::~ListCommand() throw()
{
}
//------------------------------------------------------------------------------
bool ListCommand::execute()
{
std::vector<SVGObject*> svg_objects = db_->getAllSVGObjects();
if(svg_objects.empty())
return false;
for(std::vector<SVGObject*>::iterator it = svg_objects.begin();
it != svg_objects.end(); ++it)
{
std::cout<<"[gr-"<<(*it)->getGrpID()<<"]["<<(*it)->getID()<<std::flush
<<"] "<<(*it)->getCoordinates().front().getX()<<std::flush
<<" "<<(*it)->getCoordinates().front().getY()<<std::endl;
}
return true;
}