FastLED 3.10.6
Loading...
Searching...
No Matches

◆ load()

Fled fl::Fled::load ( FileSystem & fs,
const char * path )
static

Definition at line 31 of file fled.cpp.hpp.

31 {
32 fl::ifstream in = fs.openRead(path);
33 if (!in.is_open()) {
34 return Fled();
35 }
36 const fl::size total = in.size();
37 fl::vector<fl::u8> buf;
38 buf.resize(total);
39 if (total > 0) {
40 const fl::size got = in.read(buf.data(), total);
41 if (got != total) {
42 return Fled();
43 }
44 }
45 return Fled::loadFromVector(fl::move(buf));
46}
Fled() FL_NO_EXCEPT
Definition fled.cpp.hpp:72
static Fled loadFromVector(fl::vector< fl::u8 > &&bytes) FL_NO_EXCEPT
Definition fled.cpp.hpp:59
fl::size_t size() const
Definition fstream.h:146
ifstream & read(char *buffer, fl::size_t count)
bool is_open() const
Definition fstream.h:111
void resize(fl::size n) FL_NO_EXCEPT
Definition vector.h:593
T * data() FL_NO_EXCEPT
Definition vector.h:619
constexpr remove_reference< T >::type && move(T &&t) FL_NO_EXCEPT
Definition move.h:28

References Fled(), fl::vector< T >::data(), fl::FL_NO_EXCEPT, fl::ifstream::is_open(), loadFromVector(), fl::move(), fl::ifstream::read(), fl::vector< T >::resize(), and fl::ifstream::size().

Referenced by fl::FileSystem::loadFled().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: