nsIFile.h 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826
  1. /*
  2. * DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/xpcom/io/nsIFile.idl
  3. */
  4. #ifndef __gen_nsIFile_h__
  5. #define __gen_nsIFile_h__
  6. #ifndef __gen_nsISupports_h__
  7. #include "nsISupports.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. class nsISimpleEnumerator; /* forward declaration */
  14. /* starting interface: nsIFile */
  15. #define NS_IFILE_IID_STR "c8c0a080-0868-11d3-915f-d9d889d48e3c"
  16. #define NS_IFILE_IID \
  17. {0xc8c0a080, 0x0868, 0x11d3, \
  18. { 0x91, 0x5f, 0xd9, 0xd8, 0x89, 0xd4, 0x8e, 0x3c }}
  19. /**
  20. * This is the only correct cross-platform way to specify a file.
  21. * Strings are not such a way. If you grew up on windows or unix, you
  22. * may think they are. Welcome to reality.
  23. *
  24. * All methods with string parameters have two forms. The preferred
  25. * form operates on UCS-2 encoded characters strings. An alternate
  26. * form operates on characters strings encoded in the "native" charset.
  27. *
  28. * A string containing characters encoded in the native charset cannot
  29. * be safely passed to javascript via xpconnect. Therefore, the "native
  30. * methods" are not scriptable.
  31. *
  32. * @status FROZEN
  33. */
  34. class NS_NO_VTABLE nsIFile : public nsISupports {
  35. public:
  36. NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFILE_IID)
  37. /**
  38. * Create Types
  39. *
  40. * NORMAL_FILE_TYPE - A normal file.
  41. * DIRECTORY_TYPE - A directory/folder.
  42. */
  43. enum { NORMAL_FILE_TYPE = 0U };
  44. enum { DIRECTORY_TYPE = 1U };
  45. /**
  46. * append[Native]
  47. *
  48. * This function is used for constructing a descendent of the
  49. * current nsIFile.
  50. *
  51. * @param node
  52. * A string which is intended to be a child node of the nsIFile.
  53. * For the |appendNative| method, the node must be in the native
  54. * filesystem charset.
  55. */
  56. /* void append (in AString node); */
  57. NS_IMETHOD Append(const nsAString & node) = 0;
  58. /* [noscript] void appendNative (in ACString node); */
  59. NS_IMETHOD AppendNative(const nsACString & node) = 0;
  60. /**
  61. * Normalize the pathName (e.g. removing .. and . components on Unix).
  62. */
  63. /* void normalize (); */
  64. NS_IMETHOD Normalize(void) = 0;
  65. /**
  66. * create
  67. *
  68. * This function will create a new file or directory in the
  69. * file system. Any nodes that have not been created or
  70. * resolved, will be. If the file or directory already
  71. * exists create() will return NS_ERROR_FILE_ALREADY_EXISTS.
  72. *
  73. * @param type
  74. * This specifies the type of file system object
  75. * to be made. The only two types at this time
  76. * are file and directory which are defined above.
  77. * If the type is unrecongnized, we will return an
  78. * error (NS_ERROR_FILE_UNKNOWN_TYPE).
  79. *
  80. * @param permissions
  81. * The unix style octal permissions. This may
  82. * be ignored on systems that do not need to do
  83. * permissions.
  84. */
  85. /* void create (in unsigned long type, in unsigned long permissions); */
  86. NS_IMETHOD Create(PRUint32 type, PRUint32 permissions) = 0;
  87. /**
  88. * Accessor to the leaf name of the file itself.
  89. * For the |nativeLeafName| method, the nativeLeafName must
  90. * be in the native filesystem charset.
  91. */
  92. /* attribute AString leafName; */
  93. NS_IMETHOD GetLeafName(nsAString & aLeafName) = 0;
  94. NS_IMETHOD SetLeafName(const nsAString & aLeafName) = 0;
  95. /* [noscript] attribute ACString nativeLeafName; */
  96. NS_IMETHOD GetNativeLeafName(nsACString & aNativeLeafName) = 0;
  97. NS_IMETHOD SetNativeLeafName(const nsACString & aNativeLeafName) = 0;
  98. /**
  99. * copyTo[Native]
  100. *
  101. * This will copy this file to the specified newParentDir.
  102. * If a newName is specified, the file will be renamed.
  103. * If 'this' is not created we will return an error
  104. * (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST).
  105. *
  106. * copyTo may fail if the file already exists in the destination
  107. * directory.
  108. *
  109. * copyTo will NOT resolve aliases/shortcuts during the copy.
  110. *
  111. * @param newParentDir
  112. * This param is the destination directory. If the
  113. * newParentDir is null, copyTo() will use the parent
  114. * directory of this file. If the newParentDir is not
  115. * empty and is not a directory, an error will be
  116. * returned (NS_ERROR_FILE_DESTINATION_NOT_DIR). For the
  117. * |CopyToNative| method, the newName must be in the
  118. * native filesystem charset.
  119. *
  120. * @param newName
  121. * This param allows you to specify a new name for
  122. * the file to be copied. This param may be empty, in
  123. * which case the current leaf name will be used.
  124. */
  125. /* void copyTo (in nsIFile newParentDir, in AString newName); */
  126. NS_IMETHOD CopyTo(nsIFile *newParentDir, const nsAString & newName) = 0;
  127. /* [noscript] void CopyToNative (in nsIFile newParentDir, in ACString newName); */
  128. NS_IMETHOD CopyToNative(nsIFile *newParentDir, const nsACString & newName) = 0;
  129. /**
  130. * copyToFollowingLinks[Native]
  131. *
  132. * This function is identical to copyTo with the exception that,
  133. * as the name implies, it follows symbolic links. The XP_UNIX
  134. * implementation always follow symbolic links when copying. For
  135. * the |CopyToFollowingLinks| method, the newName must be in the
  136. * native filesystem charset.
  137. */
  138. /* void copyToFollowingLinks (in nsIFile newParentDir, in AString newName); */
  139. NS_IMETHOD CopyToFollowingLinks(nsIFile *newParentDir, const nsAString & newName) = 0;
  140. /* [noscript] void copyToFollowingLinksNative (in nsIFile newParentDir, in ACString newName); */
  141. NS_IMETHOD CopyToFollowingLinksNative(nsIFile *newParentDir, const nsACString & newName) = 0;
  142. /**
  143. * moveTo[Native]
  144. *
  145. * A method to move this file or directory to newParentDir.
  146. * If a newName is specified, the file or directory will be renamed.
  147. * If 'this' is not created we will return an error
  148. * (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST).
  149. * If 'this' is a file, and the destination file already exists, moveTo
  150. * will replace the old file.
  151. *
  152. * moveTo will NOT resolve aliases/shortcuts during the copy.
  153. * moveTo will do the right thing and allow copies across volumes.
  154. * moveTo will return an error (NS_ERROR_FILE_DIR_NOT_EMPTY) if 'this' is
  155. * a directory and the destination directory is not empty.
  156. * moveTo will return an error (NS_ERROR_FILE_ACCESS_DENIED) if 'this' is
  157. * a directory and the destination directory is not writable.
  158. *
  159. * @param newParentDir
  160. * This param is the destination directory. If the
  161. * newParentDir is empty, moveTo() will rename the file
  162. * within its current directory. If the newParentDir is
  163. * not empty and does not name a directory, an error will
  164. * be returned (NS_ERROR_FILE_DESTINATION_NOT_DIR). For
  165. * the |moveToNative| method, the newName must be in the
  166. * native filesystem charset.
  167. *
  168. * @param newName
  169. * This param allows you to specify a new name for
  170. * the file to be moved. This param may be empty, in
  171. * which case the current leaf name will be used.
  172. */
  173. /* void moveTo (in nsIFile newParentDir, in AString newName); */
  174. NS_IMETHOD MoveTo(nsIFile *newParentDir, const nsAString & newName) = 0;
  175. /* [noscript] void moveToNative (in nsIFile newParentDir, in ACString newName); */
  176. NS_IMETHOD MoveToNative(nsIFile *newParentDir, const nsACString & newName) = 0;
  177. /**
  178. * This will try to delete this file. The 'recursive' flag
  179. * must be PR_TRUE to delete directories which are not empty.
  180. *
  181. * This will not resolve any symlinks.
  182. */
  183. /* void remove (in boolean recursive); */
  184. NS_IMETHOD Remove(PRBool recursive) = 0;
  185. /**
  186. * Attributes of nsIFile.
  187. */
  188. /* attribute unsigned long permissions; */
  189. NS_IMETHOD GetPermissions(PRUint32 *aPermissions) = 0;
  190. NS_IMETHOD SetPermissions(PRUint32 aPermissions) = 0;
  191. /* attribute unsigned long permissionsOfLink; */
  192. NS_IMETHOD GetPermissionsOfLink(PRUint32 *aPermissionsOfLink) = 0;
  193. NS_IMETHOD SetPermissionsOfLink(PRUint32 aPermissionsOfLink) = 0;
  194. /**
  195. * File Times are to be in milliseconds from
  196. * midnight (00:00:00), January 1, 1970 Greenwich Mean
  197. * Time (GMT).
  198. */
  199. /* attribute PRInt64 lastModifiedTime; */
  200. NS_IMETHOD GetLastModifiedTime(PRInt64 *aLastModifiedTime) = 0;
  201. NS_IMETHOD SetLastModifiedTime(PRInt64 aLastModifiedTime) = 0;
  202. /* attribute PRInt64 lastModifiedTimeOfLink; */
  203. NS_IMETHOD GetLastModifiedTimeOfLink(PRInt64 *aLastModifiedTimeOfLink) = 0;
  204. NS_IMETHOD SetLastModifiedTimeOfLink(PRInt64 aLastModifiedTimeOfLink) = 0;
  205. /**
  206. * WARNING! On the Mac, getting/setting the file size with nsIFile
  207. * only deals with the size of the data fork. If you need to
  208. * know the size of the combined data and resource forks use the
  209. * GetFileSizeWithResFork() method defined on nsILocalFileMac.
  210. */
  211. /* attribute PRInt64 fileSize; */
  212. NS_IMETHOD GetFileSize(PRInt64 *aFileSize) = 0;
  213. NS_IMETHOD SetFileSize(PRInt64 aFileSize) = 0;
  214. /* readonly attribute PRInt64 fileSizeOfLink; */
  215. NS_IMETHOD GetFileSizeOfLink(PRInt64 *aFileSizeOfLink) = 0;
  216. /**
  217. * target & path
  218. *
  219. * Accessor to the string path. The native version of these
  220. * strings are not guaranteed to be a usable path to pass to
  221. * NSPR or the C stdlib. There are problems that affect
  222. * platforms on which a path does not fully specify a file
  223. * because two volumes can have the same name (e.g., XP_MAC).
  224. * This is solved by holding "private", native data in the
  225. * nsIFile implementation. This native data is lost when
  226. * you convert to a string.
  227. *
  228. * DO NOT PASS TO USE WITH NSPR OR STDLIB!
  229. *
  230. * target
  231. * Find out what the symlink points at. Will give error
  232. * (NS_ERROR_FILE_INVALID_PATH) if not a symlink.
  233. *
  234. * path
  235. * Find out what the nsIFile points at.
  236. *
  237. * Note that the ACString attributes are returned in the
  238. * native filesystem charset.
  239. *
  240. */
  241. /* readonly attribute AString target; */
  242. NS_IMETHOD GetTarget(nsAString & aTarget) = 0;
  243. /* [noscript] readonly attribute ACString nativeTarget; */
  244. NS_IMETHOD GetNativeTarget(nsACString & aNativeTarget) = 0;
  245. /* readonly attribute AString path; */
  246. NS_IMETHOD GetPath(nsAString & aPath) = 0;
  247. /* [noscript] readonly attribute ACString nativePath; */
  248. NS_IMETHOD GetNativePath(nsACString & aNativePath) = 0;
  249. /* boolean exists (); */
  250. NS_IMETHOD Exists(PRBool *_retval) = 0;
  251. /* boolean isWritable (); */
  252. NS_IMETHOD IsWritable(PRBool *_retval) = 0;
  253. /* boolean isReadable (); */
  254. NS_IMETHOD IsReadable(PRBool *_retval) = 0;
  255. /* boolean isExecutable (); */
  256. NS_IMETHOD IsExecutable(PRBool *_retval) = 0;
  257. /* boolean isHidden (); */
  258. NS_IMETHOD IsHidden(PRBool *_retval) = 0;
  259. /* boolean isDirectory (); */
  260. NS_IMETHOD IsDirectory(PRBool *_retval) = 0;
  261. /* boolean isFile (); */
  262. NS_IMETHOD IsFile(PRBool *_retval) = 0;
  263. /* boolean isSymlink (); */
  264. NS_IMETHOD IsSymlink(PRBool *_retval) = 0;
  265. /**
  266. * Not a regular file, not a directory, not a symlink.
  267. */
  268. /* boolean isSpecial (); */
  269. NS_IMETHOD IsSpecial(PRBool *_retval) = 0;
  270. /**
  271. * createUnique
  272. *
  273. * This function will create a new file or directory in the
  274. * file system. Any nodes that have not been created or
  275. * resolved, will be. If this file already exists, we try
  276. * variations on the leaf name "suggestedName" until we find
  277. * one that did not already exist.
  278. *
  279. * If the search for nonexistent files takes too long
  280. * (thousands of the variants already exist), we give up and
  281. * return NS_ERROR_FILE_TOO_BIG.
  282. *
  283. * @param type
  284. * This specifies the type of file system object
  285. * to be made. The only two types at this time
  286. * are file and directory which are defined above.
  287. * If the type is unrecongnized, we will return an
  288. * error (NS_ERROR_FILE_UNKNOWN_TYPE).
  289. *
  290. * @param permissions
  291. * The unix style octal permissions. This may
  292. * be ignored on systems that do not need to do
  293. * permissions.
  294. */
  295. /* void createUnique (in unsigned long type, in unsigned long permissions); */
  296. NS_IMETHOD CreateUnique(PRUint32 type, PRUint32 permissions) = 0;
  297. /**
  298. * clone()
  299. *
  300. * This function will allocate and initialize a nsIFile object to the
  301. * exact location of the |this| nsIFile.
  302. *
  303. * @param file
  304. * A nsIFile which this object will be initialize
  305. * with.
  306. *
  307. */
  308. /* nsIFile clone (); */
  309. NS_IMETHOD Clone(nsIFile **_retval) = 0;
  310. /**
  311. * Will determine if the inFile equals this.
  312. */
  313. /* boolean equals (in nsIFile inFile); */
  314. NS_IMETHOD Equals(nsIFile *inFile, PRBool *_retval) = 0;
  315. /**
  316. * Will determine if inFile is a descendant of this file
  317. * If |recur| is true, look in subdirectories too
  318. */
  319. /* boolean contains (in nsIFile inFile, in boolean recur); */
  320. NS_IMETHOD Contains(nsIFile *inFile, PRBool recur, PRBool *_retval) = 0;
  321. /**
  322. * Parent will be null when this is at the top of the volume.
  323. */
  324. /* readonly attribute nsIFile parent; */
  325. NS_IMETHOD GetParent(nsIFile * *aParent) = 0;
  326. /**
  327. * Returns an enumeration of the elements in a directory. Each
  328. * element in the enumeration is an nsIFile.
  329. *
  330. * @return NS_ERROR_FILE_NOT_DIRECTORY if the current nsIFile does
  331. * not specify a directory.
  332. */
  333. /* readonly attribute nsISimpleEnumerator directoryEntries; */
  334. NS_IMETHOD GetDirectoryEntries(nsISimpleEnumerator * *aDirectoryEntries) = 0;
  335. };
  336. /* Use this macro when declaring classes that implement this interface. */
  337. #define NS_DECL_NSIFILE \
  338. NS_IMETHOD Append(const nsAString & node); \
  339. NS_IMETHOD AppendNative(const nsACString & node); \
  340. NS_IMETHOD Normalize(void); \
  341. NS_IMETHOD Create(PRUint32 type, PRUint32 permissions); \
  342. NS_IMETHOD GetLeafName(nsAString & aLeafName); \
  343. NS_IMETHOD SetLeafName(const nsAString & aLeafName); \
  344. NS_IMETHOD GetNativeLeafName(nsACString & aNativeLeafName); \
  345. NS_IMETHOD SetNativeLeafName(const nsACString & aNativeLeafName); \
  346. NS_IMETHOD CopyTo(nsIFile *newParentDir, const nsAString & newName); \
  347. NS_IMETHOD CopyToNative(nsIFile *newParentDir, const nsACString & newName); \
  348. NS_IMETHOD CopyToFollowingLinks(nsIFile *newParentDir, const nsAString & newName); \
  349. NS_IMETHOD CopyToFollowingLinksNative(nsIFile *newParentDir, const nsACString & newName); \
  350. NS_IMETHOD MoveTo(nsIFile *newParentDir, const nsAString & newName); \
  351. NS_IMETHOD MoveToNative(nsIFile *newParentDir, const nsACString & newName); \
  352. NS_IMETHOD Remove(PRBool recursive); \
  353. NS_IMETHOD GetPermissions(PRUint32 *aPermissions); \
  354. NS_IMETHOD SetPermissions(PRUint32 aPermissions); \
  355. NS_IMETHOD GetPermissionsOfLink(PRUint32 *aPermissionsOfLink); \
  356. NS_IMETHOD SetPermissionsOfLink(PRUint32 aPermissionsOfLink); \
  357. NS_IMETHOD GetLastModifiedTime(PRInt64 *aLastModifiedTime); \
  358. NS_IMETHOD SetLastModifiedTime(PRInt64 aLastModifiedTime); \
  359. NS_IMETHOD GetLastModifiedTimeOfLink(PRInt64 *aLastModifiedTimeOfLink); \
  360. NS_IMETHOD SetLastModifiedTimeOfLink(PRInt64 aLastModifiedTimeOfLink); \
  361. NS_IMETHOD GetFileSize(PRInt64 *aFileSize); \
  362. NS_IMETHOD SetFileSize(PRInt64 aFileSize); \
  363. NS_IMETHOD GetFileSizeOfLink(PRInt64 *aFileSizeOfLink); \
  364. NS_IMETHOD GetTarget(nsAString & aTarget); \
  365. NS_IMETHOD GetNativeTarget(nsACString & aNativeTarget); \
  366. NS_IMETHOD GetPath(nsAString & aPath); \
  367. NS_IMETHOD GetNativePath(nsACString & aNativePath); \
  368. NS_IMETHOD Exists(PRBool *_retval); \
  369. NS_IMETHOD IsWritable(PRBool *_retval); \
  370. NS_IMETHOD IsReadable(PRBool *_retval); \
  371. NS_IMETHOD IsExecutable(PRBool *_retval); \
  372. NS_IMETHOD IsHidden(PRBool *_retval); \
  373. NS_IMETHOD IsDirectory(PRBool *_retval); \
  374. NS_IMETHOD IsFile(PRBool *_retval); \
  375. NS_IMETHOD IsSymlink(PRBool *_retval); \
  376. NS_IMETHOD IsSpecial(PRBool *_retval); \
  377. NS_IMETHOD CreateUnique(PRUint32 type, PRUint32 permissions); \
  378. NS_IMETHOD Clone(nsIFile **_retval); \
  379. NS_IMETHOD Equals(nsIFile *inFile, PRBool *_retval); \
  380. NS_IMETHOD Contains(nsIFile *inFile, PRBool recur, PRBool *_retval); \
  381. NS_IMETHOD GetParent(nsIFile * *aParent); \
  382. NS_IMETHOD GetDirectoryEntries(nsISimpleEnumerator * *aDirectoryEntries);
  383. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  384. #define NS_FORWARD_NSIFILE(_to) \
  385. NS_IMETHOD Append(const nsAString & node) { return _to Append(node); } \
  386. NS_IMETHOD AppendNative(const nsACString & node) { return _to AppendNative(node); } \
  387. NS_IMETHOD Normalize(void) { return _to Normalize(); } \
  388. NS_IMETHOD Create(PRUint32 type, PRUint32 permissions) { return _to Create(type, permissions); } \
  389. NS_IMETHOD GetLeafName(nsAString & aLeafName) { return _to GetLeafName(aLeafName); } \
  390. NS_IMETHOD SetLeafName(const nsAString & aLeafName) { return _to SetLeafName(aLeafName); } \
  391. NS_IMETHOD GetNativeLeafName(nsACString & aNativeLeafName) { return _to GetNativeLeafName(aNativeLeafName); } \
  392. NS_IMETHOD SetNativeLeafName(const nsACString & aNativeLeafName) { return _to SetNativeLeafName(aNativeLeafName); } \
  393. NS_IMETHOD CopyTo(nsIFile *newParentDir, const nsAString & newName) { return _to CopyTo(newParentDir, newName); } \
  394. NS_IMETHOD CopyToNative(nsIFile *newParentDir, const nsACString & newName) { return _to CopyToNative(newParentDir, newName); } \
  395. NS_IMETHOD CopyToFollowingLinks(nsIFile *newParentDir, const nsAString & newName) { return _to CopyToFollowingLinks(newParentDir, newName); } \
  396. NS_IMETHOD CopyToFollowingLinksNative(nsIFile *newParentDir, const nsACString & newName) { return _to CopyToFollowingLinksNative(newParentDir, newName); } \
  397. NS_IMETHOD MoveTo(nsIFile *newParentDir, const nsAString & newName) { return _to MoveTo(newParentDir, newName); } \
  398. NS_IMETHOD MoveToNative(nsIFile *newParentDir, const nsACString & newName) { return _to MoveToNative(newParentDir, newName); } \
  399. NS_IMETHOD Remove(PRBool recursive) { return _to Remove(recursive); } \
  400. NS_IMETHOD GetPermissions(PRUint32 *aPermissions) { return _to GetPermissions(aPermissions); } \
  401. NS_IMETHOD SetPermissions(PRUint32 aPermissions) { return _to SetPermissions(aPermissions); } \
  402. NS_IMETHOD GetPermissionsOfLink(PRUint32 *aPermissionsOfLink) { return _to GetPermissionsOfLink(aPermissionsOfLink); } \
  403. NS_IMETHOD SetPermissionsOfLink(PRUint32 aPermissionsOfLink) { return _to SetPermissionsOfLink(aPermissionsOfLink); } \
  404. NS_IMETHOD GetLastModifiedTime(PRInt64 *aLastModifiedTime) { return _to GetLastModifiedTime(aLastModifiedTime); } \
  405. NS_IMETHOD SetLastModifiedTime(PRInt64 aLastModifiedTime) { return _to SetLastModifiedTime(aLastModifiedTime); } \
  406. NS_IMETHOD GetLastModifiedTimeOfLink(PRInt64 *aLastModifiedTimeOfLink) { return _to GetLastModifiedTimeOfLink(aLastModifiedTimeOfLink); } \
  407. NS_IMETHOD SetLastModifiedTimeOfLink(PRInt64 aLastModifiedTimeOfLink) { return _to SetLastModifiedTimeOfLink(aLastModifiedTimeOfLink); } \
  408. NS_IMETHOD GetFileSize(PRInt64 *aFileSize) { return _to GetFileSize(aFileSize); } \
  409. NS_IMETHOD SetFileSize(PRInt64 aFileSize) { return _to SetFileSize(aFileSize); } \
  410. NS_IMETHOD GetFileSizeOfLink(PRInt64 *aFileSizeOfLink) { return _to GetFileSizeOfLink(aFileSizeOfLink); } \
  411. NS_IMETHOD GetTarget(nsAString & aTarget) { return _to GetTarget(aTarget); } \
  412. NS_IMETHOD GetNativeTarget(nsACString & aNativeTarget) { return _to GetNativeTarget(aNativeTarget); } \
  413. NS_IMETHOD GetPath(nsAString & aPath) { return _to GetPath(aPath); } \
  414. NS_IMETHOD GetNativePath(nsACString & aNativePath) { return _to GetNativePath(aNativePath); } \
  415. NS_IMETHOD Exists(PRBool *_retval) { return _to Exists(_retval); } \
  416. NS_IMETHOD IsWritable(PRBool *_retval) { return _to IsWritable(_retval); } \
  417. NS_IMETHOD IsReadable(PRBool *_retval) { return _to IsReadable(_retval); } \
  418. NS_IMETHOD IsExecutable(PRBool *_retval) { return _to IsExecutable(_retval); } \
  419. NS_IMETHOD IsHidden(PRBool *_retval) { return _to IsHidden(_retval); } \
  420. NS_IMETHOD IsDirectory(PRBool *_retval) { return _to IsDirectory(_retval); } \
  421. NS_IMETHOD IsFile(PRBool *_retval) { return _to IsFile(_retval); } \
  422. NS_IMETHOD IsSymlink(PRBool *_retval) { return _to IsSymlink(_retval); } \
  423. NS_IMETHOD IsSpecial(PRBool *_retval) { return _to IsSpecial(_retval); } \
  424. NS_IMETHOD CreateUnique(PRUint32 type, PRUint32 permissions) { return _to CreateUnique(type, permissions); } \
  425. NS_IMETHOD Clone(nsIFile **_retval) { return _to Clone(_retval); } \
  426. NS_IMETHOD Equals(nsIFile *inFile, PRBool *_retval) { return _to Equals(inFile, _retval); } \
  427. NS_IMETHOD Contains(nsIFile *inFile, PRBool recur, PRBool *_retval) { return _to Contains(inFile, recur, _retval); } \
  428. NS_IMETHOD GetParent(nsIFile * *aParent) { return _to GetParent(aParent); } \
  429. NS_IMETHOD GetDirectoryEntries(nsISimpleEnumerator * *aDirectoryEntries) { return _to GetDirectoryEntries(aDirectoryEntries); }
  430. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  431. #define NS_FORWARD_SAFE_NSIFILE(_to) \
  432. NS_IMETHOD Append(const nsAString & node) { return !_to ? NS_ERROR_NULL_POINTER : _to->Append(node); } \
  433. NS_IMETHOD AppendNative(const nsACString & node) { return !_to ? NS_ERROR_NULL_POINTER : _to->AppendNative(node); } \
  434. NS_IMETHOD Normalize(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Normalize(); } \
  435. NS_IMETHOD Create(PRUint32 type, PRUint32 permissions) { return !_to ? NS_ERROR_NULL_POINTER : _to->Create(type, permissions); } \
  436. NS_IMETHOD GetLeafName(nsAString & aLeafName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLeafName(aLeafName); } \
  437. NS_IMETHOD SetLeafName(const nsAString & aLeafName) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetLeafName(aLeafName); } \
  438. NS_IMETHOD GetNativeLeafName(nsACString & aNativeLeafName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNativeLeafName(aNativeLeafName); } \
  439. NS_IMETHOD SetNativeLeafName(const nsACString & aNativeLeafName) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetNativeLeafName(aNativeLeafName); } \
  440. NS_IMETHOD CopyTo(nsIFile *newParentDir, const nsAString & newName) { return !_to ? NS_ERROR_NULL_POINTER : _to->CopyTo(newParentDir, newName); } \
  441. NS_IMETHOD CopyToNative(nsIFile *newParentDir, const nsACString & newName) { return !_to ? NS_ERROR_NULL_POINTER : _to->CopyToNative(newParentDir, newName); } \
  442. NS_IMETHOD CopyToFollowingLinks(nsIFile *newParentDir, const nsAString & newName) { return !_to ? NS_ERROR_NULL_POINTER : _to->CopyToFollowingLinks(newParentDir, newName); } \
  443. NS_IMETHOD CopyToFollowingLinksNative(nsIFile *newParentDir, const nsACString & newName) { return !_to ? NS_ERROR_NULL_POINTER : _to->CopyToFollowingLinksNative(newParentDir, newName); } \
  444. NS_IMETHOD MoveTo(nsIFile *newParentDir, const nsAString & newName) { return !_to ? NS_ERROR_NULL_POINTER : _to->MoveTo(newParentDir, newName); } \
  445. NS_IMETHOD MoveToNative(nsIFile *newParentDir, const nsACString & newName) { return !_to ? NS_ERROR_NULL_POINTER : _to->MoveToNative(newParentDir, newName); } \
  446. NS_IMETHOD Remove(PRBool recursive) { return !_to ? NS_ERROR_NULL_POINTER : _to->Remove(recursive); } \
  447. NS_IMETHOD GetPermissions(PRUint32 *aPermissions) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPermissions(aPermissions); } \
  448. NS_IMETHOD SetPermissions(PRUint32 aPermissions) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetPermissions(aPermissions); } \
  449. NS_IMETHOD GetPermissionsOfLink(PRUint32 *aPermissionsOfLink) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPermissionsOfLink(aPermissionsOfLink); } \
  450. NS_IMETHOD SetPermissionsOfLink(PRUint32 aPermissionsOfLink) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetPermissionsOfLink(aPermissionsOfLink); } \
  451. NS_IMETHOD GetLastModifiedTime(PRInt64 *aLastModifiedTime) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLastModifiedTime(aLastModifiedTime); } \
  452. NS_IMETHOD SetLastModifiedTime(PRInt64 aLastModifiedTime) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetLastModifiedTime(aLastModifiedTime); } \
  453. NS_IMETHOD GetLastModifiedTimeOfLink(PRInt64 *aLastModifiedTimeOfLink) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLastModifiedTimeOfLink(aLastModifiedTimeOfLink); } \
  454. NS_IMETHOD SetLastModifiedTimeOfLink(PRInt64 aLastModifiedTimeOfLink) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetLastModifiedTimeOfLink(aLastModifiedTimeOfLink); } \
  455. NS_IMETHOD GetFileSize(PRInt64 *aFileSize) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetFileSize(aFileSize); } \
  456. NS_IMETHOD SetFileSize(PRInt64 aFileSize) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetFileSize(aFileSize); } \
  457. NS_IMETHOD GetFileSizeOfLink(PRInt64 *aFileSizeOfLink) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetFileSizeOfLink(aFileSizeOfLink); } \
  458. NS_IMETHOD GetTarget(nsAString & aTarget) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetTarget(aTarget); } \
  459. NS_IMETHOD GetNativeTarget(nsACString & aNativeTarget) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNativeTarget(aNativeTarget); } \
  460. NS_IMETHOD GetPath(nsAString & aPath) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPath(aPath); } \
  461. NS_IMETHOD GetNativePath(nsACString & aNativePath) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNativePath(aNativePath); } \
  462. NS_IMETHOD Exists(PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->Exists(_retval); } \
  463. NS_IMETHOD IsWritable(PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->IsWritable(_retval); } \
  464. NS_IMETHOD IsReadable(PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->IsReadable(_retval); } \
  465. NS_IMETHOD IsExecutable(PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->IsExecutable(_retval); } \
  466. NS_IMETHOD IsHidden(PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->IsHidden(_retval); } \
  467. NS_IMETHOD IsDirectory(PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->IsDirectory(_retval); } \
  468. NS_IMETHOD IsFile(PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->IsFile(_retval); } \
  469. NS_IMETHOD IsSymlink(PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->IsSymlink(_retval); } \
  470. NS_IMETHOD IsSpecial(PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->IsSpecial(_retval); } \
  471. NS_IMETHOD CreateUnique(PRUint32 type, PRUint32 permissions) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateUnique(type, permissions); } \
  472. NS_IMETHOD Clone(nsIFile **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->Clone(_retval); } \
  473. NS_IMETHOD Equals(nsIFile *inFile, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->Equals(inFile, _retval); } \
  474. NS_IMETHOD Contains(nsIFile *inFile, PRBool recur, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->Contains(inFile, recur, _retval); } \
  475. NS_IMETHOD GetParent(nsIFile * *aParent) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetParent(aParent); } \
  476. NS_IMETHOD GetDirectoryEntries(nsISimpleEnumerator * *aDirectoryEntries) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDirectoryEntries(aDirectoryEntries); }
  477. #if 0
  478. /* Use the code below as a template for the implementation class for this interface. */
  479. /* Header file */
  480. class nsFile : public nsIFile
  481. {
  482. public:
  483. NS_DECL_ISUPPORTS
  484. NS_DECL_NSIFILE
  485. nsFile();
  486. private:
  487. ~nsFile();
  488. protected:
  489. /* additional members */
  490. };
  491. /* Implementation file */
  492. NS_IMPL_ISUPPORTS1(nsFile, nsIFile)
  493. nsFile::nsFile()
  494. {
  495. /* member initializers and constructor code */
  496. }
  497. nsFile::~nsFile()
  498. {
  499. /* destructor code */
  500. }
  501. /* void append (in AString node); */
  502. NS_IMETHODIMP nsFile::Append(const nsAString & node)
  503. {
  504. return NS_ERROR_NOT_IMPLEMENTED;
  505. }
  506. /* [noscript] void appendNative (in ACString node); */
  507. NS_IMETHODIMP nsFile::AppendNative(const nsACString & node)
  508. {
  509. return NS_ERROR_NOT_IMPLEMENTED;
  510. }
  511. /* void normalize (); */
  512. NS_IMETHODIMP nsFile::Normalize()
  513. {
  514. return NS_ERROR_NOT_IMPLEMENTED;
  515. }
  516. /* void create (in unsigned long type, in unsigned long permissions); */
  517. NS_IMETHODIMP nsFile::Create(PRUint32 type, PRUint32 permissions)
  518. {
  519. return NS_ERROR_NOT_IMPLEMENTED;
  520. }
  521. /* attribute AString leafName; */
  522. NS_IMETHODIMP nsFile::GetLeafName(nsAString & aLeafName)
  523. {
  524. return NS_ERROR_NOT_IMPLEMENTED;
  525. }
  526. NS_IMETHODIMP nsFile::SetLeafName(const nsAString & aLeafName)
  527. {
  528. return NS_ERROR_NOT_IMPLEMENTED;
  529. }
  530. /* [noscript] attribute ACString nativeLeafName; */
  531. NS_IMETHODIMP nsFile::GetNativeLeafName(nsACString & aNativeLeafName)
  532. {
  533. return NS_ERROR_NOT_IMPLEMENTED;
  534. }
  535. NS_IMETHODIMP nsFile::SetNativeLeafName(const nsACString & aNativeLeafName)
  536. {
  537. return NS_ERROR_NOT_IMPLEMENTED;
  538. }
  539. /* void copyTo (in nsIFile newParentDir, in AString newName); */
  540. NS_IMETHODIMP nsFile::CopyTo(nsIFile *newParentDir, const nsAString & newName)
  541. {
  542. return NS_ERROR_NOT_IMPLEMENTED;
  543. }
  544. /* [noscript] void CopyToNative (in nsIFile newParentDir, in ACString newName); */
  545. NS_IMETHODIMP nsFile::CopyToNative(nsIFile *newParentDir, const nsACString & newName)
  546. {
  547. return NS_ERROR_NOT_IMPLEMENTED;
  548. }
  549. /* void copyToFollowingLinks (in nsIFile newParentDir, in AString newName); */
  550. NS_IMETHODIMP nsFile::CopyToFollowingLinks(nsIFile *newParentDir, const nsAString & newName)
  551. {
  552. return NS_ERROR_NOT_IMPLEMENTED;
  553. }
  554. /* [noscript] void copyToFollowingLinksNative (in nsIFile newParentDir, in ACString newName); */
  555. NS_IMETHODIMP nsFile::CopyToFollowingLinksNative(nsIFile *newParentDir, const nsACString & newName)
  556. {
  557. return NS_ERROR_NOT_IMPLEMENTED;
  558. }
  559. /* void moveTo (in nsIFile newParentDir, in AString newName); */
  560. NS_IMETHODIMP nsFile::MoveTo(nsIFile *newParentDir, const nsAString & newName)
  561. {
  562. return NS_ERROR_NOT_IMPLEMENTED;
  563. }
  564. /* [noscript] void moveToNative (in nsIFile newParentDir, in ACString newName); */
  565. NS_IMETHODIMP nsFile::MoveToNative(nsIFile *newParentDir, const nsACString & newName)
  566. {
  567. return NS_ERROR_NOT_IMPLEMENTED;
  568. }
  569. /* void remove (in boolean recursive); */
  570. NS_IMETHODIMP nsFile::Remove(PRBool recursive)
  571. {
  572. return NS_ERROR_NOT_IMPLEMENTED;
  573. }
  574. /* attribute unsigned long permissions; */
  575. NS_IMETHODIMP nsFile::GetPermissions(PRUint32 *aPermissions)
  576. {
  577. return NS_ERROR_NOT_IMPLEMENTED;
  578. }
  579. NS_IMETHODIMP nsFile::SetPermissions(PRUint32 aPermissions)
  580. {
  581. return NS_ERROR_NOT_IMPLEMENTED;
  582. }
  583. /* attribute unsigned long permissionsOfLink; */
  584. NS_IMETHODIMP nsFile::GetPermissionsOfLink(PRUint32 *aPermissionsOfLink)
  585. {
  586. return NS_ERROR_NOT_IMPLEMENTED;
  587. }
  588. NS_IMETHODIMP nsFile::SetPermissionsOfLink(PRUint32 aPermissionsOfLink)
  589. {
  590. return NS_ERROR_NOT_IMPLEMENTED;
  591. }
  592. /* attribute PRInt64 lastModifiedTime; */
  593. NS_IMETHODIMP nsFile::GetLastModifiedTime(PRInt64 *aLastModifiedTime)
  594. {
  595. return NS_ERROR_NOT_IMPLEMENTED;
  596. }
  597. NS_IMETHODIMP nsFile::SetLastModifiedTime(PRInt64 aLastModifiedTime)
  598. {
  599. return NS_ERROR_NOT_IMPLEMENTED;
  600. }
  601. /* attribute PRInt64 lastModifiedTimeOfLink; */
  602. NS_IMETHODIMP nsFile::GetLastModifiedTimeOfLink(PRInt64 *aLastModifiedTimeOfLink)
  603. {
  604. return NS_ERROR_NOT_IMPLEMENTED;
  605. }
  606. NS_IMETHODIMP nsFile::SetLastModifiedTimeOfLink(PRInt64 aLastModifiedTimeOfLink)
  607. {
  608. return NS_ERROR_NOT_IMPLEMENTED;
  609. }
  610. /* attribute PRInt64 fileSize; */
  611. NS_IMETHODIMP nsFile::GetFileSize(PRInt64 *aFileSize)
  612. {
  613. return NS_ERROR_NOT_IMPLEMENTED;
  614. }
  615. NS_IMETHODIMP nsFile::SetFileSize(PRInt64 aFileSize)
  616. {
  617. return NS_ERROR_NOT_IMPLEMENTED;
  618. }
  619. /* readonly attribute PRInt64 fileSizeOfLink; */
  620. NS_IMETHODIMP nsFile::GetFileSizeOfLink(PRInt64 *aFileSizeOfLink)
  621. {
  622. return NS_ERROR_NOT_IMPLEMENTED;
  623. }
  624. /* readonly attribute AString target; */
  625. NS_IMETHODIMP nsFile::GetTarget(nsAString & aTarget)
  626. {
  627. return NS_ERROR_NOT_IMPLEMENTED;
  628. }
  629. /* [noscript] readonly attribute ACString nativeTarget; */
  630. NS_IMETHODIMP nsFile::GetNativeTarget(nsACString & aNativeTarget)
  631. {
  632. return NS_ERROR_NOT_IMPLEMENTED;
  633. }
  634. /* readonly attribute AString path; */
  635. NS_IMETHODIMP nsFile::GetPath(nsAString & aPath)
  636. {
  637. return NS_ERROR_NOT_IMPLEMENTED;
  638. }
  639. /* [noscript] readonly attribute ACString nativePath; */
  640. NS_IMETHODIMP nsFile::GetNativePath(nsACString & aNativePath)
  641. {
  642. return NS_ERROR_NOT_IMPLEMENTED;
  643. }
  644. /* boolean exists (); */
  645. NS_IMETHODIMP nsFile::Exists(PRBool *_retval)
  646. {
  647. return NS_ERROR_NOT_IMPLEMENTED;
  648. }
  649. /* boolean isWritable (); */
  650. NS_IMETHODIMP nsFile::IsWritable(PRBool *_retval)
  651. {
  652. return NS_ERROR_NOT_IMPLEMENTED;
  653. }
  654. /* boolean isReadable (); */
  655. NS_IMETHODIMP nsFile::IsReadable(PRBool *_retval)
  656. {
  657. return NS_ERROR_NOT_IMPLEMENTED;
  658. }
  659. /* boolean isExecutable (); */
  660. NS_IMETHODIMP nsFile::IsExecutable(PRBool *_retval)
  661. {
  662. return NS_ERROR_NOT_IMPLEMENTED;
  663. }
  664. /* boolean isHidden (); */
  665. NS_IMETHODIMP nsFile::IsHidden(PRBool *_retval)
  666. {
  667. return NS_ERROR_NOT_IMPLEMENTED;
  668. }
  669. /* boolean isDirectory (); */
  670. NS_IMETHODIMP nsFile::IsDirectory(PRBool *_retval)
  671. {
  672. return NS_ERROR_NOT_IMPLEMENTED;
  673. }
  674. /* boolean isFile (); */
  675. NS_IMETHODIMP nsFile::IsFile(PRBool *_retval)
  676. {
  677. return NS_ERROR_NOT_IMPLEMENTED;
  678. }
  679. /* boolean isSymlink (); */
  680. NS_IMETHODIMP nsFile::IsSymlink(PRBool *_retval)
  681. {
  682. return NS_ERROR_NOT_IMPLEMENTED;
  683. }
  684. /* boolean isSpecial (); */
  685. NS_IMETHODIMP nsFile::IsSpecial(PRBool *_retval)
  686. {
  687. return NS_ERROR_NOT_IMPLEMENTED;
  688. }
  689. /* void createUnique (in unsigned long type, in unsigned long permissions); */
  690. NS_IMETHODIMP nsFile::CreateUnique(PRUint32 type, PRUint32 permissions)
  691. {
  692. return NS_ERROR_NOT_IMPLEMENTED;
  693. }
  694. /* nsIFile clone (); */
  695. NS_IMETHODIMP nsFile::Clone(nsIFile **_retval)
  696. {
  697. return NS_ERROR_NOT_IMPLEMENTED;
  698. }
  699. /* boolean equals (in nsIFile inFile); */
  700. NS_IMETHODIMP nsFile::Equals(nsIFile *inFile, PRBool *_retval)
  701. {
  702. return NS_ERROR_NOT_IMPLEMENTED;
  703. }
  704. /* boolean contains (in nsIFile inFile, in boolean recur); */
  705. NS_IMETHODIMP nsFile::Contains(nsIFile *inFile, PRBool recur, PRBool *_retval)
  706. {
  707. return NS_ERROR_NOT_IMPLEMENTED;
  708. }
  709. /* readonly attribute nsIFile parent; */
  710. NS_IMETHODIMP nsFile::GetParent(nsIFile * *aParent)
  711. {
  712. return NS_ERROR_NOT_IMPLEMENTED;
  713. }
  714. /* readonly attribute nsISimpleEnumerator directoryEntries; */
  715. NS_IMETHODIMP nsFile::GetDirectoryEntries(nsISimpleEnumerator * *aDirectoryEntries)
  716. {
  717. return NS_ERROR_NOT_IMPLEMENTED;
  718. }
  719. /* End of implementation class template. */
  720. #endif
  721. #ifdef MOZILLA_INTERNAL_API
  722. #include "nsDirectoryServiceUtils.h"
  723. #endif
  724. #endif /* __gen_nsIFile_h__ */