Files
Upsilon/apps/shared/labeled_curve_view.h
Romain Goyet 2bf83c43a8 [apps/shared] Factorize CurveView::label
There was a lot of code duplication.
I removed the initialization of xLabel{} and yLabels{} because those are
scratch buffers that shouldn't be accessed before being written to
anyway.
2020-03-11 09:51:33 +01:00

38 lines
949 B
C++

#ifndef SHARED_LABELED_CURVE_VIEW_H
#define SHARED_LABELED_CURVE_VIEW_H
#include "curve_view.h"
/* This CurveView subclass provides label storage for common use cases */
namespace Shared {
class HorizontallyLabeledCurveView : public CurveView {
public:
using CurveView::CurveView;
private:
char * label(Axis axis, int index) const override;
mutable char m_xLabels[k_maxNumberOfXLabels][k_labelBufferMaxSize];
};
class VerticallyLabeledCurveView : public CurveView {
public:
using CurveView::CurveView;
private:
char * label(Axis axis, int index) const override;
mutable char m_yLabels[k_maxNumberOfYLabels][k_labelBufferMaxSize];
};
class LabeledCurveView : public CurveView {
public:
using CurveView::CurveView;
private:
char * label(Axis axis, int index) const override;
mutable char m_xLabels[k_maxNumberOfXLabels][k_labelBufferMaxSize];
mutable char m_yLabels[k_maxNumberOfYLabels][k_labelBufferMaxSize];
};
}
#endif