blob: 8bf7b30f8584d088be95091f50aa7551c92e9e74 [file] [log] [blame]
Jooyung Hand4fe00e2021-01-11 16:21:53 +09001/*
2 * Copyright (C) 2021, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#pragma once
17
Jooyung Han8451a202021-01-16 03:07:06 +090018#include <iostream>
Jooyung Hand4fe00e2021-01-11 16:21:53 +090019#include <optional>
20#include <string>
Jooyung Han8451a202021-01-16 03:07:06 +090021#include <vector>
Jooyung Hand4fe00e2021-01-11 16:21:53 +090022
23namespace android {
24namespace aidl {
25
Jooyung Han8451a202021-01-16 03:07:06 +090026// Represents a single comment
27struct Comment {
28 enum class Type { LINE, BLOCK };
29 Type type;
30 std::string body;
31
Jooyung Han161bb0f2021-01-21 12:30:16 +090032 Comment(const std::string& body);
33
Jooyung Han8451a202021-01-16 03:07:06 +090034 // for GTest assertions
35 friend inline bool operator==(const Comment& lhs, const Comment& rhs) {
36 return lhs.body == rhs.body;
37 }
38 friend std::ostream& operator<<(std::ostream& out, const Comment& c) { return out << c.body; }
39};
40
41using Comments = std::vector<Comment>;
42
43bool HasHideInComments(const Comments& comments);
Jooyung Han24effbf2021-01-16 10:24:03 +090044
Jooyung Hand4fe00e2021-01-11 16:21:53 +090045struct Deprecated {
46 std::string note; // can be empty("")
47};
48
Jooyung Han8451a202021-01-16 03:07:06 +090049std::optional<Deprecated> FindDeprecated(const Comments& comments);
Jooyung Hand4fe00e2021-01-11 16:21:53 +090050
Jooyung Hanb7a60ec2021-01-21 13:47:59 +090051std::string FormatCommentsForJava(const Comments& comments);
52
Jooyung Hand4fe00e2021-01-11 16:21:53 +090053} // namespace aidl
54} // namespace android