libyui  3.3.2
YRpmGroupsTree.h
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
3  This library is free software; you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as
5  published by the Free Software Foundation; either version 2.1 of the
6  License, or (at your option) version 3.0 of the License. This library
7  is distributed in the hope that it will be useful, but WITHOUT ANY
8  WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  License for more details. You should have received a copy of the GNU
11  Lesser General Public License along with this library; if not, write
12  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13  Floor, Boston, MA 02110-1301 USA
14 */
15 
16 
17 /*-/
18 
19  File: YRpmGroupsTree.h
20 
21  Author: Stefan Hundhammer <sh@suse.de>
22 
23 /-*/
24 
25 #ifndef YRpmGroupsTree_h
26 #define YRpmGroupsTree_h
27 
28 
29 #include "YStringTree.h"
30 
31 
32 /**
33  * Efficient storage for RPM group tags
34  **/
36 {
37 public:
38 
39  /**
40  * Constructor.
41  **/
42 
44 
45  /**
46  * Destructor.
47  **/
48  virtual ~YRpmGroupsTree();
49 
50  /**
51  * Insert an RPM group into this tree if not already present.
52  * Splits the RPM group string ("abc/def/ghi") and creates tree items for
53  * each level as required.
54  * Returns the tree entry for this RPM group.
55  **/
56  YStringTreeItem * addRpmGroup( const std::string & rpmGroup )
57  { return addBranch( rpmGroup, '/' ); }
58 
59  /**
60  * Returns the complete (untranslated) RPM group tag string for 'node'.
61  **/
62  std::string rpmGroup( const YStringTreeItem * node )
63  { return origPath( node, '/', false ); }
64 
65  /**
66  * Returns the complete translated RPM group tag string for 'node'.
67  **/
68  std::string translatedRpmGroup( const YStringTreeItem * node )
69  { return translatedPath( node, '/', false ); }
70 
71  /**
72  * Add a predefined set of RPM groups
73  **/
74  void addFallbackRpmGroups();
75 };
76 
77 
78 
79 #endif // YRpmGroupsTree_h
Efficient storage for RPM group tags.
void addFallbackRpmGroups()
Add a predefined set of RPM groups.
Template class for tree items that maintain sort order.
Definition: TreeItem.h:191
std::string rpmGroup(const YStringTreeItem *node)
Returns the complete (untranslated) RPM group tag string for &#39;node&#39;.
std::string translatedRpmGroup(const YStringTreeItem *node)
Returns the complete translated RPM group tag string for &#39;node&#39;.
YStringTreeItem * addBranch(const std::string &content, char delimiter=0, YStringTreeItem *parent=0)
Add a unique new branch with text content &#39;content&#39; to the tree, beginning at &#39;parent&#39; (root if paren...
Definition: YStringTree.cc:48
YRpmGroupsTree()
Constructor.
Abstract base class for filter views with hierarchical filter criteria - e.g., RPM group tags...
Definition: YStringTree.h:41
YStringTreeItem * addRpmGroup(const std::string &rpmGroup)
Insert an RPM group into this tree if not already present.
virtual ~YRpmGroupsTree()
Destructor.
std::string translatedPath(const YStringTreeItem *item, char delimiter, bool startWithDelimiter=true)
Construct a complete original path for the specified tree item.
Definition: YStringTree.h:108
std::string origPath(const YStringTreeItem *item, char delimiter, bool startWithDelimiter=true)
Construct a complete original path for the specified tree item.
Definition: YStringTree.h:97