1 //===-- OptionArgParser.h ---------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_INTERPRETER_OPTIONARGPARSER_H
10 #define LLDB_INTERPRETER_OPTIONARGPARSER_H
11 
12 #include "lldb/lldb-private-types.h"
13 
14 namespace lldb_private {
15 
16 struct OptionArgParser {
17   static lldb::addr_t ToAddress(const ExecutionContext *exe_ctx,
18                                 llvm::StringRef s, lldb::addr_t fail_value,
19                                 Status *error);
20 
21   static bool ToBoolean(llvm::StringRef s, bool fail_value, bool *success_ptr);
22 
23   static char ToChar(llvm::StringRef s, char fail_value, bool *success_ptr);
24 
25   static int64_t ToOptionEnum(llvm::StringRef s,
26                               const OptionEnumValues &enum_values,
27                               int32_t fail_value, Status &error);
28 
29   static lldb::ScriptLanguage ToScriptLanguage(llvm::StringRef s,
30                                                lldb::ScriptLanguage fail_value,
31                                                bool *success_ptr);
32 
33   // TODO: Use StringRef
34   static Status ToFormat(const char *s, lldb::Format &format,
35                          size_t *byte_size_ptr); // If non-NULL, then a
36                                                  // byte size can precede
37                                                  // the format character
38 };
39 
40 } // namespace lldb_private
41 
42 #endif // LLDB_INTERPRETER_OPTIONARGPARSER_H
43