/*
    SPDX-FileCopyrightText: 2009, 2010 Alex Richardson <alex.richardson@gmx.de>

    SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/

#ifndef KASTEN_STRUCTUREDATAINFORMATION_HPP
#define KASTEN_STRUCTUREDATAINFORMATION_HPP

// lib
#include "datainformationwithchildren.hpp"

/** A class holding the data of a struct for Okteta*/
class StructureDataInformation : public DataInformationWithChildren
{
    DATAINFORMATION_CLONE(StructureDataInformation, DataInformationWithChildren) {}

public:
    explicit StructureDataInformation(const QString& name,
                                      std::vector<std::unique_ptr<DataInformation>>&& children = {},
                                      DataInformation* parent = nullptr);
    ~StructureDataInformation() override;

public: // DataInformation API
    [[nodiscard]]
    BitCount64 childPosition(const DataInformation* child, Okteta::Address start) const override;

    [[nodiscard]]
    qint64 readData(const Okteta::AbstractByteArrayModel* input, Okteta::Address address,
                    BitCount64 bitsRemaining, quint8* bitOffset) override;

public: // DataInformation API
    [[nodiscard]]
    bool isStruct() const override;

private: // DataInformation API
    [[nodiscard]]
    QString typeNameImpl() const override;
};

#endif /* KASTEN_STRUCTUREDATAINFORMATION_HPP */
