blob: c46319abd74f5547cf367499347eb26cba7aaab7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
/**
* ExtensionPath.h
*
* Simply utility class that turns a pathname for an extension into a full
* pathname that also takes the global extension_dir setting into account.
*
* @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
* @copyright 2015 Copernica BV
*/
/**
* Set up namespace
*/
namespace Php {
/**
* Class definition
*/
class ExtensionPath
{
private:
/**
* The actual value
* @var std::string
*/
std::string _path;
public:
/**
* Constructor
* @param path
*/
ExtensionPath(const char *path TSRMLS_DC)
{
// was an absole path given?
if (path[0] && path[0] == '/')
{
// for absolute pathnames no extension_dir has to be checked
_path = path;
}
else
{
// start with the extension dir
_path = PG(extension_dir);
// append slash
if (_path[_path.size()-1] != '/') _path.push_back('/');
// and append path passed to the constructor
_path.append(path);
}
}
/**
* Destructor
*/
virtual ~ExtensionPath() {}
/**
* Cast to string
* @return std::string
*/
operator const std::string & () const
{
return _path;
}
};
/**
* End of nmaespace
*/
}
|