You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

program_name.h 1.8 kB

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