New with C++ but been coding a lot of ObjC back in the day. So i thought i was smart trying to solve a cross reference issue with the old delegate pattern used widely in ObjC but only managed to move the issue it to another file .
Im trying to reach the invoker of the file by passing it as a reference, conforming to a "interface".
#pragma once
#include <libUI.h>
#include <Arduino.h>
class PeripheralDelegate {
public:
virtual void pushViewController(PeripheralViewController* vc) = 0;
virtual void popLastViewController() = 0;
};
class PeripheralViewController: public ViewController {
private:
PeripheralDelegate* mDelegate;
public:
PeripheralViewController(): ViewController(), mDelegate() {}
PeripheralViewController(String id, Rect frame, PeripheralDelegate* delegate): ViewController(id, frame), mDelegate(delegate) {}
virtual ~PeripheralViewController() {}
virtual void encoderValueChanged(int newVal, int oldVal) = 0;
virtual void encoderSwitchPressed() = 0;
virtual void backButtonPressed() = 0;
virtual void firstButtonPressed() = 0;
virtual void secondButtonPressed() = 0;
};
Also, all kind of feedback on the code is much appriciated!