nsIURL.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. /*
  2. * DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/netwerk/base/public/nsIURL.idl
  3. */
  4. #ifndef __gen_nsIURL_h__
  5. #define __gen_nsIURL_h__
  6. #ifndef __gen_nsIURI_h__
  7. #include "nsIURI.h"
  8. #endif
  9. /* For IDL files that don't want to include root IDL files. */
  10. #ifndef NS_NO_VTABLE
  11. #define NS_NO_VTABLE
  12. #endif
  13. /* starting interface: nsIURL */
  14. #define NS_IURL_IID_STR "d6116970-8034-11d3-9399-00104ba0fd40"
  15. #define NS_IURL_IID \
  16. {0xd6116970, 0x8034, 0x11d3, \
  17. { 0x93, 0x99, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40 }}
  18. /**
  19. * The nsIURL interface provides convenience methods that further
  20. * break down the path portion of nsIURI:
  21. *
  22. * http://directory/fileBaseName.fileExtension?query
  23. * http://directory/fileBaseName.fileExtension#ref
  24. * http://directory/fileBaseName.fileExtension;param
  25. * \ \ /
  26. * \ -----------------------
  27. * \ | /
  28. * \ fileName /
  29. * ----------------------------
  30. * |
  31. * filePath
  32. *
  33. * @status FROZEN
  34. */
  35. class NS_NO_VTABLE nsIURL : public nsIURI {
  36. public:
  37. NS_DEFINE_STATIC_IID_ACCESSOR(NS_IURL_IID)
  38. /*************************************************************************
  39. * The URL path is broken down into the following principal components:
  40. */
  41. /**
  42. * Returns a path including the directory and file portions of a
  43. * URL. For example, the filePath of "http://foo/bar.html#baz" is
  44. * "/foo/bar.html".
  45. *
  46. * Some characters may be escaped.
  47. */
  48. /* attribute AUTF8String filePath; */
  49. NS_IMETHOD GetFilePath(nsACString & aFilePath) = 0;
  50. NS_IMETHOD SetFilePath(const nsACString & aFilePath) = 0;
  51. /**
  52. * Returns the parameters specified after the ; in the URL.
  53. *
  54. * Some characters may be escaped.
  55. */
  56. /* attribute AUTF8String param; */
  57. NS_IMETHOD GetParam(nsACString & aParam) = 0;
  58. NS_IMETHOD SetParam(const nsACString & aParam) = 0;
  59. /**
  60. * Returns the query portion (the part after the "?") of the URL.
  61. * If there isn't one, an empty string is returned.
  62. *
  63. * Some characters may be escaped.
  64. */
  65. /* attribute AUTF8String query; */
  66. NS_IMETHOD GetQuery(nsACString & aQuery) = 0;
  67. NS_IMETHOD SetQuery(const nsACString & aQuery) = 0;
  68. /**
  69. * Returns the reference portion (the part after the "#") of the URL.
  70. * If there isn't one, an empty string is returned.
  71. *
  72. * Some characters may be escaped.
  73. */
  74. /* attribute AUTF8String ref; */
  75. NS_IMETHOD GetRef(nsACString & aRef) = 0;
  76. NS_IMETHOD SetRef(const nsACString & aRef) = 0;
  77. /*************************************************************************
  78. * The URL filepath is broken down into the following sub-components:
  79. */
  80. /**
  81. * Returns the directory portion of a URL.
  82. * If the URL denotes a path to a directory and not a file,
  83. * e.g. http://foo/bar/, then the Directory attribute accesses
  84. * the complete /foo/bar/ portion, and the FileName is the
  85. * empty string. If the trailing slash is omitted, then the
  86. * Directory is /foo/ and the file is bar (i.e. this is a
  87. * syntactic, not a semantic breakdown of the Path).
  88. * And hence dont rely on this for something to be a definitely
  89. * be a file. But you can get just the leading directory portion
  90. * for sure.
  91. *
  92. * Some characters may be escaped.
  93. */
  94. /* attribute AUTF8String directory; */
  95. NS_IMETHOD GetDirectory(nsACString & aDirectory) = 0;
  96. NS_IMETHOD SetDirectory(const nsACString & aDirectory) = 0;
  97. /**
  98. * Returns the file name portion of a URL.
  99. * If the URL denotes a path to a directory and not a file,
  100. * e.g. http://foo/bar/, then the Directory attribute accesses
  101. * the complete /foo/bar/ portion, and the FileName is the
  102. * empty string. Note that this is purely based on searching
  103. * for the last trailing slash. And hence dont rely on this to
  104. * be a definite file.
  105. *
  106. * Some characters may be escaped.
  107. */
  108. /* attribute AUTF8String fileName; */
  109. NS_IMETHOD GetFileName(nsACString & aFileName) = 0;
  110. NS_IMETHOD SetFileName(const nsACString & aFileName) = 0;
  111. /*************************************************************************
  112. * The URL filename is broken down even further:
  113. */
  114. /**
  115. * Returns the file basename portion of a filename in a url.
  116. *
  117. * Some characters may be escaped.
  118. */
  119. /* attribute AUTF8String fileBaseName; */
  120. NS_IMETHOD GetFileBaseName(nsACString & aFileBaseName) = 0;
  121. NS_IMETHOD SetFileBaseName(const nsACString & aFileBaseName) = 0;
  122. /**
  123. * Returns the file extension portion of a filename in a url. If a file
  124. * extension does not exist, the empty string is returned.
  125. *
  126. * Some characters may be escaped.
  127. */
  128. /* attribute AUTF8String fileExtension; */
  129. NS_IMETHOD GetFileExtension(nsACString & aFileExtension) = 0;
  130. NS_IMETHOD SetFileExtension(const nsACString & aFileExtension) = 0;
  131. /**
  132. * This method takes a uri and compares the two. The common uri portion
  133. * is returned as a string. The minimum common uri portion is the
  134. * protocol, and any of these if present: login, password, host and port
  135. * If no commonality is found, "" is returned. If they are identical, the
  136. * whole path with file/ref/etc. is returned. For file uris, it is
  137. * expected that the common spec would be at least "file:///" since '/' is
  138. * a shared common root.
  139. *
  140. * Examples:
  141. * this.spec aURIToCompare.spec result
  142. * 1) http://mozilla.org/ http://www.mozilla.org/ ""
  143. * 2) http://foo.com/bar/ ftp://foo.com/bar/ ""
  144. * 3) http://foo.com:8080/ http://foo.com/bar/ ""
  145. * 4) ftp://[email protected]/ ftp://user:[email protected]/ ""
  146. * 5) ftp://foo.com/bar/ ftp://foo.com/bar ftp://foo.com/
  147. * 6) ftp://foo.com/bar/ ftp://foo.com/bar/b.html ftp://foo.com/bar/
  148. * 7) http://foo.com/a.htm#i http://foo.com/b.htm http://foo.com/
  149. * 8) ftp://foo.com/c.htm#i ftp://foo.com/c.htm ftp://foo.com/c.htm
  150. * 9) file:///a/b/c.html file:///d/e/c.html file:///
  151. */
  152. /* AUTF8String getCommonBaseSpec (in nsIURI aURIToCompare); */
  153. NS_IMETHOD GetCommonBaseSpec(nsIURI *aURIToCompare, nsACString & _retval) = 0;
  154. /**
  155. * This method takes a uri and returns a substring of this if it can be
  156. * made relative to the uri passed in. If no commonality is found, the
  157. * entire uri spec is returned. If they are identical, "" is returned.
  158. * Filename, query, etc are always returned except when uris are identical.
  159. */
  160. /* AUTF8String getRelativeSpec (in nsIURI aURIToCompare); */
  161. NS_IMETHOD GetRelativeSpec(nsIURI *aURIToCompare, nsACString & _retval) = 0;
  162. };
  163. /* Use this macro when declaring classes that implement this interface. */
  164. #define NS_DECL_NSIURL \
  165. NS_IMETHOD GetFilePath(nsACString & aFilePath); \
  166. NS_IMETHOD SetFilePath(const nsACString & aFilePath); \
  167. NS_IMETHOD GetParam(nsACString & aParam); \
  168. NS_IMETHOD SetParam(const nsACString & aParam); \
  169. NS_IMETHOD GetQuery(nsACString & aQuery); \
  170. NS_IMETHOD SetQuery(const nsACString & aQuery); \
  171. NS_IMETHOD GetRef(nsACString & aRef); \
  172. NS_IMETHOD SetRef(const nsACString & aRef); \
  173. NS_IMETHOD GetDirectory(nsACString & aDirectory); \
  174. NS_IMETHOD SetDirectory(const nsACString & aDirectory); \
  175. NS_IMETHOD GetFileName(nsACString & aFileName); \
  176. NS_IMETHOD SetFileName(const nsACString & aFileName); \
  177. NS_IMETHOD GetFileBaseName(nsACString & aFileBaseName); \
  178. NS_IMETHOD SetFileBaseName(const nsACString & aFileBaseName); \
  179. NS_IMETHOD GetFileExtension(nsACString & aFileExtension); \
  180. NS_IMETHOD SetFileExtension(const nsACString & aFileExtension); \
  181. NS_IMETHOD GetCommonBaseSpec(nsIURI *aURIToCompare, nsACString & _retval); \
  182. NS_IMETHOD GetRelativeSpec(nsIURI *aURIToCompare, nsACString & _retval);
  183. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  184. #define NS_FORWARD_NSIURL(_to) \
  185. NS_IMETHOD GetFilePath(nsACString & aFilePath) { return _to GetFilePath(aFilePath); } \
  186. NS_IMETHOD SetFilePath(const nsACString & aFilePath) { return _to SetFilePath(aFilePath); } \
  187. NS_IMETHOD GetParam(nsACString & aParam) { return _to GetParam(aParam); } \
  188. NS_IMETHOD SetParam(const nsACString & aParam) { return _to SetParam(aParam); } \
  189. NS_IMETHOD GetQuery(nsACString & aQuery) { return _to GetQuery(aQuery); } \
  190. NS_IMETHOD SetQuery(const nsACString & aQuery) { return _to SetQuery(aQuery); } \
  191. NS_IMETHOD GetRef(nsACString & aRef) { return _to GetRef(aRef); } \
  192. NS_IMETHOD SetRef(const nsACString & aRef) { return _to SetRef(aRef); } \
  193. NS_IMETHOD GetDirectory(nsACString & aDirectory) { return _to GetDirectory(aDirectory); } \
  194. NS_IMETHOD SetDirectory(const nsACString & aDirectory) { return _to SetDirectory(aDirectory); } \
  195. NS_IMETHOD GetFileName(nsACString & aFileName) { return _to GetFileName(aFileName); } \
  196. NS_IMETHOD SetFileName(const nsACString & aFileName) { return _to SetFileName(aFileName); } \
  197. NS_IMETHOD GetFileBaseName(nsACString & aFileBaseName) { return _to GetFileBaseName(aFileBaseName); } \
  198. NS_IMETHOD SetFileBaseName(const nsACString & aFileBaseName) { return _to SetFileBaseName(aFileBaseName); } \
  199. NS_IMETHOD GetFileExtension(nsACString & aFileExtension) { return _to GetFileExtension(aFileExtension); } \
  200. NS_IMETHOD SetFileExtension(const nsACString & aFileExtension) { return _to SetFileExtension(aFileExtension); } \
  201. NS_IMETHOD GetCommonBaseSpec(nsIURI *aURIToCompare, nsACString & _retval) { return _to GetCommonBaseSpec(aURIToCompare, _retval); } \
  202. NS_IMETHOD GetRelativeSpec(nsIURI *aURIToCompare, nsACString & _retval) { return _to GetRelativeSpec(aURIToCompare, _retval); }
  203. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  204. #define NS_FORWARD_SAFE_NSIURL(_to) \
  205. NS_IMETHOD GetFilePath(nsACString & aFilePath) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetFilePath(aFilePath); } \
  206. NS_IMETHOD SetFilePath(const nsACString & aFilePath) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetFilePath(aFilePath); } \
  207. NS_IMETHOD GetParam(nsACString & aParam) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetParam(aParam); } \
  208. NS_IMETHOD SetParam(const nsACString & aParam) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetParam(aParam); } \
  209. NS_IMETHOD GetQuery(nsACString & aQuery) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetQuery(aQuery); } \
  210. NS_IMETHOD SetQuery(const nsACString & aQuery) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetQuery(aQuery); } \
  211. NS_IMETHOD GetRef(nsACString & aRef) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetRef(aRef); } \
  212. NS_IMETHOD SetRef(const nsACString & aRef) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetRef(aRef); } \
  213. NS_IMETHOD GetDirectory(nsACString & aDirectory) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDirectory(aDirectory); } \
  214. NS_IMETHOD SetDirectory(const nsACString & aDirectory) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetDirectory(aDirectory); } \
  215. NS_IMETHOD GetFileName(nsACString & aFileName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetFileName(aFileName); } \
  216. NS_IMETHOD SetFileName(const nsACString & aFileName) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetFileName(aFileName); } \
  217. NS_IMETHOD GetFileBaseName(nsACString & aFileBaseName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetFileBaseName(aFileBaseName); } \
  218. NS_IMETHOD SetFileBaseName(const nsACString & aFileBaseName) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetFileBaseName(aFileBaseName); } \
  219. NS_IMETHOD GetFileExtension(nsACString & aFileExtension) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetFileExtension(aFileExtension); } \
  220. NS_IMETHOD SetFileExtension(const nsACString & aFileExtension) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetFileExtension(aFileExtension); } \
  221. NS_IMETHOD GetCommonBaseSpec(nsIURI *aURIToCompare, nsACString & _retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCommonBaseSpec(aURIToCompare, _retval); } \
  222. NS_IMETHOD GetRelativeSpec(nsIURI *aURIToCompare, nsACString & _retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetRelativeSpec(aURIToCompare, _retval); }
  223. #if 0
  224. /* Use the code below as a template for the implementation class for this interface. */
  225. /* Header file */
  226. class nsURL : public nsIURL
  227. {
  228. public:
  229. NS_DECL_ISUPPORTS
  230. NS_DECL_NSIURL
  231. nsURL();
  232. private:
  233. ~nsURL();
  234. protected:
  235. /* additional members */
  236. };
  237. /* Implementation file */
  238. NS_IMPL_ISUPPORTS1(nsURL, nsIURL)
  239. nsURL::nsURL()
  240. {
  241. /* member initializers and constructor code */
  242. }
  243. nsURL::~nsURL()
  244. {
  245. /* destructor code */
  246. }
  247. /* attribute AUTF8String filePath; */
  248. NS_IMETHODIMP nsURL::GetFilePath(nsACString & aFilePath)
  249. {
  250. return NS_ERROR_NOT_IMPLEMENTED;
  251. }
  252. NS_IMETHODIMP nsURL::SetFilePath(const nsACString & aFilePath)
  253. {
  254. return NS_ERROR_NOT_IMPLEMENTED;
  255. }
  256. /* attribute AUTF8String param; */
  257. NS_IMETHODIMP nsURL::GetParam(nsACString & aParam)
  258. {
  259. return NS_ERROR_NOT_IMPLEMENTED;
  260. }
  261. NS_IMETHODIMP nsURL::SetParam(const nsACString & aParam)
  262. {
  263. return NS_ERROR_NOT_IMPLEMENTED;
  264. }
  265. /* attribute AUTF8String query; */
  266. NS_IMETHODIMP nsURL::GetQuery(nsACString & aQuery)
  267. {
  268. return NS_ERROR_NOT_IMPLEMENTED;
  269. }
  270. NS_IMETHODIMP nsURL::SetQuery(const nsACString & aQuery)
  271. {
  272. return NS_ERROR_NOT_IMPLEMENTED;
  273. }
  274. /* attribute AUTF8String ref; */
  275. NS_IMETHODIMP nsURL::GetRef(nsACString & aRef)
  276. {
  277. return NS_ERROR_NOT_IMPLEMENTED;
  278. }
  279. NS_IMETHODIMP nsURL::SetRef(const nsACString & aRef)
  280. {
  281. return NS_ERROR_NOT_IMPLEMENTED;
  282. }
  283. /* attribute AUTF8String directory; */
  284. NS_IMETHODIMP nsURL::GetDirectory(nsACString & aDirectory)
  285. {
  286. return NS_ERROR_NOT_IMPLEMENTED;
  287. }
  288. NS_IMETHODIMP nsURL::SetDirectory(const nsACString & aDirectory)
  289. {
  290. return NS_ERROR_NOT_IMPLEMENTED;
  291. }
  292. /* attribute AUTF8String fileName; */
  293. NS_IMETHODIMP nsURL::GetFileName(nsACString & aFileName)
  294. {
  295. return NS_ERROR_NOT_IMPLEMENTED;
  296. }
  297. NS_IMETHODIMP nsURL::SetFileName(const nsACString & aFileName)
  298. {
  299. return NS_ERROR_NOT_IMPLEMENTED;
  300. }
  301. /* attribute AUTF8String fileBaseName; */
  302. NS_IMETHODIMP nsURL::GetFileBaseName(nsACString & aFileBaseName)
  303. {
  304. return NS_ERROR_NOT_IMPLEMENTED;
  305. }
  306. NS_IMETHODIMP nsURL::SetFileBaseName(const nsACString & aFileBaseName)
  307. {
  308. return NS_ERROR_NOT_IMPLEMENTED;
  309. }
  310. /* attribute AUTF8String fileExtension; */
  311. NS_IMETHODIMP nsURL::GetFileExtension(nsACString & aFileExtension)
  312. {
  313. return NS_ERROR_NOT_IMPLEMENTED;
  314. }
  315. NS_IMETHODIMP nsURL::SetFileExtension(const nsACString & aFileExtension)
  316. {
  317. return NS_ERROR_NOT_IMPLEMENTED;
  318. }
  319. /* AUTF8String getCommonBaseSpec (in nsIURI aURIToCompare); */
  320. NS_IMETHODIMP nsURL::GetCommonBaseSpec(nsIURI *aURIToCompare, nsACString & _retval)
  321. {
  322. return NS_ERROR_NOT_IMPLEMENTED;
  323. }
  324. /* AUTF8String getRelativeSpec (in nsIURI aURIToCompare); */
  325. NS_IMETHODIMP nsURL::GetRelativeSpec(nsIURI *aURIToCompare, nsACString & _retval)
  326. {
  327. return NS_ERROR_NOT_IMPLEMENTED;
  328. }
  329. /* End of implementation class template. */
  330. #endif
  331. #endif /* __gen_nsIURL_h__ */