blob: ccfbc42b35de3e24d6263dd551e08338a142cc83 [file] [log] [blame]
Andrei Onea370a0642019-03-01 17:48:27 +00001/*
2 * Copyright (C) 2018 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
17#ifndef ART_LIBARTBASE_BASE_HIDDENAPI_STUBS_H_
18#define ART_LIBARTBASE_BASE_HIDDENAPI_STUBS_H_
19
20#include <set>
21#include <string_view>
22
23namespace art {
24namespace hiddenapi {
25
26class ApiStubs {
27 public:
28 enum class Kind {
29 kPublicApi,
30 kSystemApi,
31 kTestApi,
32 kCorePlatformApi,
33 };
34
35 static const std::string_view ToString(Kind api) {
36 switch (api) {
37 case Kind::kPublicApi:
38 return kPublicApiStr;
39 case Kind::kSystemApi:
40 return kSystemApiStr;
41 case Kind::kTestApi:
42 return kTestApiStr;
43 case Kind::kCorePlatformApi:
44 return kCorePlatformApiStr;
45 }
46 }
47
48 static bool IsStubsFlag(const std::string_view& api_flag_name) {
49 return api_flag_name == kPublicApiStr || api_flag_name == kSystemApiStr ||
Mathew Inwood31376812020-10-21 11:23:29 +010050 api_flag_name == kTestApiStr || api_flag_name == kCorePlatformApiStr ||
51 api_flag_name == kRemovedApiStr;
Andrei Onea370a0642019-03-01 17:48:27 +000052 }
53
54 private:
55 static constexpr std::string_view kPublicApiStr{"public-api"};
56 static constexpr std::string_view kSystemApiStr{"system-api"};
57 static constexpr std::string_view kTestApiStr{"test-api"};
58 static constexpr std::string_view kCorePlatformApiStr{"core-platform-api"};
Mathew Inwood31376812020-10-21 11:23:29 +010059 static constexpr std::string_view kRemovedApiStr{"removed"};
Andrei Onea370a0642019-03-01 17:48:27 +000060};
61
62} // namespace hiddenapi
63} // namespace art
64
65
66#endif // ART_LIBARTBASE_BASE_HIDDENAPI_STUBS_H_