clang  16.0.0git
SerializerBase.h
Go to the documentation of this file.
1 //===- ExtractAPI/Serialization/SerializerBase.h ----------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// This file defines the ExtractAPI APISerializer interface.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_EXTRACTAPI_SERIALIZATION_SERIALIZERBASE_H
15 #define LLVM_CLANG_EXTRACTAPI_SERIALIZATION_SERIALIZERBASE_H
16 
17 #include "clang/ExtractAPI/API.h"
18 #include "llvm/Support/raw_ostream.h"
19 
20 namespace clang {
21 namespace extractapi {
22 
23 /// Common options to customize the serializer output.
25  /// Do not include unnecessary whitespaces to save space.
26  bool Compact;
27 };
28 
29 /// The base interface of serializers for API information.
31 public:
32  /// Serialize the API information to \p os.
33  virtual void serialize(raw_ostream &os) = 0;
34 
35 protected:
36  const APISet &API;
37 
38  /// The product name of API.
39  ///
40  /// Note: This should be used for populating metadata about the API.
41  StringRef ProductName;
42 
44 
45 public:
46  APISerializer() = delete;
47  APISerializer(const APISerializer &) = delete;
48  APISerializer(APISerializer &&) = delete;
49  APISerializer &operator=(const APISerializer &) = delete;
51 
52 protected:
53  APISerializer(const APISet &API, StringRef ProductName,
56 
57  virtual ~APISerializer() = default;
58 };
59 
60 } // namespace extractapi
61 } // namespace clang
62 
63 #endif // LLVM_CLANG_EXTRACTAPI_SERIALIZATION_SERIALIZERBASE_H
clang::extractapi::APISerializer::Options
APISerializerOption Options
Definition: SerializerBase.h:43
clang::extractapi::APISerializer::~APISerializer
virtual ~APISerializer()=default
clang::extractapi::APISerializerOption
Common options to customize the serializer output.
Definition: SerializerBase.h:24
clang::extractapi::APISerializerOption::Compact
bool Compact
Do not include unnecessary whitespaces to save space.
Definition: SerializerBase.h:26
clang::extractapi::APISerializer::operator=
APISerializer & operator=(const APISerializer &)=delete
clang::extractapi::APISerializer
The base interface of serializers for API information.
Definition: SerializerBase.h:30
clang::extractapi::APISerializer::API
const APISet & API
Definition: SerializerBase.h:36
clang::extractapi::APISerializer::serialize
virtual void serialize(raw_ostream &os)=0
Serialize the API information to os.
Definition: SerializerBase.cpp:19
clang::extractapi::APISerializer::ProductName
StringRef ProductName
The product name of API.
Definition: SerializerBase.h:41
clang::extractapi::APISerializer::APISerializer
APISerializer(const APISet &API, StringRef ProductName, APISerializerOption Options={})
Definition: SerializerBase.h:53
API.h
clang
Definition: CalledOnceCheck.h:17
clang::extractapi::APISet
APISet holds the set of API records collected from given inputs.
Definition: API.h:469
clang::extractapi::APISerializer::APISerializer
APISerializer()=delete