mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-04 04:40:56 -06:00
`include-what-you-use` diagnostics, in practice, are specific to the environment's compiler and standard library. Update includes to satisfy IWYU for our CI job under Debian 13. Some patterns: * Types named in virtual `override` signatures no longer require includes since the overridden signature already names them. * A function argument's type needs to be included even if its constructor is called only by implicit conversion. For example, constructing a `std::function` from a lambda now requires `<functional>`. * Some prior mysterious `<type_traits>` inclusions are no longer required.
50 lines
1.2 KiB
C++
50 lines
1.2 KiB
C++
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
file LICENSE.rst or https://cmake.org/licensing for details. */
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
#include <ostream>
|
|
#include <string>
|
|
|
|
#include <cm3p/json/value.h>
|
|
#include <cm3p/json/writer.h>
|
|
|
|
#include "cmSbomSerializer.h"
|
|
|
|
struct cmSpdxSerializer final : cmSbomSerializer
|
|
{
|
|
cmSpdxSerializer();
|
|
|
|
~cmSpdxSerializer() override = default;
|
|
|
|
void BeginObject() override;
|
|
|
|
void BeginArray() override;
|
|
|
|
void EndObject() override;
|
|
|
|
void EndArray() override;
|
|
|
|
void AddReference(std::string const& id) override;
|
|
|
|
void AddString(std::string const& key, std::string const& value) override;
|
|
|
|
void AddVisitable(std::string const& key,
|
|
cmSbomObject const& visitable) override;
|
|
|
|
void AddVectorIfPresent(std::string const& key,
|
|
std::vector<cmSbomObject> const& vec) override;
|
|
|
|
void AddVectorIfPresent(std::string const& key,
|
|
std::vector<std::string> const& vec) override;
|
|
|
|
bool WriteSbom(std::ostream& os, cmSbomObject const& document) override;
|
|
|
|
Json::Value GetJson() { return CurrentValue; }
|
|
|
|
private:
|
|
Json::Value CurrentValue;
|
|
std::string CurrentKey;
|
|
std::unique_ptr<Json::StreamWriter> Writer;
|
|
};
|