1 | // |
2 | // Copyright 2019 The Abseil Authors. |
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 | // https://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 | #ifndef ABSL_FLAGS_INTERNAL_PROGRAM_NAME_H_ |
17 | #define ABSL_FLAGS_INTERNAL_PROGRAM_NAME_H_ |
18 | |
19 | #include <string> |
20 | |
21 | #include "absl/strings/string_view.h" |
22 | |
23 | // -------------------------------------------------------------------- |
24 | // Program name |
25 | |
26 | namespace absl { |
27 | namespace flags_internal { |
28 | |
29 | // Returns program invocation name or "UNKNOWN" if `SetProgramInvocationName()` |
30 | // is never called. At the moment this is always set to argv[0] as part of |
31 | // library initialization. |
32 | std::string ProgramInvocationName(); |
33 | |
34 | // Returns base name for program invocation name. For example, if |
35 | // ProgramInvocationName() == "a/b/mybinary" |
36 | // then |
37 | // ShortProgramInvocationName() == "mybinary" |
38 | std::string ShortProgramInvocationName(); |
39 | |
40 | // Sets program invocation name to a new value. Should only be called once |
41 | // during program initialization, before any threads are spawned. |
42 | void SetProgramInvocationName(absl::string_view prog_name_str); |
43 | |
44 | } // namespace flags_internal |
45 | } // namespace absl |
46 | |
47 | #endif // ABSL_FLAGS_INTERNAL_PROGRAM_NAME_H_ |
48 | |