filespecmac_carbon.h
Upload User: dangjiwu
Upload Date: 2013-07-19
Package Size: 42019k
Code Size: 6k
Category:

Symbian

Development Platform:

Visual C++

  1. /* ***** BEGIN LICENSE BLOCK *****
  2.  * Source last modified: $Id: filespecmac_carbon.h,v 1.3.32.3 2004/07/09 01:44:30 hubbe Exp $
  3.  * 
  4.  * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
  5.  * 
  6.  * The contents of this file, and the files included with this file,
  7.  * are subject to the current version of the RealNetworks Public
  8.  * Source License (the "RPSL") available at
  9.  * http://www.helixcommunity.org/content/rpsl unless you have licensed
  10.  * the file under the current version of the RealNetworks Community
  11.  * Source License (the "RCSL") available at
  12.  * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
  13.  * will apply. You may also obtain the license terms directly from
  14.  * RealNetworks.  You may not use this file except in compliance with
  15.  * the RPSL or, if you have a valid RCSL with RealNetworks applicable
  16.  * to this file, the RCSL.  Please see the applicable RPSL or RCSL for
  17.  * the rights, obligations and limitations governing use of the
  18.  * contents of the file.
  19.  * 
  20.  * Alternatively, the contents of this file may be used under the
  21.  * terms of the GNU General Public License Version 2 or later (the
  22.  * "GPL") in which case the provisions of the GPL are applicable
  23.  * instead of those above. If you wish to allow use of your version of
  24.  * this file only under the terms of the GPL, and not to allow others
  25.  * to use your version of this file under the terms of either the RPSL
  26.  * or RCSL, indicate your decision by deleting the provisions above
  27.  * and replace them with the notice and other provisions required by
  28.  * the GPL. If you do not delete the provisions above, a recipient may
  29.  * use your version of this file under the terms of any one of the
  30.  * RPSL, the RCSL or the GPL.
  31.  * 
  32.  * This file is part of the Helix DNA Technology. RealNetworks is the
  33.  * developer of the Original Code and owns the copyrights in the
  34.  * portions it created.
  35.  * 
  36.  * This file, and the files included with this file, is distributed
  37.  * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
  38.  * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
  39.  * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
  40.  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
  41.  * ENJOYMENT OR NON-INFRINGEMENT.
  42.  * 
  43.  * Technology Compatibility Kit Test Suite(s) Location:
  44.  *    http://www.helixcommunity.org/content/tck
  45.  * 
  46.  * Contributor(s):
  47.  * 
  48.  * ***** END LICENSE BLOCK ***** */
  49. #ifndef FILESPECMAC_CARBON_H
  50. #define FILESPECMAC_CARBON_H
  51. #include "hxstring.h"
  52. // CHXMacInternalSpec is the internal component of CHXFileSpecifier and CHXDirSpecifier
  53. // on the Mac. 
  54. class CHXMacInternalSpec
  55. {
  56. private:
  57. Boolean mbRefSet;
  58. Boolean  mbParentAndLeafSet;
  59. union
  60. {
  61. // if the mItemRef is valid, mbRefSet is true;
  62. // if the mItemParentRef is valid and mpLeafName is specified, mbParentRefSet is true
  63. //
  64. // mpLeafName is a null pointer when it's not needed since it's >512 bytes otherwise
  65. FSRef mItemRef;
  66. struct
  67. {
  68. FSRef  mItemParentRef;
  69. HFSUniStr255 *  mpLeafName;
  70. } mParentAndLeaf;
  71. };
  72. #ifdef _DEBUG
  73. CHXString mStrDebugOnlyPath; // shows path during debugging
  74. const char * mPeekDebugOnlyPath; // easier to see path during debugging
  75. void  UpdateDebugOnlyPath();
  76. #else
  77. inline void  UpdateDebugOnlyPath() {};
  78. #endif
  79. static HX_RESULT StuffHexHandle(Handle hData, Handle hHexHandle);
  80. static HX_RESULT UnstuffHexHandle(Handle hHex, Handle hData);
  81. void InitSpec();
  82. void ClearSpec();
  83. HX_RESULT AllocateLeafName();
  84. static void SplitPath(const char *pPath, char separator, CHXString& outParent, CHXString& outLeaf);
  85. static CHXString MakePersistentStringForRef(const FSRef *pAnchorRef, const FSRef& targetRef);
  86. public:
  87. CHXMacInternalSpec();
  88. CHXMacInternalSpec(const FSSpec& spec);
  89. CHXMacInternalSpec(AliasHandle alis);
  90. CHXMacInternalSpec(const char* psz);
  91. CHXMacInternalSpec(const FSRef& ref);
  92. virtual ~CHXMacInternalSpec();
  93. CHXMacInternalSpec& operator=(CHXMacInternalSpec &other);
  94. BOOL operator==(const CHXMacInternalSpec &other);
  95. BOOL operator!=(const CHXMacInternalSpec &other);
  96. CHXString GetPOSIXPath() const;
  97. HX_RESULT SetFromPOSIXPath(const char *pPosixPath);
  98. CHXString GetHFSPath() const;
  99. HX_RESULT SetFromHFSPath(const char *pHFSPath);
  100. BOOL IsSet() const; // object has been set to a file (which may or may not exist)
  101. void CopyInternalSpec(const CHXMacInternalSpec& otherToBeCopied);
  102. OSErr SetFromPath(const char *pszPath);
  103. OSErr SetFromFSRef(const FSRef& ref);
  104. OSErr SetFromFSSpec(const FSSpec& spec);
  105. OSErr SetFromAlias(AliasHandle alias);
  106. OSErr SetFromParentAndLeaf(const FSRef& parentRef, const char *pszName, CFStringEncoding encoding);
  107. OSErr SetFromParentAndLeafHFSUni(const FSRef& parentRef, const HFSUniStr255& leafName);
  108. OSErr SetFromURL(const char *pBuffer);
  109. void Unset();
  110. CHXString GetPathName() const;
  111. CHXString GetName() const; // get the leaf item name
  112. OSErr GetHFSUniLeafName(HFSUniStr255& uniName) const;
  113. OSErr GetParentDirectoryRef(FSRef &outParentRef) const;
  114. OSErr GetVolumeRef(FSRef& outVolumeRef) const; // get a specifier for the disk
  115. OSErr GetFSRef(FSRef& outRef) const;
  116. OSErr GetFSSpec(FSSpec& outSpec) const;
  117. OSErr GetVRefNum(FSVolumeRefNum& outVRefNum) const;
  118. CHXString GetURL(BOOL isDirectorySpec) const;
  119. CHXString GetPersistentString() const;
  120. CHXString GetRelativePersistentString(const CHXMacInternalSpec& fromFile) const;
  121. HX_RESULT SetFromPersistentString(const char *pBuffer);
  122. };
  123. #endif // FILESPECMAC_CARBON_H