Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14 | pmbaty | 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 "clang/ExtractAPI/APIIgnoresList.h" |
||
19 | #include "llvm/Support/raw_ostream.h" |
||
20 | |||
21 | namespace clang { |
||
22 | namespace extractapi { |
||
23 | |||
24 | /// Common options to customize the serializer output. |
||
25 | struct APISerializerOption { |
||
26 | /// Do not include unnecessary whitespaces to save space. |
||
27 | bool Compact; |
||
28 | }; |
||
29 | |||
30 | /// The base interface of serializers for API information. |
||
31 | class APISerializer { |
||
32 | public: |
||
33 | /// Serialize the API information to \p os. |
||
34 | virtual void serialize(raw_ostream &os) = 0; |
||
35 | |||
36 | protected: |
||
37 | const APISet &API; |
||
38 | |||
39 | /// The list of symbols to ignore. |
||
40 | /// |
||
41 | /// Note: This should be consulted before emitting a symbol. |
||
42 | const APIIgnoresList &IgnoresList; |
||
43 | |||
44 | APISerializerOption Options; |
||
45 | |||
46 | public: |
||
47 | APISerializer() = delete; |
||
48 | APISerializer(const APISerializer &) = delete; |
||
49 | APISerializer(APISerializer &&) = delete; |
||
50 | APISerializer &operator=(const APISerializer &) = delete; |
||
51 | APISerializer &operator=(APISerializer &&) = delete; |
||
52 | |||
53 | protected: |
||
54 | APISerializer(const APISet &API, const APIIgnoresList &IgnoresList, |
||
55 | APISerializerOption Options = {}) |
||
56 | : API(API), IgnoresList(IgnoresList), Options(Options) {} |
||
57 | |||
58 | virtual ~APISerializer() = default; |
||
59 | }; |
||
60 | |||
61 | } // namespace extractapi |
||
62 | } // namespace clang |
||
63 | |||
64 | #endif // LLVM_CLANG_EXTRACTAPI_SERIALIZATION_SERIALIZERBASE_H |