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