Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
FoundationUtils.hxx
Go to the documentation of this file.
1/// \file FoundationUtils.hxx
2///
3/// \brief The file contains utilities which are foundational and could be used
4/// across the core component of ROOT.
5///
6///
7/// \author Vassil Vassilev <vvasilev@cern.ch>
8///
9/// \date June, 2019
10///
11/*************************************************************************
12 * Copyright (C) 1995-2020, Rene Brun and Fons Rademakers. *
13 * All rights reserved. *
14 * *
15 * For the licensing terms see $ROOTSYS/LICENSE. *
16 * For the list of contributors see $ROOTSYS/README/CREDITS. *
17 *************************************************************************/
18
19#ifndef ROOT_CORE_FOUNDATION_FOUNDATIONUTILS_HXX
20#define ROOT_CORE_FOUNDATION_FOUNDATIONUTILS_HXX
21
22#include <string>
23
24namespace ROOT {
25namespace FoundationUtils {
26
27 ///\returns the $PWD.
28 std::string GetCurrentDir();
29
30 ///\returns the relative path of \c path with respect to \c base.
31 /// For instance, for path being "/a/b/c/d" and base "/a/b", returns "c/d".
32 ///
33 ///\param path - the input path
34 ///
35 ///\param base - the base path to be removed from \c path.
36 ///
37 ///\param isBuildingROOT - if true, it converts module directories such as
38 /// core/base/inc/ to include/
39 std::string MakePathRelative(const std::string &path, const std::string &base,
40 bool isBuildingROOT = false);
41
42 ///\returns the path separator slash or backslash depending on the platform.
43 inline const std::string& GetPathSeparator() {
44#ifdef WIN32
45 static const std::string gPathSeparator ("\\");
46#else
47 static const std::string gPathSeparator ("/");
48#endif
49 return gPathSeparator;
50 }
51
52 ///\returns the path separator for the PATH environment variable on the
53 /// platform.
54 inline const char& GetEnvPathSeparator() {
55#ifdef WIN32
56 static const char gEnvPathSeparator = ';';
57#else
58 static const char gEnvPathSeparator = ':';
59#endif
60 return gEnvPathSeparator;
61 }
62
63 ///\returns the fallback directory in the installation (eg. /usr/local/root/).
64 const std::string& GetFallbackRootSys();
65
66 ///\returns the rootsys directory in the installation.
67 ///
68 const std::string& GetRootSys();
69
70 ///\ returns the include directory in the installation.
71 ///
72 const std::string& GetIncludeDir();
73
74 ///\returns the sysconfig directory in the installation.
75 const std::string& GetEtcDir();
76
77 ///\returns true if lowercase \c value is 1, on, true, 0, off, false
78 bool CanConvertEnvValueToBool(const std::string& value);
79
80 ///\returns true if the lowercase string is 1, on, true; false if 0, off,
81 /// false
82 bool ConvertEnvValueToBool(const std::string& value);
83
84 } // namespace FoundationUtils
85} // namespace ROOT
86
87#endif // ROOT_CORE_FOUNDATION_FOUNDATIONUTILS_HXX
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
const std::string & GetPathSeparator()
const std::string & GetIncludeDir()
\ returns the include directory in the installation.
const char & GetEnvPathSeparator()
bool CanConvertEnvValueToBool(const std::string &value)
const std::string & GetRootSys()
std::string MakePathRelative(const std::string &path, const std::string &base, bool isBuildingROOT=false)
bool ConvertEnvValueToBool(const std::string &value)
const std::string & GetFallbackRootSys()
const std::string & GetEtcDir()
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
const std::string gPathSeparator(ROOT::TMetaUtils::GetPathSeparator())