Time for action – initializing the native store
We need to create and initialize all the structures we will use for the next section of the chapter:
- Create the
jni/Store.h
file, which defines store data structures:- The
StoreType
enumeration will reflect the corresponding Java enumeration. Leave it empty for now. - The
StoreValue
union will contain any of the possible store values. Leave it empty for now too. - The
StoreEntry
structure contains one piece of data in the store. It is composed of a key (a raw C string made fromchar*
), a type (StoreType
), and a value (StoreValue
).Note
Note that we will see how to set up and use C++ STL strings in Chapter 9, Porting Existing Libraries to Android.
Store
is the main structure that defines a fixed size array of entries and a length (that is, the number of allocated entries):#ifndef _STORE_H_ #define _STORE_H_ #include <cstdint> #define STORE_MAX_CAPACITY 16 typedef enum { } StoreType; typedef union { } StoreValue; typedef struct { char...
- The