summaryrefslogtreecommitdiffstats
path: root/examples/charts/gallery/boxplotdatareader.h
blob: 253b05ee69822b355c00f55c203e9f8e9f9d82d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#ifndef BOXPLOTDATAREADER_H
#define BOXPLOTDATAREADER_H

#include <QList>
#include <QTextStream>

QT_FORWARD_DECLARE_CLASS(QBoxSet)

class BoxPlotDataReader
{
public:
    explicit BoxPlotDataReader(QIODevice *device);

    QBoxSet *readBox();
    void readFile(QIODevice *device);
    bool atEnd() const;

protected:
    qreal findMedian(int begin, int end);

private:
    QList<qreal> m_sortedList;
    QTextStream m_textStream;
};

#endif