forked from ArduPilot/ArduRemoteID
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathromfs.h
More file actions
48 lines (38 loc) · 1.1 KB
/
Copy pathromfs.h
File metadata and controls
48 lines (38 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#include <stdint.h>
class ROMFS_Stream;
class ROMFS {
public:
static bool exists(const char *fname);
static ROMFS_Stream *find_stream(const char *fname);
static const char *find_string(const char *name);
struct embedded_file {
const char *filename;
uint32_t size;
const uint8_t *contents;
};
private:
static const struct embedded_file *find(const char *fname);
static const struct embedded_file files[];
};
class ROMFS_Stream : public Stream
{
public:
ROMFS_Stream(const ROMFS::embedded_file &_f) :
f(_f) {}
size_t write(const uint8_t *buffer, size_t size) override { return 0; }
size_t write(uint8_t data) override { return 0; }
size_t size(void) const;
const char *name(void) const;
int available() override;
int read() override;
int peek() override;
void flush() override {}
size_t readBytes(char *buffer, size_t length) override {
return read((uint8_t*)buffer, length);
}
private:
size_t read(uint8_t* buf, size_t size);
const ROMFS::embedded_file &f;
uint32_t offset = 0;
};