• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
23 namespace art {
24 namespace hiddenapi {
25 
26 class ApiStubs {
27  public:
28   enum class Kind {
29     kPublicApi,
30     kSystemApi,
31     kTestApi,
32     kCorePlatformApi,
33   };
34 
ToString(Kind api)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 
IsStubsFlag(const std::string_view & api_flag_name)48   static bool IsStubsFlag(const std::string_view& api_flag_name) {
49     return api_flag_name == kPublicApiStr || api_flag_name == kSystemApiStr ||
50         api_flag_name == kTestApiStr || api_flag_name == kCorePlatformApiStr;
51   }
52 
53  private:
54   static constexpr std::string_view kPublicApiStr{"public-api"};
55   static constexpr std::string_view kSystemApiStr{"system-api"};
56   static constexpr std::string_view kTestApiStr{"test-api"};
57   static constexpr std::string_view kCorePlatformApiStr{"core-platform-api"};
58 };
59 
60 }  // namespace hiddenapi
61 }  // namespace art
62 
63 
64 #endif  // ART_LIBARTBASE_BASE_HIDDENAPI_STUBS_H_
65