Prepare for the ability to access the model

Add an expression type for the access of the model variable from a repeater
This commit is contained in:
Olivier Goffart 2020-06-19 13:46:55 +02:00
parent 864e74601d
commit 6238d0d14f
8 changed files with 69 additions and 8 deletions

View file

@ -87,7 +87,7 @@ struct Model {
Model(const Model &) = delete;
Model &operator=(const Model &) = delete;
virtual int count() const = 0;
virtual void *get(int i) const = 0;
virtual const void *get(int i) const = 0;
};
template<int Count, typename ModelData>
@ -96,7 +96,7 @@ struct ArrayModel : Model {
int count() const override {
return Count;
}
void *get(int i) {
const void *get(int i) {
return &data[i];
}
};
@ -107,8 +107,8 @@ struct IntModel : Model {
int count() const override {
return data;
}
void * get(int) const override {
return nullptr;
const void *get(int) const override {
return &data;
}
};