PageRenderTime 31ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/core/externals/google-toolbox-for-mac/Foundation/GTMNSFileHandle+UniqueName.h

http://macfuse.googlecode.com/
C++ Header | 77 lines | 24 code | 12 blank | 41 comment | 0 complexity | ff9f1afb205bfd6f252f8ae9fbbae097 MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause, GPL-2.0
  1. //
  2. // GTMNSFileHandle+UniqueName.h
  3. //
  4. // Copyright 2010 Google Inc.
  5. //
  6. // Licensed under the Apache License, Version 2.0 (the "License"); you may not
  7. // use this file except in compliance with the License. You may obtain a copy
  8. // of the License at
  9. //
  10. // http://www.apache.org/licenses/LICENSE-2.0
  11. //
  12. // Unless required by applicable law or agreed to in writing, software
  13. // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  14. // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  15. // License for the specific language governing permissions and limitations under
  16. // the License.
  17. //
  18. #import <Foundation/Foundation.h>
  19. #import "GTMDefines.h"
  20. @interface NSFileHandle (GTMFileHandleUniqueNameAdditions)
  21. // Creates a read/write temporary file in NSTemporaryDirectory with mode 0600.
  22. // The template should be similar to the template passed to mkstemp.
  23. // If there is an extension on the nameTemplate it will remain. An example
  24. // template is "MyAppXXXXXX.txt".
  25. // If |path| is not nil, it will contain the derived path for the file.
  26. // The file descriptor wrapped by the NSFileHandle will be closed on dealloc.
  27. + (id)gtm_fileHandleForTemporaryFileBasedOn:(NSString *)nameTemplate
  28. finalPath:(NSString **)path;
  29. // Return an opened read/write file handle with mode 0600 based on a template.
  30. // The template should be similar to the template passed to mkstemp.
  31. // If there is an extension on the pathTemplate it will remain. An example
  32. // template is "/Applications/MyAppXXXXXX.txt".
  33. // If |path| is not nil, it will contain the derived path for the file.
  34. // The file descriptor wrapped by the NSFileHandle will be closed on dealloc.
  35. + (id)gtm_fileHandleWithUniqueNameBasedOn:(NSString *)pathTemplate
  36. finalPath:(NSString **)path;
  37. // Same as fileHandleWithUniqueNameBasedOn:finalName: but splits up the
  38. // template from the directory.
  39. + (id)gtm_fileHandleWithUniqueNameBasedOn:(NSString *)nameTemplate
  40. inDirectory:(NSString *)directory
  41. finalPath:(NSString **)path;
  42. // Same as fileHandleWithUniqueNameBasedOn:inDirectory:finalName: but finds
  43. // the directory using the |directory| and |mask| arguments.
  44. + (id)gtm_fileHandleWithUniqueNameBasedOn:(NSString *)nameTemplate
  45. inDirectory:(NSSearchPathDirectory)directory
  46. domainMask:(NSSearchPathDomainMask)mask
  47. finalPath:(NSString **)path;
  48. @end
  49. @interface NSFileManager (GTMFileManagerUniqueNameAdditions)
  50. // Creates a new directory in NSTemporaryDirectory with mode 0700.
  51. // The template should be similar to the template passed to mkdtemp.
  52. - (NSString *)gtm_createTemporaryDirectoryBasedOn:(NSString *)nameTemplate;
  53. // Return the path to a directory with mode 0700 based on a template.
  54. // The template should be similar to the template passed to mkdtemp.
  55. - (NSString *)gtm_createDirectoryWithUniqueNameBasedOn:(NSString *)nameTemplate;
  56. // Same as createDirectoryWithUniqueNameBasedOn: but splits up the
  57. // template from the directory.
  58. - (NSString *)gtm_createDirectoryWithUniqueNameBasedOn:(NSString *)pathTemplate
  59. inDirectory:(NSString *)directory;
  60. // Same as createDirectoryWithUniqueNameBasedOn:inDirectory: but finds
  61. // the directory using the |directory| and |mask| arguments.
  62. - (NSString *)gtm_createDirectoryWithUniqueNameBasedOn:(NSString *)pathTemplate
  63. inDirectory:(NSSearchPathDirectory)directory
  64. domainMask:(NSSearchPathDomainMask)mask;
  65. @end