/*
    SPDX-FileCopyrightText: 2026 Volodymyr Zolotopupov <zvova7890@gmail.com>

    SPDX-License-Identifier: GPL-2.0-or-later
*/

#ifndef KDEVPLATFORM_COMPILATIONDATABASEUTILS_H
#define KDEVPLATFORM_COMPILATIONDATABASEUTILS_H

#include "projectexport.h"

#include <QVector>
#include <QString>
#include <QStringList>

namespace KDevelop {

struct KDEVPLATFORMPROJECT_EXPORT CompilationDatabaseEntry
{
    QString filePath;
    QString directory;
    QStringList arguments;
    QString commandLine;
};

KDEVPLATFORMPROJECT_EXPORT QVector<CompilationDatabaseEntry>
readCompilationDatabase(const QString& commandsFilePath, QString* errorString = nullptr);

KDEVPLATFORMPROJECT_EXPORT QString normalizeCompilationDatabasePath(const QString& path,
                                                                   const QString& workingDirectory = {});

KDEVPLATFORMPROJECT_EXPORT QStringList normalizeParserArguments(const QStringList& arguments,
                                                               const QString& directory = {});

KDEVPLATFORMPROJECT_EXPORT QStringList parserArgumentsFromCompilationDatabase(const QStringList& arguments,
                                                                             const QString& directory,
                                                                             const QString& filePath);

}

#endif // KDEVPLATFORM_COMPILATIONDATABASEUTILS_H
