00001 // 00002 // Copyright 2019 The Abseil Authors. 00003 // 00004 // Licensed under the Apache License, Version 2.0 (the "License"); 00005 // you may not use this file except in compliance with the License. 00006 // You may obtain a copy of the License at 00007 // 00008 // https://www.apache.org/licenses/LICENSE-2.0 00009 // 00010 // Unless required by applicable law or agreed to in writing, software 00011 // distributed under the License is distributed on an "AS IS" BASIS, 00012 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 // See the License for the specific language governing permissions and 00014 // limitations under the License. 00015 00016 #ifndef ABSL_FLAGS_INTERNAL_PROGRAM_NAME_H_ 00017 #define ABSL_FLAGS_INTERNAL_PROGRAM_NAME_H_ 00018 00019 #include <string> 00020 00021 #include "absl/strings/string_view.h" 00022 00023 // -------------------------------------------------------------------- 00024 // Program name 00025 00026 namespace absl { 00027 namespace flags_internal { 00028 00029 // Returns program invocation name or "UNKNOWN" if `SetProgramInvocationName()` 00030 // is never called. At the moment this is always set to argv[0] as part of 00031 // library initialization. 00032 std::string ProgramInvocationName(); 00033 00034 // Returns base name for program invocation name. For example, if 00035 // ProgramInvocationName() == "a/b/mybinary" 00036 // then 00037 // ShortProgramInvocationName() == "mybinary" 00038 std::string ShortProgramInvocationName(); 00039 00040 // Sets program invocation name to a new value. Should only be called once 00041 // during program initialization, before any threads are spawned. 00042 void SetProgramInvocationName(absl::string_view prog_name_str); 00043 00044 } // namespace flags_internal 00045 } // namespace absl 00046 00047 #endif // ABSL_FLAGS_INTERNAL_PROGRAM_NAME_H_