Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F10710154
project_path.hpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Size
1 KB
Referenced Files
None
Subscribers
None
project_path.hpp
View Options
/***************************************************************************//**
*
* \file rosa/config/project_path.hpp
*
* \author David Juhasz (david.juhasz@tuwien.ac.at)
*
* \date 2017
*
* \brief Facility for compile-time manipulation of paths.
*
******************************************************************************/
#ifndef ROSA_CONFIG_PROJECT_PATH_HPP
#define ROSA_CONFIG_PROJECT_PATH_HPP
#include
"rosa/config/rosa_config.h"
#include
<cstdlib>
namespace
rosa
{
/// Nested namespace with implementation of the provided features,
/// consider it private.
namespace
{
/// Tells the index of the project-relative part of an absolute path.
///
/// \param path absolute path to check
/// \param project the absolute path of the project
/// \param index number of leading characters already checked and found
/// matching
///
/// \return index of the `project`-relative part of `path`; `0` if `path` is not
/// under `project`
constexpr
size_t
project_relative_path_index_impl
(
const
char
*
const
path
,
const
char
*
const
project
=
ROSA_SRC_DIR
,
const
size_t
index
=
0
)
{
return
project
[
index
]
==
'\0'
?
index
// Found it.
:
(
path
[
index
]
==
'\0'
||
project
[
index
]
!=
path
[
index
])
?
0
// Path is not under project.
:
project_relative_path_index_impl
(
path
,
project
,
index
+
1
);
// Continue searching...
}
}
// End namespace
/// Tells the index of the project-relative part of an absolute path.
///
/// \param path absolute path to check
///
/// \return index of the project-relative part of `path`; `0` if `path` is not
/// under the RoSA siource directory.
constexpr
size_t
project_relative_path_index
(
const
char
*
const
path
)
{
return
project_relative_path_index_impl
(
path
);
}
}
// End namespace rosa
#endif
// ROSA_CONFIG_PROJECT_PATH_HPP
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Sun, May 31, 5:11 PM (1 d, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
328235
Default Alt Text
project_path.hpp (1 KB)
Attached To
Mode
R20 SoC_Rosa_repo
Attached
Detach File
Event Timeline
Log In to Comment