/core/sdk-objc/GMFinderInfo.h

http://macfuse.googlecode.com/ · C Header · 127 lines · 21 code · 15 blank · 91 comment · 0 complexity · 86e5c57bbecea869737f2600c7cba24d MD5 · raw file

  1. // ================================================================
  2. // Copyright (c) 2007, Google Inc.
  3. // All rights reserved.
  4. //
  5. // Redistribution and use in source and binary forms, with or without
  6. // modification, are permitted provided that the following conditions are
  7. // met:
  8. //
  9. // * Redistributions of source code must retain the above copyright
  10. // notice, this list of conditions and the following disclaimer.
  11. // * Redistributions in binary form must reproduce the above
  12. // copyright notice, this list of conditions and the following disclaimer
  13. // in the documentation and/or other materials provided with the
  14. // distribution.
  15. // * Neither the name of Google Inc. nor the names of its
  16. // contributors may be used to endorse or promote products derived from
  17. // this software without specific prior written permission.
  18. //
  19. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  22. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  23. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  24. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  25. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  27. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. // ================================================================
  31. //
  32. // GMFinderInfo.h
  33. // MacFUSE
  34. //
  35. // Created by ted on 12/29/07.
  36. //
  37. /*!
  38. * @header GMFinderInfo
  39. *
  40. * A utility class to construct raw data for FinderInfo.
  41. *
  42. * In OS 10.4, the FinderInfo for a file may be present in an AppleDouble (._)
  43. * file that is associated with the file. In 10.5+, the FinderInfo is present in
  44. * the com.apple.FinderInfo extended attribute on a file.
  45. */
  46. #import <Foundation/Foundation.h>
  47. #define GM_EXPORT __attribute__((visibility("default")))
  48. /*!
  49. * @class
  50. * @discussion This class can be used to construct raw NSData for FinderInfo.
  51. * For more information about FinderInfo and what it can contain, see
  52. * the CarbonCore/Finder.h header file.
  53. */
  54. GM_EXPORT @interface GMFinderInfo : NSObject {
  55. @private
  56. UInt16 flags_;
  57. UInt16 extendedFlags_;
  58. OSType typeCode_;
  59. OSType creatorCode_;
  60. }
  61. /*! @abstract Returns an autorleased GMFinderInfo */
  62. + (GMFinderInfo *)finderInfo;
  63. /*!
  64. * @abstract Sets FinderInfo flags.
  65. * @discussion See CarbonCore/Finder.h for the set of flags.
  66. * @param flags OR'd set of valid Finder flags.
  67. */
  68. - (void)setFlags:(UInt16)flags;
  69. /*!
  70. * @abstract Sets FinderInfo extended flags.
  71. * @discussion See CarbonCore/Finder.h for the set of extended flags.
  72. * @param flags OR'd set of valid Finder extended flags.
  73. */
  74. - (void)setExtendedFlags:(UInt16)extendedFlags;
  75. /*!
  76. * @abstract Sets FinderInfo four-char type code.
  77. * @param typeCode The four-char type code to set.
  78. */
  79. - (void)setTypeCode:(OSType)typeCode;
  80. /*!
  81. * @abstract Sets FinderInfo four-char creator code.
  82. * @param typeCode The four-char creator code to set.
  83. */
  84. - (void)setCreatorCode:(OSType)creatorCode;
  85. /*!
  86. * @abstract Constucts the raw data for the FinderInfo.
  87. * @result NSData for the FinderInfo based on the current settings.
  88. */
  89. - (NSData *)data;
  90. // -- Deprecated Convenience Methods --
  91. /*!
  92. * @abstract NSData for a FinderInfo with the given flags.
  93. * @param flags OR'd set of FinderInfo flags.
  94. * @result NSData of the FinderInfo.
  95. * @deprecated This method is deprecated.
  96. */
  97. + (NSData *)finderInfoWithFinderFlags:(UInt16)flags;
  98. // Suitable only for files (not directories), this version allows you to
  99. // specify type and creator four-char-codes in addition to the flags.
  100. /*!
  101. * @abstract NSData for a FinderInfo with the given flags, type, and creator.
  102. * @param flags OR'd set of FinderInfo flags.
  103. * @param typeCode The four-char type code.
  104. * @param creatorCode The four-char creator code.
  105. * @result NSData of the FinderInfo.
  106. * @deprecated This method is deprecated.
  107. */
  108. + (NSData *)finderInfoWithFinderFlags:(UInt16)flags
  109. typeCode:(OSType)typeCode
  110. creatorCode:(OSType)creatorCode;
  111. @end
  112. #undef GM_EXPORT