mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
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.
32 lines
712 B
C++
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];
|
|
}
|
|
}
|
|
|
|
}
|