pnoltes commented on code in PR #476:
URL: https://github.com/apache/celix/pull/476#discussion_r1114753739
##########
libs/framework/include/celix/Bundle.h:
##########
@@ -74,6 +80,43 @@ namespace celix {
}
#endif
+ /**
+ * @brief Return a use-able entry path for the provided relative path
to a bundle persistent storage.
+ *
+ * For example if there is a resource entry in the bundle persistent
storage at path 'resources/counters.txt` this call
+ * will return a relative path to entry in the bundle persistent
storage.
+ * .cache/bundle5/storage/resources/counters.txt
+ *
+ * A provided path is always relative to the bundle persistent storage
root and can start with a "/".
+ * A provided path NULL, "", "." or "/" indicates the root of this
bundle cache store.
+ *
+ * The returned entry path should can be treated as read-write.
+ *
+ * @param path The relative path to a bundle persistent storage entry.
+ * @return The use-able entry path or an empty string if the entry is
not found.
+ */
+#if __cplusplus >= 201703L //C++17 or higher
+ [[nodiscard]] std::string getDataFile(std::string_view path) const {
+ std::string result{};
+ char* entry = celix_bundle_getDataFile(cBnd.get(), path.data());
Review Comment:
Correct std::string_view is not quarantined to be null terminated and also a
std::string_view will not be accepted as `const std::string&` argument.
So for Celix `std::string_view` is handled like a `const char*` -> so
assuming a null terminated string.
The main reasons is that with std::string_view you can create constexpr
members, e.g:
```cpp
class FooService {
public:
static constexpr NAME = "FooService";
void foo() = 0;
}
```
But to be honest, I am not sure anymore if this is worth the many ifdefs to
check if C++17 or C++14 is used.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]