• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • KDevelop Shell Profiles Library
 

KDevelop Shell Profiles Library

  • src
  • profileengine
  • lib
profileengine.h
1 /***************************************************************************
2  * Copyright (C) 2004 by Alexander Dymo <adymo@kdevelop.org> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU Library General Public License as *
6  * published by the Free Software Foundation; either version 2 of the *
7  * License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU Library General Public *
15  * License along with this program; if not, write to the *
16  * Free Software Foundation, Inc., *
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18  ***************************************************************************/
19 #ifndef PROFILEENGINE_H
20 #define PROFILEENGINE_H
21 
22 #include <tqmap.h>
23 
24 #include <ktrader.h>
25 
26 #include "profile.h"
27 
33 class ProfileListing{
34 public:
35  void operator() (Profile *profile)
36  {
37  profiles[profile->name()] = profile;
38  }
39 
40  TQMap<TQString, Profile*> profiles;
41 };
42 
49 class ProfileListingEx {
50 public:
51  ProfileListingEx(const TQString &filter): m_filter(filter) {}
52  void operator() (Profile *profile)
53  {
54  resourceList += profile->resources(m_filter);
55  }
56 
57  KURL::List resourceList;
58  TQString m_filter;
59 };
60 
88 class ProfileEngine {
89 public:
90  ProfileEngine();
91  ~ProfileEngine();
92 
96  enum OfferType {
97  Global ,
98  Project ,
99  Core
100  };
101 
103  TDETrader::OfferList offers(const TQString &profileName, OfferType offerType);
105  TDETrader::OfferList allOffers(OfferType offerType);
106 
111  KURL::List resources(const TQString &profileName, const TQString &nameFilter);
112 
119  KURL::List resourcesRecursive(const TQString &profileName, const TQString &nameFilter);
120 
125  void addResource(const TQString &profileName, const KURL &url);
126 
137  void diffProfiles(OfferType offerType, const TQString &profile1, const TQString &profile2,
138  TQStringList &unload, TDETrader::OfferList &load);
139 
143  Profile *rootProfile() const { return m_rootProfile; }
146  Profile *findProfile(const TQString &profileName);
147 
177  template<class Operation>
178  void walkProfiles(Operation &op, Profile *root)
179  {
180  TQValueList<Profile*> children = root->children();
181  for (TQValueList<Profile*>::iterator it = children.begin(); it != children.end(); ++it)
182  {
183  op(*it);
184  walkProfiles<Operation>(op, *it);
185  }
186  }
244  template<class Operation, class Result>
245  void walkProfiles(Operation &op, Result *result, Profile *root)
246  {
247  TQValueList<Profile*> children = root->children();
248  for (TQValueList<Profile*>::iterator it = children.begin(); it != children.end(); ++it)
249  {
250  Result *newResult = op(result, *it);
251  walkProfiles<Operation>(op, newResult, *it);
252  }
253  }
254 
255 protected:
256  void processDir(const TQString &dir, const TQString &currPath, TQMap<TQString, Profile*> &passedPaths, Profile *root);
257 
258  KURL::List resources(Profile *profile, const TQString &nameFilter);
259 
265  void getProfileWithListing(ProfileListing &listing, Profile **profile,
266  const TQString &profileName);
267 
268 private:
269  Profile *m_rootProfile;
270 };
271 
272 #endif
ProfileListingEx
Profile resource listing operation.
Definition: profileengine.h:49
ProfileEngine::rootProfile
Profile * rootProfile() const
Definition: profileengine.h:143
ProfileEngine::walkProfiles
void walkProfiles(Operation &op, Result *result, Profile *root)
Walks profiles tree and applies operation op to each profile found in the tree below root (root profi...
Definition: profileengine.h:245
ProfileEngine::walkProfiles
void walkProfiles(Operation &op, Profile *root)
Walks profiles tree and applies operation op to each profile found in the tree below root (root profi...
Definition: profileengine.h:178
ProfileListing
Profile listing operation.
Definition: profileengine.h:33
ProfileEngine::OfferType
OfferType
Type of the plugin offer.
Definition: profileengine.h:96
ProfileEngine
Profile engine.
Definition: profileengine.h:88
Profile
KDevelop profile.
Definition: profile.h:30

KDevelop Shell Profiles Library

Skip menu "KDevelop Shell Profiles Library"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members

KDevelop Shell Profiles Library

Skip menu "KDevelop Shell Profiles Library"
  • buildtools
  •   lib
  •     base
  •     parsers
  •       autotools
  •       qmake
  •     widgets
  •   api
  • languages
  •   lib
  •     debugger
  •     designer_integration
  •     interfaces
  • lib
  •   catalog
  •   interfaces
  •     extensions
  •     external
  •     extras
  •   util
  •   widgets
  •     propeditor
  • parts
  •   documentation
  •     interfaces
  • src
  •   profileengine
  •     lib
Generated for KDevelop Shell Profiles Library by doxygen 1.8.13
This website is maintained by Timothy Pearson.