-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] Add a rust type to c++ class wrapper
- Loading branch information
1 parent
ed0751a
commit 17cd116
Showing
5 changed files
with
210 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include "io.h" | ||
#include <libraw.h> | ||
|
||
class LibrawIO : public LibRaw_abstract_datastream { | ||
public: | ||
virtual ~LibrawIO() {} | ||
|
||
virtual int valid() { return lod_valid(inner); } | ||
virtual int read(void *ptr, size_t size, size_t nmemb) { | ||
return lod_read(inner, ptr, size, nmemb); | ||
} | ||
virtual int seek(INT64 o, int whence) { return lod_seek(inner, o, whence); } | ||
virtual INT64 tell() { return lod_tell(inner); } | ||
virtual INT64 size() { return lod_size(inner); } | ||
|
||
protected: | ||
LibrawOpaqueDatastream *inner; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include<stdint.h> | ||
|
||
#ifndef RUST_IO_H | ||
#define RUST_IO_H | ||
|
||
|
||
|
||
typedef struct LibrawOpaqueDatastream LibrawOpaqueDatastream; | ||
|
||
int32_t lod_valid(struct LibrawOpaqueDatastream *this_); | ||
|
||
int32_t lod_read(struct LibrawOpaqueDatastream *this_, | ||
const void *buffer, | ||
uintptr_t sz, | ||
uintptr_t nmemb); | ||
|
||
int32_t lod_seek(struct LibrawOpaqueDatastream *this_, int64_t offset, uint32_t whence); | ||
|
||
int64_t lod_tell(struct LibrawOpaqueDatastream *this_); | ||
|
||
int64_t lod_size(struct LibrawOpaqueDatastream *this_); | ||
|
||
int lod_get_char(struct LibrawOpaqueDatastream *this_); | ||
|
||
const char *lod_gets(struct LibrawOpaqueDatastream *this_, char *buffer, int size); | ||
|
||
#endif /* RUST_IO_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters