-
Notifications
You must be signed in to change notification settings - Fork 0
/
userinter.cpp
69 lines (58 loc) · 2.33 KB
/
userinter.cpp
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* Copyright (C) Johnny Saenz
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. */
#include "userinter.h"
namespace JSApm
{
UserInter::UserInter()
{
objhandle = new Handle;
}
void UserInter::Install(std::string package)
{
candidates_struct candidates = objhandle->handle_candidates(package, "", "", 0);
if ( candidates.candidates_new.size() != 0 )
{
std::cout << "\nThe following packages are going to be installed:" << std::endl;
std::vector<std::string>::const_iterator cig;
for(cig=candidates.candidates_new.begin(); cig!=candidates.candidates_new.end(); cig++)
{
std::cout << *cig << " ";
}
}
if ( candidates.candidates_revupgrade.size() != 0 )
{
std::cout << "\nThe following packages will be outdated:" << std::endl;
std::vector<std::string>::const_iterator cig;
for(cig=candidates.candidates_revupgrade.begin(); cig!=candidates.candidates_revupgrade.end(); cig++)
{
std::cout << *cig << " ";
}
}
if ( candidates.candidates_upgrade.size() != 0 )
{
std::cout << "\nThe following packages are going to be updated:" << std::endl;
std::vector<std::string>::const_iterator cig;
for(cig=candidates.candidates_upgrade.begin(); cig!=candidates.candidates_upgrade.end(); cig++)
{
std::cout << *cig << " ";
}
}
std::cout << "\n\n";
std::cout << candidates.candidates_upgrade.size() << " to upgrade, ";
std::cout << candidates.candidates_new.size() << " new ";
std::cout << "\n\nDo you want to continue?: (y/n) ";
std::string answ;
std::cin >> answ;
}
UserInter::~UserInter()
{
delete objhandle;
}
}