Files
Upsilon/apps/shared/labeled_curve_view.cpp
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

32 lines
712 B
C++

#include "labeled_curve_view.h"
namespace Shared {
char * HorizontallyLabeledCurveView::label(Axis axis, int index) const {
if (axis == Axis::Horizontal) {
assert(index < k_maxNumberOfXLabels);
return m_xLabels[index];
}
return nullptr;
}
char * VerticallyLabeledCurveView::label(Axis axis, int index) const {
if (axis == Axis::Vertical) {
assert(index < k_maxNumberOfYLabels);
return m_yLabels[index];
}
return nullptr;
}
char * LabeledCurveView::label(Axis axis, int index) const {
if (axis == Axis::Horizontal) {
assert(index < k_maxNumberOfXLabels);
return m_xLabels[index];
} else {
assert(index < k_maxNumberOfYLabels);
return m_yLabels[index];
}
}
}