yast2-core
pathsearch.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | |
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
8 | |
9 | core system |
10 | (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12 
13  File: pathsearch.h
14 
15  Authors: Mathias Kettner <kettner@suse.de>
16  Arvin Schnell <arvin@suse.de>
17  Martin Vidner <mvidner@suse.cz>
18  Maintainer: Arvin Schnell <arvin@suse.de>
19 
20 /-*/
21 // -*- c++ -*-
22 
23 /*
24  * Search for YaST2 files at different paths.
25  */
26 
27 #include <stdio.h>
28 #include <fcntl.h>
29 
30 #include <string>
31 #include <list>
32 #include <vector>
33 
34 using std::string;
35 using std::vector;
36 
37 
39 {
40 
41 public:
42 
46  static int numberOfComponentLevels ();
47 
54 
59  static string searchPath (WHAT what, int level);
60 
65  static int currentComponentLevel ();
66 
72  static string findy2 (string filename, int mode = R_OK, int level = -1);
73 
84  static string findy2exe (string root, string compname, bool server,
85  bool non_y2, int level);
86 
91  static string findy2plugin (string name, int level);
92 
94  static string globsubst (const string& where,
95  const string& oldstr, const string& newstr);
100  static string completeFilename (const string& fname);
101 
102 protected:
103  static bool searchPrefixWarn;
104 
105  static vector<string> getPaths();
106 
107 private:
108  static int defaultComponentLevel ();
109 
110  static vector<string> paths;
111  static void initializePaths();
112 };
113 
120 {
121 public:
122  enum Kind
123  {
124  // would like to use all uppercase,
125  // but the parser tokens are the allmighty #defines...
129  // all others: scrconf, menuentry, plugin, agent... ?
130  num_Kind // last
131  };
132 
136  static string find (Kind kind, const string& name);
140  static string findInclude (const string& name);
141 
148  static string findModule (string name, bool the_source = false);
149 
155  static void addPath (Kind kind, const string& path);
156 
162  static void clearPaths (Kind kind);
163 
168  static void initialize ();
169 
171  static std::list<string>::const_iterator searchListBegin (Kind kind);
173  static std::list<string>::const_iterator searchListEnd (Kind kind);
174 
182  static string bytecodeForFile (string file);
183 
184 private:
185  static bool initialized;
186  static std::list<string> searchList[num_Kind];
187  static void initialize (Kind kind, const char *suffix);
188 };

Generated on a sunny day for yast2-core by doxygen 1.8.2