libzypp  11.13.5
ProblemSolutionCombi.cc
Go to the documentation of this file.
1 
2 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
3 /* ProblemSolution.cc
4  *
5  * Easy-to use interface to the ZYPP dependency resolver
6  *
7  * Copyright (C) 2000-2002 Ximian, Inc.
8  * Copyright (C) 2005 SUSE Linux Products GmbH
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License,
12  * version 2, as published by the Free Software Foundation.
13  *
14  * This program is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22  * 02111-1307, USA.
23  */
24 
25 #include <sstream>
26 
27 #include "zypp/base/String.h"
28 #include "zypp/base/Gettext.h"
29 
31 
32 using namespace std;
33 
35 namespace zypp
36 {
37 
38  namespace solver
39  {
40 
41  namespace detail
42  {
43 
44 IMPL_PTR_TYPE(ProblemSolutionCombi);
45 
46 //---------------------------------------------------------------------------
47 
48 ProblemSolutionCombi::ProblemSolutionCombi( ResolverProblem_Ptr parent)
49  : ProblemSolution (parent, "", "")
50  , actNumber(0)
51 {
52  _description = "";
53  _details = "";
54 }
55 
57 {
58  addAction (new TransactionSolutionAction(capability, action));
59  actNumber++;
60 }
61 
63 {
64  addAction (new TransactionSolutionAction(item, action));
65  actNumber++;
66 }
67 
68 void ProblemSolutionCombi::addSingleAction( SolverQueueItem_Ptr item, const TransactionKind action)
69 {
70  addAction (new TransactionSolutionAction(item, action));
71  actNumber++;
72 }
73 
74 void ProblemSolutionCombi::addDescription( const std::string description)
75 {
76  if ( _description.size() == 0
77  && _details.size() == 0) {
78  // first entry
80  } else {
81  if ( _description.size() > 0
82  && _details.size() == 0) {
83  // second entry
85  _description = _("Following actions will be done:");
86  }
87  // all other
88  _details += "\n";
90  }
91 }
92 
93 void ProblemSolutionCombi::addFrontDescription( const std::string & description )
94 {
95  if ( _description.size() == 0
96  && _details.size() == 0) {
97  // first entry
99  } else {
100  if ( _description.size() > 0
101  && _details.size() == 0) {
102  // second entry
104  _description = _("Following actions will be done:");
105  }
106  // all other
107  std::string tmp( _details );
109  _details += "\n";
110  _details += tmp;
111  }
112 }
113 
115  };// namespace detail
118  };// namespace solver
121 };// namespace zypp