PathFinder.h revision e661df29
1/*
2 * Copyright 2013-2015, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _PATH_FINDER_H
6#define _PATH_FINDER_H
7
8
9#include <FindDirectory.h>
10#include <StringList.h>
11
12
13class BPath;
14struct entry_ref;
15
16
17namespace BPackageKit {
18	class BPackageResolvableExpression;
19}
20
21
22class BPathFinder {
23public:
24			typedef BPackageKit::BPackageResolvableExpression
25				BResolvableExpression;
26
27public:
28								BPathFinder(const void* codePointer = NULL,
29									const char* dependency = NULL);
30								BPathFinder(const char* path,
31									const char* dependency = NULL);
32								BPathFinder(const entry_ref& ref,
33									const char* dependency = NULL);
34								BPathFinder(
35									const BResolvableExpression& expression,
36									const char* dependency = NULL);
37									// requires libpackage
38
39			status_t			SetTo(const void* codePointer = NULL,
40									const char* dependency = NULL);
41			status_t			SetTo(const char* path,
42									const char* dependency = NULL);
43			status_t			SetTo(const entry_ref& ref,
44									const char* dependency = NULL);
45			status_t			SetTo(const BResolvableExpression& expression,
46									const char* dependency = NULL);
47									// requires libpackage
48
49			status_t			FindPath(const char* architecture,
50									path_base_directory baseDirectory,
51									const char* subPath, uint32 flags,
52									BPath& _path);
53			status_t			FindPath(path_base_directory baseDirectory,
54									const char* subPath, uint32 flags,
55									BPath& _path);
56			status_t			FindPath(path_base_directory baseDirectory,
57									const char* subPath, BPath& _path);
58			status_t			FindPath(path_base_directory baseDirectory,
59									BPath& _path);
60
61	static	status_t			FindPaths(const char* architecture,
62									path_base_directory baseDirectory,
63									const char* subPath, uint32 flags,
64							 		BStringList& _paths);
65	static	status_t			FindPaths(path_base_directory baseDirectory,
66									const char* subPath, uint32 flags,
67							 		BStringList& _paths);
68	static	status_t			FindPaths(path_base_directory baseDirectory,
69									const char* subPath, BStringList& _paths);
70	static	status_t			FindPaths(path_base_directory baseDirectory,
71									BStringList& _paths);
72
73private:
74			status_t			_SetTo(const void* codePointer,
75									const char* path, const char* dependency);
76
77private:
78			const void*			fCodePointer;
79			BString				fPath;
80			BString				fDependency;
81			status_t			fInitStatus;
82			addr_t				fReserved[4];
83};
84
85
86#endif	// _PATH_FINDER_H
87