1 //===-- UriParser.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_UTILITY_URIPARSER_H
10 #define LLDB_UTILITY_URIPARSER_H
11 
12 #include "llvm/ADT/StringRef.h"
13 #include <optional>
14 
15 namespace llvm {
16 class raw_ostream;
17 } // namespace llvm
18 
19 namespace lldb_private {
20 
21 struct URI {
22   llvm::StringRef scheme;
23   llvm::StringRef hostname;
24   std::optional<uint16_t> port;
25   llvm::StringRef path;
26 
27   bool operator==(const URI &R) const {
28     return port == R.port && scheme == R.scheme && hostname == R.hostname &&
29            path == R.path;
30   }
31 
32   static std::optional<URI> Parse(llvm::StringRef uri);
33 };
34 
35 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const URI &U);
36 
37 } // namespace lldb_private
38 
39 #endif // LLDB_UTILITY_URIPARSER_H
40