nsIURLParser.idl 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "nsISupports.idl"
  6. /**
  7. * nsIURLParser specifies the interface to an URL parser that attempts to
  8. * follow the definitions of RFC 2396.
  9. */
  10. [scriptable, uuid(78c5d19f-f5d2-4732-8d3d-d5a7d7133bc0)]
  11. interface nsIURLParser : nsISupports
  12. {
  13. /**
  14. * The string to parse in the following methods may be given as a null
  15. * terminated string, in which case the length argument should be -1.
  16. *
  17. * Out parameters of the following methods are all optional (ie. the caller
  18. * may pass-in a NULL value if the corresponding results are not needed).
  19. * Signed out parameters may hold a value of -1 if the corresponding result
  20. * is not part of the string being parsed.
  21. *
  22. * The parsing routines attempt to be as forgiving as possible.
  23. */
  24. /**
  25. * ParseSpec breaks the URL string up into its 3 major components: a scheme,
  26. * an authority section (hostname, etc.), and a path.
  27. *
  28. * spec = <scheme>://<authority><path>
  29. */
  30. void parseURL (in string spec, in long specLen,
  31. out unsigned long schemePos, out long schemeLen,
  32. out unsigned long authorityPos, out long authorityLen,
  33. out unsigned long pathPos, out long pathLen);
  34. /**
  35. * ParseAuthority breaks the authority string up into its 4 components:
  36. * username, password, hostname, and hostport.
  37. *
  38. * auth = <username>:<password>@<hostname>:<port>
  39. */
  40. void parseAuthority (in string authority, in long authorityLen,
  41. out unsigned long usernamePos, out long usernameLen,
  42. out unsigned long passwordPos, out long passwordLen,
  43. out unsigned long hostnamePos, out long hostnameLen,
  44. out long port);
  45. /**
  46. * userinfo = <username>:<password>
  47. */
  48. void parseUserInfo (in string userinfo, in long userinfoLen,
  49. out unsigned long usernamePos, out long usernameLen,
  50. out unsigned long passwordPos, out long passwordLen);
  51. /**
  52. * serverinfo = <hostname>:<port>
  53. */
  54. void parseServerInfo (in string serverinfo, in long serverinfoLen,
  55. out unsigned long hostnamePos, out long hostnameLen,
  56. out long port);
  57. /**
  58. * ParsePath breaks the path string up into its 3 major components: a file path,
  59. * a query string, and a reference string.
  60. *
  61. * path = <filepath>?<query>#<ref>
  62. */
  63. void parsePath (in string path, in long pathLen,
  64. out unsigned long filepathPos, out long filepathLen,
  65. out unsigned long queryPos, out long queryLen,
  66. out unsigned long refPos, out long refLen);
  67. /**
  68. * ParseFilePath breaks the file path string up into: the directory portion,
  69. * file base name, and file extension.
  70. *
  71. * filepath = <directory><basename>.<extension>
  72. */
  73. void parseFilePath (in string filepath, in long filepathLen,
  74. out unsigned long directoryPos, out long directoryLen,
  75. out unsigned long basenamePos, out long basenameLen,
  76. out unsigned long extensionPos, out long extensionLen);
  77. /**
  78. * filename = <basename>.<extension>
  79. */
  80. void parseFileName (in string filename, in long filenameLen,
  81. out unsigned long basenamePos, out long basenameLen,
  82. out unsigned long extensionPos, out long extensionLen);
  83. };
  84. %{C++
  85. // url parser key for use with the category manager
  86. // mapping from scheme to url parser.
  87. #define NS_IURLPARSER_KEY "@mozilla.org/urlparser;1"
  88. %}