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 };
static int defaultComponentLevel()
Definition: pathsearch.cc:227
Definition: pathsearch.h:127
Definition: pathsearch.h:130
Definition: pathsearch.h:38
Definition: pathsearch.h:126
static string bytecodeForFile(string file)
Definition: pathsearch.cc:371
static void addPath(Kind kind, const string &path)
Definition: pathsearch.cc:344
static string findModule(string name, bool the_source=false)
Definition: pathsearch.cc:332
static string find(Kind kind, const string &name)
Definition: pathsearch.cc:288
static vector< string > paths
Definition: pathsearch.h:110
static bool searchPrefixWarn
Definition: pathsearch.h:103
Definition: pathsearch.h:128
static void initialize()
Definition: pathsearch.cc:275
static string findy2exe(string root, string compname, bool server, bool non_y2, int level)
Definition: pathsearch.cc:174
static string findy2plugin(string name, int level)
Definition: pathsearch.cc:206
Kind
Definition: pathsearch.h:122
static string searchPath(WHAT what, int level)
Definition: pathsearch.cc:94
WHAT
Definition: pathsearch.h:53
static int numberOfComponentLevels()
Definition: pathsearch.cc:86
Definition: pathsearch.h:119
static vector< string > getPaths()
Definition: pathsearch.cc:42
static void initializePaths()
Definition: pathsearch.cc:78
static std::list< string >::const_iterator searchListBegin(Kind kind)
Perl needs to synchronize its search paths with ours (#39512)
Definition: pathsearch.cc:359
Definition: pathsearch.h:53
Definition: pathsearch.h:53
static string globsubst(const string &where, const string &oldstr, const string &newstr)
globsubst ("YaST::Foo::UI", "::", "/") == "YaST/Foo/UI"
static string findy2(string filename, int mode=R_OK, int level=-1)
Definition: pathsearch.cc:143
static int currentComponentLevel()
Definition: pathsearch.cc:245
Definition: pathsearch.h:53
static void clearPaths(Kind kind)
Definition: pathsearch.cc:353
static std::list< string > searchList[num_Kind]
Definition: pathsearch.h:186
static string findInclude(const string &name)
Definition: pathsearch.cc:325
static string completeFilename(const string &fname)
Definition: pathsearch.cc:132
static std::list< string >::const_iterator searchListEnd(Kind kind)
Perl needs to synchronize its search paths with ours (#39512)
Definition: pathsearch.cc:365
static bool initialized
Definition: pathsearch.h:185

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