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