42 return s[n] ==
'\0' ? n :
clen(s, n + 1);
52 return (i == 0 || p[i - 1] ==
'/' || p[i - 1] ==
'\\')
53 && p[i] ==
'.' && p[i + 1] ==
'.'
54 && (p[i + 2] ==
'\0' || p[i + 2] ==
'/' || p[i + 2] ==
'\\');
137#define FL_ASSET(LITERAL_PATH) \
138 ([]() -> ::fl::asset_ref { \
140 !::fl::asset_detail::path_has_parent_segment(LITERAL_PATH), \
141 "fl::asset path must not contain '..' segments"); \
142 return ::fl::asset_ref( \
143 (LITERAL_PATH), ::fl::asset_detail::clen(LITERAL_PATH)); \
asset_ref & operator=(const asset_ref &) FL_NOEXCEPT=default
fl::string_view path() const FL_NOEXCEPT
The relative asset path as a string view (e.g. "data/track.mp3").
constexpr asset_ref() FL_NOEXCEPT
Default-constructed handle refers to no asset.
asset_ref(const asset_ref &) FL_NOEXCEPT=default
Copy/move: trivial — pointer + length.
constexpr asset_ref(const char *path, fl::size length) FL_NOEXCEPT
Construct from a pointer to a null-terminated string with known length.
constexpr const char * c_str() const FL_NOEXCEPT
Pointer accessor — useful for JSON serialization.
constexpr fl::size size() const FL_NOEXCEPT
Opaque handle to a sketch-local asset.
fl::UISlider length("Length", 1.0f, 0.0f, 1.0f, 0.01f)
constexpr bool path_has_parent_segment_at(const char *p, fl::size i) FL_NOEXCEPT
Recursive constexpr walk looking for any ".." segment.
constexpr bool is_parent_at(const char *p, fl::size i) FL_NOEXCEPT
Compile-time check: does position i in p start a ".." segment?
constexpr fl::size clen(const char *s, fl::size n=0) FL_NOEXCEPT
Compile-time length of a null-terminated C string.
constexpr bool path_has_parent_segment(const char *p) FL_NOEXCEPT
Compile-time check: returns true if the string contains a ".." segment.
fl::url resolve_asset(const asset_ref &a) FL_NOEXCEPT
Resolve an asset handle to a URL (or local file path) at runtime.
constexpr asset_ref asset(const char *path) FL_NOEXCEPT
Construct an asset handle from a relative sketch path at runtime.
void register_asset(fl::string_view path, const fl::url &u) FL_NOEXCEPT
Public helper: plug an asset mapping at runtime.
Base definition for an LED controller.
Portable compile-time assertion wrapper.
Lightweight URL parser for embedded environments.