UriParser.h 1.0 KB

12345678910111213141516171819202122232425262728293031
  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. #ifndef LLDB_UTILITY_URIPARSER_H
  9. #define LLDB_UTILITY_URIPARSER_H
  10. #include "llvm/ADT/StringRef.h"
  11. namespace lldb_private {
  12. class UriParser {
  13. public:
  14. // Parses
  15. // RETURN VALUE
  16. // if url is valid, function returns true and
  17. // scheme/hostname/port/path are set to the parsed values
  18. // port it set to -1 if it is not included in the URL
  19. //
  20. // if the url is invalid, function returns false and
  21. // output parameters remain unchanged
  22. static bool Parse(llvm::StringRef uri, llvm::StringRef &scheme,
  23. llvm::StringRef &hostname, int &port,
  24. llvm::StringRef &path);
  25. };
  26. }
  27. #endif // LLDB_UTILITY_URIPARSER_H