Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1494785
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: project_path.hpp
*
* Contents: Facility for compile-time manipulation of paths.
*
* Copyright 2017
*
* Author: David Juhasz (david.juhasz@tuwien.ac.at)
*
******************************************************************************/
#ifndef ROSA_CONFIG_PROJECT_PATH_HPP
#define ROSA_CONFIG_PROJECT_PATH_HPP
#include
"rosa/config/rosa_config.h"
namespace
rosa
{
// Nested namespace containing the implementation of the provided features,
// not supposed to be used directly.
namespace
impl
{
// Implementation of the static search for the project-relative part of an
// absolute path.
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 impl
// Staticaly finds the index of the project-relative part of a absolute path.
// Returns 0 if the absolute path is not located under the project directory.
constexpr
size_t
project_relative_path_index
(
const
char
*
const
path
)
{
return
impl
::
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, Mar 1, 6:56 PM (8 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
287537
Default Alt Text
project_path.hpp (1 KB)
Attached To
Mode
R20 SoC_Rosa_repo
Attached
Detach File
Event Timeline
Log In to Comment