xref: /aosp_15_r20/art/libartbase/base/hiddenapi_stubs.h (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1*795d594fSAndroid Build Coastguard Worker /*
2*795d594fSAndroid Build Coastguard Worker  * Copyright (C) 2018 The Android Open Source Project
3*795d594fSAndroid Build Coastguard Worker  *
4*795d594fSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*795d594fSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*795d594fSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*795d594fSAndroid Build Coastguard Worker  *
8*795d594fSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*795d594fSAndroid Build Coastguard Worker  *
10*795d594fSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*795d594fSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*795d594fSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*795d594fSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*795d594fSAndroid Build Coastguard Worker  * limitations under the License.
15*795d594fSAndroid Build Coastguard Worker  */
16*795d594fSAndroid Build Coastguard Worker 
17*795d594fSAndroid Build Coastguard Worker #ifndef ART_LIBARTBASE_BASE_HIDDENAPI_STUBS_H_
18*795d594fSAndroid Build Coastguard Worker #define ART_LIBARTBASE_BASE_HIDDENAPI_STUBS_H_
19*795d594fSAndroid Build Coastguard Worker 
20*795d594fSAndroid Build Coastguard Worker #include <set>
21*795d594fSAndroid Build Coastguard Worker #include <string_view>
22*795d594fSAndroid Build Coastguard Worker 
23*795d594fSAndroid Build Coastguard Worker namespace art {
24*795d594fSAndroid Build Coastguard Worker namespace hiddenapi {
25*795d594fSAndroid Build Coastguard Worker 
26*795d594fSAndroid Build Coastguard Worker class ApiStubs {
27*795d594fSAndroid Build Coastguard Worker  public:
28*795d594fSAndroid Build Coastguard Worker   enum class Kind {
29*795d594fSAndroid Build Coastguard Worker     kPublicApi,
30*795d594fSAndroid Build Coastguard Worker     kSystemApi,
31*795d594fSAndroid Build Coastguard Worker     kTestApi,
32*795d594fSAndroid Build Coastguard Worker     kCorePlatformApi,
33*795d594fSAndroid Build Coastguard Worker   };
34*795d594fSAndroid Build Coastguard Worker 
ToString(Kind api)35*795d594fSAndroid Build Coastguard Worker   static const std::string_view ToString(Kind api) {
36*795d594fSAndroid Build Coastguard Worker     switch (api) {
37*795d594fSAndroid Build Coastguard Worker       case Kind::kPublicApi:
38*795d594fSAndroid Build Coastguard Worker         return kPublicApiStr;
39*795d594fSAndroid Build Coastguard Worker       case Kind::kSystemApi:
40*795d594fSAndroid Build Coastguard Worker         return kSystemApiStr;
41*795d594fSAndroid Build Coastguard Worker       case Kind::kTestApi:
42*795d594fSAndroid Build Coastguard Worker         return kTestApiStr;
43*795d594fSAndroid Build Coastguard Worker       case Kind::kCorePlatformApi:
44*795d594fSAndroid Build Coastguard Worker         return kCorePlatformApiStr;
45*795d594fSAndroid Build Coastguard Worker     }
46*795d594fSAndroid Build Coastguard Worker   }
47*795d594fSAndroid Build Coastguard Worker 
IsStubsFlag(const std::string_view & api_flag_name)48*795d594fSAndroid Build Coastguard Worker   static bool IsStubsFlag(const std::string_view& api_flag_name) {
49*795d594fSAndroid Build Coastguard Worker     return api_flag_name == kPublicApiStr || api_flag_name == kSystemApiStr ||
50*795d594fSAndroid Build Coastguard Worker         api_flag_name == kTestApiStr || api_flag_name == kCorePlatformApiStr ||
51*795d594fSAndroid Build Coastguard Worker         api_flag_name == kRemovedApiStr || api_flag_name == kLowPriorityApiStr;
52*795d594fSAndroid Build Coastguard Worker   }
53*795d594fSAndroid Build Coastguard Worker 
54*795d594fSAndroid Build Coastguard Worker  private:
55*795d594fSAndroid Build Coastguard Worker   static constexpr std::string_view kPublicApiStr{"public-api"};
56*795d594fSAndroid Build Coastguard Worker   static constexpr std::string_view kSystemApiStr{"system-api"};
57*795d594fSAndroid Build Coastguard Worker   static constexpr std::string_view kTestApiStr{"test-api"};
58*795d594fSAndroid Build Coastguard Worker   static constexpr std::string_view kCorePlatformApiStr{"core-platform-api"};
59*795d594fSAndroid Build Coastguard Worker   static constexpr std::string_view kRemovedApiStr{"removed"};
60*795d594fSAndroid Build Coastguard Worker   static constexpr std::string_view kLowPriorityApiStr{"lo-prio"};
61*795d594fSAndroid Build Coastguard Worker };
62*795d594fSAndroid Build Coastguard Worker 
63*795d594fSAndroid Build Coastguard Worker }  // namespace hiddenapi
64*795d594fSAndroid Build Coastguard Worker }  // namespace art
65*795d594fSAndroid Build Coastguard Worker 
66*795d594fSAndroid Build Coastguard Worker 
67*795d594fSAndroid Build Coastguard Worker #endif  // ART_LIBARTBASE_BASE_HIDDENAPI_STUBS_H_
68