home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWSemEvt / Sources / FWDesc.cpp < prev    next >
Encoding:
Text File  |  1996-08-16  |  36.1 KB  |  1,364 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWDesc.cpp
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWDESC_H
  11. #include "FWDesc.h"
  12. #endif
  13.  
  14. // ----- OS Layer -----
  15.  
  16. #ifndef FWBARRAY_H
  17. #include "FWBArray.h"
  18. #endif
  19.  
  20. #ifndef FWCOLOR_H
  21. #include "FWColor.h"
  22. #endif
  23.  
  24. // ----- Foundation Layer -----
  25.  
  26. #ifndef FWEXCLIB_H
  27. #include "FWExcLib.h"
  28. #endif
  29.  
  30. #ifndef   FWMEMHLP_H
  31. #include "FWMemHlp.h"
  32. #endif
  33.  
  34. #ifndef   FWMEMMGR_H
  35. #include "FWMemMgr.h"
  36. #endif
  37.  
  38. #ifndef FWPSTR_H
  39. #include "FWPStr.h"
  40. #endif
  41.  
  42. #ifndef FWSOMENV_H
  43. #include "FWSOMEnv.h"
  44. #endif
  45.  
  46. // ----- Macintosh Includes -----
  47.  
  48. #ifndef __ASREGISTRY__
  49. #include <ASRegistry.h>
  50. #endif
  51.  
  52. // ----- OpenDoc Includes -----
  53.  
  54. #ifndef SOM_ODObjectSpec_xh
  55. #include <ODObjSpc.xh>
  56. #endif
  57.  
  58. #if defined(__MWERKS__) && GENERATING68K
  59. // A hack to work around a bug
  60. #pragma import list somNewObjectInstance
  61. #endif
  62.  
  63. //========================================================================================
  64. //    Runtime Information
  65. //========================================================================================
  66.  
  67. #ifdef FW_BUILD_MAC    
  68. #pragma segment fwsemevt2
  69. #endif
  70.  
  71. FW_DEFINE_AUTO(FW_CDesc)
  72.  
  73. //========================================================================================
  74. // CLASS FW_CDesc
  75. //========================================================================================
  76.  
  77. //----------------------------------------------------------------------------------------
  78. //    FW_CDesc::FW_CDesc
  79. //
  80. //  Default constructor.
  81. //----------------------------------------------------------------------------------------
  82.  
  83. FW_CDesc::FW_CDesc() :
  84.     fOwnODDesc(TRUE),
  85.     fODDesc(NULL),
  86.     fDataState(FW_kODDataIsStale),
  87.     fODDescType(typeWildCard),
  88.     fODDescTypeValid(FALSE)
  89. {
  90.     fPlatformDesc.descriptorType = typeNull;
  91.     fPlatformDesc.dataHandle = NULL;
  92.  
  93.     FW_END_CONSTRUCTOR
  94. }
  95.  
  96. //----------------------------------------------------------------------------------------
  97. //    FW_CDesc::FW_CDesc
  98. //----------------------------------------------------------------------------------------
  99.  
  100. FW_CDesc::FW_CDesc(const FW_CDesc& copyDesc) :
  101.     fOwnODDesc(TRUE),
  102.     fODDesc(NULL),
  103.     fDataState(FW_kODDataIsStale),
  104.     fODDescType(typeWildCard),
  105.     fODDescTypeValid(FALSE)
  106. {
  107.     fPlatformDesc.descriptorType = typeNull;
  108.     fPlatformDesc.dataHandle = NULL;
  109.  
  110.     ::AEDuplicateDesc(copyDesc, *this);
  111.     
  112.     FW_END_CONSTRUCTOR
  113. }
  114.  
  115. //----------------------------------------------------------------------------------------
  116. //    FW_CDesc::FW_CDesc
  117. //----------------------------------------------------------------------------------------
  118.  
  119. FW_CDesc::FW_CDesc(ODDesc* odDesc) :
  120.     fOwnODDesc(FALSE),
  121.     fODDesc(odDesc),
  122.     fDataState(FW_kPlatformDataIsStale),
  123.     fODDescType(typeWildCard),
  124.     fODDescTypeValid(FALSE)
  125. {
  126.     fPlatformDesc.descriptorType = typeNull;
  127.     fPlatformDesc.dataHandle = NULL;
  128.     
  129.     FW_END_CONSTRUCTOR
  130. }
  131.  
  132. //----------------------------------------------------------------------------------------
  133. //    FW_CDesc::~FW_CDesc
  134. //----------------------------------------------------------------------------------------
  135.  
  136. FW_CDesc::~FW_CDesc()
  137. {
  138.     FW_START_DESTRUCTOR
  139.     PrivDispose();
  140. }
  141.  
  142. //----------------------------------------------------------------------------------------
  143. //    FW_CDesc::Clear
  144. //----------------------------------------------------------------------------------------
  145.  
  146. void FW_CDesc::Clear()
  147. {
  148.     ::AEDisposeDesc(*this);
  149. }
  150.  
  151. //----------------------------------------------------------------------------------------
  152. //    FW_CDesc::CoerceInPlace
  153. //----------------------------------------------------------------------------------------
  154.  
  155. void FW_CDesc::CoerceInPlace(ODDescType toType)
  156. {
  157.     if (DescriptorType() != toType)
  158.         FW_FailOnError(::AECoerceDesc(*this, toType, *this));
  159. }
  160.  
  161. //----------------------------------------------------------------------------------------
  162. //    FW_CDesc::Coerce
  163. //----------------------------------------------------------------------------------------
  164.  
  165. void FW_CDesc::Coerce(ODDescType toType, FW_CDesc& coercedDesc) const
  166. {
  167.     FW_FailOnError(::AECoerceDesc(*this, toType, coercedDesc));
  168. }
  169.  
  170. //----------------------------------------------------------------------------------------
  171. //    FW_CDesc::CreateSimple
  172. //----------------------------------------------------------------------------------------
  173.  
  174. void FW_CDesc::CreateSimple(ODDescType dataType, const void* dataPtr, Size dataSize)
  175. {    
  176.     FW_ASSERT(fPlatformDesc.descriptorType == typeNull);
  177.     FW_FailOnError(::AECreateDesc(dataType, dataPtr, dataSize, *this));
  178. }
  179.  
  180. //----------------------------------------------------------------------------------------
  181. //    FW_CDesc::CreateList
  182. //----------------------------------------------------------------------------------------
  183.  
  184. void FW_CDesc::CreateList(void* commonDataPtr, Size commonDataSize)
  185. {
  186.     FW_ASSERT(fPlatformDesc.descriptorType == typeNull);
  187.     FW_FailOnError(::AECreateList(commonDataPtr, commonDataSize, FALSE, *this));        
  188. }
  189.  
  190. //----------------------------------------------------------------------------------------
  191. //    FW_CDesc::CreateRecord
  192. //----------------------------------------------------------------------------------------
  193.  
  194. void FW_CDesc::CreateRecord(void* commonDataPtr, Size commonDataSize)
  195. {
  196.     FW_ASSERT(fPlatformDesc.descriptorType == typeNull);
  197.     FW_FailOnError(::AECreateList(commonDataPtr, commonDataSize, TRUE, *this));
  198. }
  199.  
  200. //----------------------------------------------------------------------------------------
  201. //    FW_CDesc::DescriptorType
  202. //----------------------------------------------------------------------------------------
  203.  
  204. ODDescType FW_CDesc::DescriptorType() const
  205. {
  206.     ODDescType descriptorType;
  207.     
  208.     if (fODDesc && fDataState == FW_kPlatformDataIsStale)
  209.     {
  210.         if (!fODDescTypeValid)
  211.         {
  212.             FW_CDesc* mutableDesc = (FW_CDesc*)this;
  213.  
  214.             FW_SOMEnvironment ev;
  215.             mutableDesc->fODDescType = fODDesc->GetDescType(ev);
  216.             mutableDesc->fODDescTypeValid = TRUE;
  217.         }
  218.         
  219.         descriptorType = fODDescType;
  220.     }
  221.     else
  222.         descriptorType = fPlatformDesc.descriptorType;
  223.     
  224.     return descriptorType;
  225. }
  226.  
  227. //----------------------------------------------------------------------------------------
  228. //    FW_CDesc::SetDescriptorType
  229. //----------------------------------------------------------------------------------------
  230.  
  231. void FW_CDesc::SetDescriptorType(ODDescType newType)
  232. {
  233.     if (fODDesc && FW_kPlatformDataIsStale)
  234.     {
  235.         FW_SOMEnvironment ev;
  236.         fODDesc->SetDescType(ev, newType);
  237.         fODDescType = newType;
  238.         fODDescTypeValid = TRUE;
  239.     }
  240.     else
  241.     {
  242.         fPlatformDesc.descriptorType = newType;
  243.         PrivPlatformDescChanged();
  244.     }
  245. }
  246.  
  247. //----------------------------------------------------------------------------------------
  248. //    FW_CDesc::PlatformDataHandle
  249. //----------------------------------------------------------------------------------------
  250.  
  251. FW_PlatformHandle FW_CDesc::PlatformDataHandle() const
  252. {
  253.     PrivUpdatePlatformDescIfStale();
  254.     return (fPlatformDesc.dataHandle);
  255. }
  256.  
  257.  
  258. //----------------------------------------------------------------------------------------
  259. //    FW_CDesc::GetDataByPtr
  260. //----------------------------------------------------------------------------------------
  261.  
  262. void FW_CDesc::GetDataByPtr(ODDescType dataType, 
  263.                             void* dataPtr, 
  264.                             Size& dataSize, 
  265.                             Size maxSize, 
  266.                             AEKeyword key) const
  267. {    
  268.     FW_CDesc     coercedDesc;
  269.     FW_Boolean    copyFromOriginal = TRUE;
  270.     
  271.     if (key == keyNoKey)
  272.     {
  273.         if (dataType != typeWildCard && DescriptorType() != dataType)
  274.         {
  275.             Coerce(dataType, coercedDesc);
  276.             copyFromOriginal = FALSE;
  277.         }
  278.     }
  279.     else
  280.     {
  281.         GetDataByDesc(coercedDesc, key);
  282.         copyFromOriginal = FALSE;
  283.     }
  284.     
  285.     FW_PlatformHandle dataHandle = copyFromOriginal ? PlatformDataHandle() 
  286.         : coercedDesc.PlatformDataHandle();
  287.     unsigned long actualSize = FW_CMemoryManager::GetSystemHandleSize(dataHandle);
  288.     
  289.     if (actualSize > maxSize)
  290.         FW_FailOnError(memFullErr);
  291.     else
  292.     {
  293.         FW_CAcquireLockedSystemHandle lock(dataHandle);
  294.         FW_CMemoryManager::CopyMemory(*dataHandle, dataPtr, actualSize);
  295.         dataSize = actualSize;
  296.     }
  297. }
  298.  
  299. //----------------------------------------------------------------------------------------
  300. //    FW_CDesc::PutDataByPtr
  301. //----------------------------------------------------------------------------------------
  302.  
  303. void FW_CDesc::PutDataByPtr(ODDescType dataType, 
  304.                             const void* dataPtr, 
  305.                             Size dataSize, 
  306.                             AEKeyword dataKey)
  307. {    
  308.     if (dataKey == keyNoKey)
  309.     {
  310.         if (IsNullDescriptor())
  311.             CreateSimple(dataType, dataPtr, dataSize);
  312.         else
  313.         {
  314.             if (!IsList())
  315.                 CoerceInPlace(typeAEList);
  316.             FW_FailOnError(::AEPutPtr(*this, 0, dataType, dataPtr, dataSize));
  317.         }
  318.     }
  319.     else
  320.     {
  321.         if (IsNullDescriptor())
  322.             CreateRecord();
  323.         FW_FailOnError(::AEPutKeyPtr(*this, dataKey, dataType, dataPtr, dataSize));
  324.     }
  325. }
  326.  
  327. //----------------------------------------------------------------------------------------
  328. //    FW_CDesc::GetDataByDesc
  329. //----------------------------------------------------------------------------------------
  330.  
  331. void FW_CDesc::GetDataByDesc(FW_CDesc& desc,
  332.                             AEKeyword key, 
  333.                             ODDescType desiredType) const
  334. {
  335.     FW_ASSERT(desc.IsNullDescriptor());
  336.     FW_FailOnError(::AEGetKeyDesc(*this, key, desiredType, desc));
  337. }
  338.  
  339. //----------------------------------------------------------------------------------------
  340. //    FW_CDesc::PutDataByDesc
  341. //----------------------------------------------------------------------------------------
  342.  
  343. void FW_CDesc::PutDataByDesc(const FW_CDesc& desc, AEKeyword key)
  344. {
  345.     if (key == keyNoKey)
  346.     {
  347.         if (IsNullDescriptor())
  348.             *this = desc;
  349.         else
  350.         {
  351.             if (!IsList())
  352.                 CoerceInPlace(typeAEList);
  353.             PutDescIntoList(desc);
  354.         }
  355.     }
  356.     else
  357.     {
  358.         if (IsNullDescriptor())
  359.             CreateRecord();
  360.  
  361.         FW_FailOnError(::AEPutKeyDesc(*this, key, desc));
  362.     }
  363. }
  364.  
  365. //----------------------------------------------------------------------------------------
  366. //    FW_CDesc::GetItemCount
  367. //----------------------------------------------------------------------------------------
  368.  
  369. long FW_CDesc::GetItemCount() const
  370. {
  371.     long itemCount = 0;
  372.     FW_FailOnError(::AECountItems(*this, &itemCount));
  373.     
  374.     return itemCount;
  375. }
  376. //----------------------------------------------------------------------------------------
  377. //    FW_CDesc::GetDescFromList
  378. //----------------------------------------------------------------------------------------
  379.  
  380. void FW_CDesc::GetDescFromList(long index,
  381.                             FW_CDesc& retrievedDesc,
  382.                             ODDescType desiredType) const
  383. {
  384.     AEKeyword unusedKeyword;
  385.     GetDescFromList(index, unusedKeyword, retrievedDesc, desiredType);
  386. }
  387.  
  388. //----------------------------------------------------------------------------------------
  389. //    FW_CDesc::GetDescFromList
  390. //----------------------------------------------------------------------------------------
  391.  
  392. void FW_CDesc::GetDescFromList(long index,
  393.                                 AEKeyword& descKey,
  394.                                 FW_CDesc& retrievedDesc,
  395.                                 ODDescType desiredType) const
  396. {
  397.     FW_ASSERT(retrievedDesc.IsNullDescriptor());
  398.     
  399.     if (index == 1 && !IsList())
  400.     {
  401.         retrievedDesc = *this;
  402.     }
  403.     else            // Note: indexes are 1-based
  404.         FW_FailOnError(::AEGetNthDesc(*this, index, desiredType, &descKey, retrievedDesc));
  405. }
  406.  
  407. //----------------------------------------------------------------------------------------
  408. //    FW_CDesc::PutDescIntoList
  409. //----------------------------------------------------------------------------------------
  410.  
  411. void FW_CDesc::PutDescIntoList(const FW_CDesc& desc, long index)
  412. {
  413.     FW_FailOnError(::AEPutDesc(*this, index, desc));
  414. }
  415.  
  416. //----------------------------------------------------------------------------------------
  417. //    FW_CDesc::HasDataKey
  418. //----------------------------------------------------------------------------------------
  419.  
  420. FW_Boolean FW_CDesc::HasDataKey(AEKeyword key) const
  421. {
  422.     ODDescType     typeCode;
  423.     long        actualSize;
  424.     
  425.     return (::AEGetParamPtr(*this, key, typeWildCard, &typeCode, NULL, 0, &actualSize) == FW_xNoError);
  426. }
  427.  
  428. //----------------------------------------------------------------------------------------
  429. //    FW_CDesc::GetDataInfoByKey
  430. //----------------------------------------------------------------------------------------
  431.  
  432. void FW_CDesc::GetDataInfoByKey(AEKeyword key,
  433.                                 ODDescType& typeCode,
  434.                                 Size& dataSize) const
  435. {
  436.     FW_FailOnError(::AESizeOfKeyDesc(*this, key, &typeCode, &dataSize));
  437. }
  438.  
  439. //----------------------------------------------------------------------------------------
  440. //    FW_CDesc::DeleteListItem
  441. //----------------------------------------------------------------------------------------
  442.  
  443. void FW_CDesc::DeleteListItem(long index)
  444. {
  445.     FW_ASSERT(IsList());
  446.     
  447.     FW_FailOnError(::AEDeleteItem(*this, index));
  448. }
  449.  
  450. //----------------------------------------------------------------------------------------
  451. //    FW_CDesc::DeleteListItem
  452. //----------------------------------------------------------------------------------------
  453.  
  454. void FW_CDesc::DeleteListItem(ODDescType key)
  455. {
  456.     FW_ASSERT(IsList());
  457.     
  458.     FW_FailOnError(::AEDeleteKeyDesc(*this, key));
  459. }
  460.  
  461. //----------------------------------------------------------------------------------------
  462. //    FW_CDesc::GetEnumeratedType
  463. //----------------------------------------------------------------------------------------
  464.  
  465. ODDescType FW_CDesc::GetEnumeratedType(AEKeyword key) const
  466. {
  467.     ODDescType     value;
  468.     Size        dataSize;
  469.     
  470.     GetDataByPtr(typeEnumerated, &value, dataSize, sizeof(ODDescType), key);
  471.     return value;
  472. }
  473.  
  474. //----------------------------------------------------------------------------------------
  475. //    FW_CDesc::PutEnumeratedType
  476. //----------------------------------------------------------------------------------------
  477.  
  478. void FW_CDesc::PutEnumeratedType(ODDescType value, AEKeyword key)
  479. {
  480.     PutDataByPtr(typeEnumerated, &value, sizeof(ODDescType), key);
  481. }
  482. //----------------------------------------------------------------------------------------
  483. //    FW_CDesc::GetAbsoluteOrdinal
  484. //----------------------------------------------------------------------------------------
  485.  
  486. ODDescType FW_CDesc::GetAbsoluteOrdinal(AEKeyword key) const
  487. {
  488.     ODDescType     value;
  489.     Size        dataSize;
  490.     
  491.     GetDataByPtr(typeAbsoluteOrdinal, &value, dataSize, sizeof(ODDescType), key);
  492.     return value;
  493. }
  494.  
  495. //----------------------------------------------------------------------------------------
  496. //    FW_CDesc::PutAbsoluteOrdinal
  497. //----------------------------------------------------------------------------------------
  498.  
  499. void FW_CDesc::PutAbsoluteOrdinal(ODDescType value, AEKeyword key)
  500. {
  501.     PutDataByPtr(typeAbsoluteOrdinal, &value, sizeof(ODDescType), key);
  502. }
  503.  
  504. //----------------------------------------------------------------------------------------
  505. //    FW_CDesc::GetType
  506. //----------------------------------------------------------------------------------------
  507.  
  508. ODDescType FW_CDesc::GetType(AEKeyword key) const
  509. {
  510.     ODDescType     value;
  511.     Size        dataSize;
  512.     
  513.     GetDataByPtr(typeType, &value, dataSize, sizeof(ODDescType), key);
  514.     return value;
  515. }
  516.  
  517. //----------------------------------------------------------------------------------------
  518. //    FW_CDesc::PutType
  519. //----------------------------------------------------------------------------------------
  520.  
  521. void FW_CDesc::PutType(ODDescType value, AEKeyword key)
  522. {
  523.     PutDataByPtr(typeType, &value, sizeof(ODDescType), key);
  524. }
  525.  
  526. //----------------------------------------------------------------------------------------
  527. //    FW_CDesc::GetBoolean
  528. //----------------------------------------------------------------------------------------
  529.  
  530. FW_Boolean FW_CDesc::GetBoolean(AEKeyword key) const
  531. {
  532.     FW_Boolean     value;
  533.     Size        dataSize;
  534.     
  535.     GetDataByPtr(typeBoolean, &value, dataSize, sizeof(FW_Boolean), key);
  536.     return value;
  537. }
  538.  
  539. //----------------------------------------------------------------------------------------
  540. //    FW_CDesc::PutBoolean
  541. //----------------------------------------------------------------------------------------
  542.  
  543. void FW_CDesc::PutBoolean(FW_Boolean value, AEKeyword key)
  544. {    
  545.     PutDataByPtr(typeBoolean, &value, sizeof(FW_Boolean), key);
  546. }
  547.  
  548. //----------------------------------------------------------------------------------------
  549. //    FW_CDesc::GetLongInteger
  550. //----------------------------------------------------------------------------------------
  551.  
  552. long FW_CDesc::GetLongInteger(AEKeyword key) const
  553. {
  554.     long    value;
  555.     Size    dataSize;
  556.     
  557.     GetDataByPtr(typeLongInteger, &value, dataSize, sizeof(long), key);
  558.     return value;
  559. }
  560.  
  561. //----------------------------------------------------------------------------------------
  562. //    FW_CDesc::PutLongInteger
  563. //----------------------------------------------------------------------------------------
  564.  
  565. void FW_CDesc::PutLongInteger(long value, AEKeyword key)
  566. {
  567.     PutDataByPtr(typeLongInteger, &value, sizeof(long), key);
  568. }
  569.  
  570. //----------------------------------------------------------------------------------------
  571. //    FW_CDesc::GetShortInteger
  572. //----------------------------------------------------------------------------------------
  573.  
  574. short FW_CDesc::GetShortInteger(AEKeyword key) const
  575. {    
  576.     short    value;
  577.     Size    dataSize;
  578.     
  579.     GetDataByPtr(typeShortInteger, &value, dataSize, sizeof(short), key);
  580.     return value;
  581. }
  582.  
  583. //----------------------------------------------------------------------------------------
  584. //    FW_CDesc::GetString
  585. //----------------------------------------------------------------------------------------
  586.  
  587. void FW_CDesc::GetString(FW_CString& string, AEKeyword key) const
  588. {
  589.     FW_CDesc     secondaryDesc;
  590.     FW_Boolean    copyFromThis = TRUE;
  591.     
  592.     if (key != keyNoKey)
  593.     {
  594.         GetDataByDesc(secondaryDesc, key, typeChar);
  595.         copyFromThis = FALSE;
  596.     }
  597.     else if (DescriptorType() != typeChar)
  598.     {
  599.         Coerce(typeChar, secondaryDesc);
  600.         copyFromThis = FALSE;
  601.     }
  602.  
  603.     FW_PlatformHandle dataHandle = copyFromThis ? PlatformDataHandle() : secondaryDesc.PlatformDataHandle();
  604.     
  605.     FW_CAcquireLockedSystemHandle lock(dataHandle);
  606.     string.ReplaceAll(*dataHandle, FW_CMemoryManager::GetSystemHandleSize(dataHandle));
  607. }
  608.  
  609. //----------------------------------------------------------------------------------------
  610. //    FW_CDesc::PutString
  611. //----------------------------------------------------------------------------------------
  612.  
  613. void FW_CDesc::PutString(const FW_CString& string, AEKeyword key)
  614. {
  615.     PutDataByPtr(typeChar, string.RevealBuffer(), string.GetByteLength(), key);
  616. }
  617.  
  618. //----------------------------------------------------------------------------------------
  619. //    FW_CDesc::GetColor
  620. //----------------------------------------------------------------------------------------
  621.  
  622. void FW_CDesc::GetColor(FW_CColor& color, AEKeyword key) const
  623. {
  624.     RGBColor     platformColor;
  625.     Size        actualSize;
  626.     
  627.     GetDataByPtr(typeRGBColor, &platformColor, actualSize, sizeof(RGBColor), key);
  628.     color = platformColor;
  629. }
  630.  
  631. //----------------------------------------------------------------------------------------
  632. //    FW_CDesc::PutColor
  633. //----------------------------------------------------------------------------------------
  634.  
  635. void FW_CDesc::PutColor(const FW_CColor& color, AEKeyword key)
  636. {
  637.     RGBColor platformColor = color;
  638.     PutDataByPtr(typeRGBColor, &platformColor, sizeof(RGBColor), key);
  639. }
  640.  
  641. //----------------------------------------------------------------------------------------
  642. //    FW_CDesc::GetPoint
  643. //----------------------------------------------------------------------------------------
  644.  
  645. FW_SPlatformPoint FW_CDesc::GetPoint(AEKeyword key) const
  646. {
  647.     FW_SPlatformPoint thePoint;
  648.     Size actualSize;
  649.     
  650.     GetDataByPtr(typeQDPoint, &thePoint, actualSize, sizeof(FW_SPlatformPoint), key);
  651.     return thePoint;
  652. }
  653.  
  654. //----------------------------------------------------------------------------------------
  655. //    FW_CDesc::PutPoint
  656. //----------------------------------------------------------------------------------------
  657.  
  658. void FW_CDesc::PutPoint(FW_SPlatformPoint thePoint, AEKeyword key)
  659. {
  660.     PutDataByPtr(typeQDPoint, &thePoint, sizeof(FW_SPlatformPoint), key);
  661. }
  662.  
  663. //----------------------------------------------------------------------------------------
  664. //    FW_CDesc::Compare(const FW_CDesc& other, const ODDescType operation)
  665. //----------------------------------------------------------------------------------------
  666.  
  667. FW_Boolean FW_CDesc::Compare(ODDescType operation, const FW_CDesc& other) const
  668. {
  669.     if (this == &other)    // compare to self
  670.     {
  671.         switch (operation)
  672.         {
  673.             case kAEEquals:
  674.             case kAEGreaterThanEquals:
  675.             case kAELessThanEquals:
  676.             case kAEBeginsWith:
  677.             case kAEEndsWith:
  678.             case kAEContains:
  679.                 return TRUE;
  680.                 break;
  681.                 
  682.             case kASNotEqual:
  683.             case kAEGreaterThan:
  684.             case kAELessThan:
  685.                 return FALSE;
  686.                 break;
  687.             
  688.             default:
  689.                 FW_THROW(FW_XException(errAEEventNotHandled));
  690.                 break;
  691.         }
  692.     }
  693.     
  694.     FW_CDesc         secondaryDesc;
  695.     const FW_CDesc*    lhDesc = this;
  696.     const FW_CDesc*    rhDesc = &other;
  697.     FW_Boolean         result = TRUE;
  698.     
  699.     if (DescriptorType() != other.DescriptorType())    // coerce to common type
  700.     {
  701.         if (AECoerceDesc(other, DescriptorType(), secondaryDesc) == noErr)
  702.             rhDesc = &secondaryDesc;
  703.         else if (AECoerceDesc(*this, other.DescriptorType(), secondaryDesc) == noErr)
  704.             lhDesc = &secondaryDesc;
  705.         else
  706.             return FALSE;
  707.     }
  708.     
  709.     if (lhDesc->IsList())
  710.     {
  711.         result = PrivCompareLists(operation, *lhDesc, *rhDesc);
  712.     }
  713.     else
  714.     {
  715.         switch (lhDesc->DescriptorType())
  716.         {
  717.             long lhLong;
  718.             long rhLong;
  719.             
  720.             case typeEnumerated:
  721.                 lhLong = (long)lhDesc->GetEnumeratedType();
  722.                 rhLong = (long)rhDesc->GetEnumeratedType();
  723.                 result = PrivCompareLongs(operation, lhLong, rhLong);
  724.                 break;
  725.                 
  726.             case typeType:
  727.                 lhLong = (long)lhDesc->GetType();
  728.                 rhLong = (long)rhDesc->GetType();
  729.                 result = PrivCompareLongs(operation, lhLong, rhLong);
  730.                 break;
  731.                 
  732.             case typeBoolean:
  733.                 lhLong = (long)lhDesc->GetBoolean();
  734.                 rhLong = (long)rhDesc->GetBoolean();
  735.                 result = PrivCompareLongs(operation, lhLong, rhLong);
  736.                 break;
  737.                 
  738.             case typeLongInteger:
  739.             case typeShortInteger:
  740.                 lhLong = lhDesc->GetLongInteger();
  741.                 rhLong = rhDesc->GetLongInteger();
  742.                 result = PrivCompareLongs(operation, lhLong, rhLong);
  743.                 break;
  744.                 
  745.             case typeChar:
  746.                 {
  747.                     FW_CString lhString;
  748.                     FW_CString rhString;
  749.                     lhDesc->GetString(lhString);
  750.                     rhDesc->GetString(rhString);
  751.                     result = PrivCompareStrings(operation, lhString, rhString);
  752.                 }
  753.                 break;
  754.             
  755.             case typeRGBColor:
  756.                 {
  757.                     FW_CColor lhColor;
  758.                     FW_CColor rhColor;
  759.                     lhDesc->GetColor(lhColor);
  760.                     rhDesc->GetColor(rhColor);
  761.                     result = PrivCompareColors(operation, lhColor, rhColor);
  762.                 }
  763.                 break;
  764.                 
  765.             default:
  766.                 result = PrivCompareData(operation, *lhDesc, *rhDesc);
  767.                 break;
  768.         }
  769.     }
  770.     
  771.     return result;
  772. }
  773.  
  774. //----------------------------------------------------------------------------------------
  775. //    FW_CDesc::operator=(const FW_CDesc& other)
  776. //----------------------------------------------------------------------------------------
  777.  
  778. FW_CDesc& FW_CDesc::operator=(const FW_CDesc& other)
  779. {
  780.     if (this == &other)
  781.         return *this;
  782.     
  783.     PrivFlushData();
  784.     FW_FailOnError(::AEDuplicateDesc(other, *this));
  785.     
  786.     return (*this);
  787. }
  788.  
  789. //----------------------------------------------------------------------------------------
  790. //    AEDesc& FW_CDesc::operator const AEDesc&
  791. //----------------------------------------------------------------------------------------
  792.  
  793. FW_CDesc::operator const AEDesc&() const
  794. {
  795.     PrivUpdatePlatformDescIfStale();
  796.     return fPlatformDesc;
  797. }
  798.  
  799. //----------------------------------------------------------------------------------------
  800. //    FW_CDesc::operator AEDesc* const
  801. //----------------------------------------------------------------------------------------
  802.  
  803. FW_CDesc::operator AEDesc*() const
  804. {
  805.     PrivUpdatePlatformDescIfStale();
  806.     PrivPlatformDescChanged();    // non-const access might change data
  807.     return PrivGetPlatformDescPtr();
  808. }
  809.  
  810. //----------------------------------------------------------------------------------------
  811. //    FW_CDesc::operator const AEDesc*
  812. //----------------------------------------------------------------------------------------
  813.  
  814. FW_CDesc::operator const AEDesc*() const
  815. {
  816.     PrivUpdatePlatformDescIfStale();
  817.     return (AEDesc*)&fPlatformDesc;
  818. }
  819.  
  820. //----------------------------------------------------------------------------------------
  821. //    FW_CDesc::operator ODDesc*
  822. //----------------------------------------------------------------------------------------
  823.  
  824. FW_CDesc::operator ODDesc*() const
  825. {
  826.     PrivUpdateODDescIfStale();
  827.     PrivODDescChanged();
  828.     return fODDesc;
  829. }
  830.  
  831. //----------------------------------------------------------------------------------------
  832. //    FW_CDesc::operator ODObjectSpec*
  833. //----------------------------------------------------------------------------------------
  834.  
  835. FW_CDesc::operator ODObjectSpec*() const
  836. {
  837.     PrivUpdateODDescIfStale();
  838.     PrivODDescChanged();
  839.     return (ODObjectSpec*)fODDesc;
  840. }
  841.  
  842. //----------------------------------------------------------------------------------------
  843. //    FW_CDesc::operator ODOSLToken*
  844. //----------------------------------------------------------------------------------------
  845.  
  846. FW_CDesc::operator ODOSLToken*() const
  847. {
  848.     PrivUpdateODDescIfStale();
  849.     PrivODDescChanged();
  850.     return (ODOSLToken*)fODDesc;
  851. }
  852.  
  853. //----------------------------------------------------------------------------------------
  854. //    FW_CDesc::operator ODAddressDesc*
  855. //----------------------------------------------------------------------------------------
  856.  
  857. FW_CDesc::operator ODAddressDesc*() const
  858. {
  859.     PrivUpdateODDescIfStale();
  860.     PrivODDescChanged();
  861.     return (ODAddressDesc*)fODDesc;
  862. }
  863.  
  864. //----------------------------------------------------------------------------------------
  865. //    FW_CDesc::operator ODAddressDesc**
  866. //----------------------------------------------------------------------------------------
  867.  
  868. FW_CDesc::operator ODAddressDesc**()
  869. {
  870.     PrivDispose();
  871.     PrivODDescChanged();
  872.     return (ODAddressDesc**)&fODDesc;
  873. }
  874.  
  875. //----------------------------------------------------------------------------------------
  876. //    FW_CDesc::PrivCompareLists
  877. //----------------------------------------------------------------------------------------
  878.  
  879. FW_Boolean FW_CDesc::PrivCompareLists(ODDescType operation,
  880.                                     const FW_CDesc& lhDesc,
  881.                                     const FW_CDesc& rhDesc) const
  882. {
  883.     FW_Boolean result = TRUE;
  884.     FW_Boolean resultConclusive = FALSE;
  885.     
  886.     long     maxToCompare;
  887.     long    lhIndex = 1;
  888.     
  889.     switch(operation)
  890.     {
  891.         case kAEEquals:
  892.             maxToCompare = lhDesc.GetItemCount();
  893.             if (maxToCompare != rhDesc.GetItemCount())
  894.             {
  895.                 result = FALSE;
  896.                 resultConclusive = TRUE;
  897.             }
  898.             break;
  899.             
  900.         case kASNotEqual:
  901.             maxToCompare = lhDesc.GetItemCount();
  902.             if (maxToCompare != rhDesc.GetItemCount())
  903.             {
  904.                 result = TRUE;
  905.                 resultConclusive = TRUE;
  906.             }
  907.             break;
  908.             
  909.         case kAEBeginsWith:
  910.             maxToCompare = rhDesc.GetItemCount();
  911.             if (maxToCompare > lhDesc.GetItemCount())
  912.             {
  913.                 result = FALSE;
  914.                 resultConclusive = TRUE;
  915.             }
  916.             break;
  917.             
  918.         case kAEEndsWith:
  919.             maxToCompare = rhDesc.GetItemCount();
  920.             if (maxToCompare > lhDesc.GetItemCount())
  921.             {
  922.                 result = FALSE;
  923.                 resultConclusive = TRUE;
  924.             }
  925.             else
  926.                 lhIndex = lhDesc.GetItemCount() - maxToCompare + 1;
  927.             break;
  928.                     
  929.         default:
  930.             result = FALSE;
  931.             resultConclusive = TRUE;
  932.             break;
  933.     }
  934.     
  935.     if (!resultConclusive)
  936.     {
  937.         FW_CDesc lhTestDesc;
  938.         FW_CDesc rhTestDesc;
  939.         
  940.         for (long rhIndex = 1; rhIndex <= maxToCompare && result; lhIndex++, rhIndex++)
  941.         {
  942.             lhDesc.GetDescFromList(lhIndex, lhTestDesc);
  943.             rhDesc.GetDescFromList(rhIndex, rhTestDesc);
  944.             
  945.             result = lhTestDesc.Compare(operation, rhTestDesc);
  946.             
  947.             lhTestDesc.Clear();
  948.             rhTestDesc.Clear();
  949.         }
  950.     }
  951.     
  952.     return result;
  953. }
  954.  
  955. //----------------------------------------------------------------------------------------
  956. //    FW_CDesc::PrivCompareLongs
  957. //----------------------------------------------------------------------------------------
  958.  
  959. FW_Boolean FW_CDesc::PrivCompareLongs(ODDescType operation, 
  960.                                     long lhs, 
  961.                                     long rhs) const
  962. {
  963.     FW_Boolean result;
  964.     
  965.     switch (operation)
  966.     {
  967.         case kAEEquals:
  968.             result = (lhs == rhs);
  969.             break;
  970.             
  971.         case kASNotEqual:
  972.             result = (lhs != rhs);
  973.             break;
  974.             
  975.         case kAEGreaterThanEquals:
  976.             result = (lhs >= rhs);
  977.             break;
  978.         
  979.         case kAEGreaterThan:
  980.             result = (lhs > rhs);
  981.             break;
  982.             
  983.         case kAELessThanEquals:
  984.             result = (lhs <= rhs);
  985.             break;
  986.             
  987.         case kAELessThan:
  988.             result = (lhs < rhs);
  989.             break;
  990.             
  991.         default:
  992.             FW_THROW(FW_XException(errAEEventNotHandled));
  993.             break;
  994.     }
  995.     
  996.     return result;
  997. }
  998.  
  999. //----------------------------------------------------------------------------------------
  1000. //    FW_CDesc::PrivCompareStrings
  1001. //----------------------------------------------------------------------------------------
  1002.  
  1003. FW_Boolean FW_CDesc::PrivCompareStrings(ODDescType operation,
  1004.                                         const FW_CString& lhs, 
  1005.                                         const FW_CString& rhs) const
  1006. {
  1007.     FW_Boolean result;
  1008.     
  1009.     switch (operation)
  1010.     {
  1011.         FW_BytePosition    foundPosition;
  1012.         
  1013.         case kAEEquals:
  1014.             result = (lhs == rhs);
  1015.             break;
  1016.             
  1017.         case kASNotEqual:
  1018.             result = (lhs != rhs);
  1019.             break;
  1020.             
  1021.         case kAEGreaterThan:
  1022.             result = (lhs > rhs);
  1023.             break;
  1024.             
  1025.         case kAEGreaterThanEquals:
  1026.             result = (lhs >= rhs);
  1027.             break;
  1028.             
  1029.         case kAELessThan:
  1030.             result = (lhs < rhs);
  1031.             break;
  1032.             
  1033.         case kAELessThanEquals:
  1034.             result = (lhs <= rhs);
  1035.             break;
  1036.             
  1037.         case kAEBeginsWith:
  1038.             lhs.FindSubString(rhs, foundPosition);
  1039.             result = (foundPosition == 1);
  1040.             break;
  1041.             
  1042.         case kAEEndsWith:
  1043.             lhs.FindSubString(rhs, foundPosition);
  1044.             result = ((foundPosition > 0) && 
  1045.                 (foundPosition == (lhs.GetByteLength() - rhs.GetByteLength())));
  1046.             break;
  1047.             
  1048.         case kAEContains:
  1049.             lhs.FindSubString(rhs, foundPosition);
  1050.             result = (foundPosition > 0);
  1051.             break;
  1052.                                                 
  1053.         default:
  1054.             FW_THROW(FW_XException(errAEEventNotHandled));
  1055.             break;
  1056.     }
  1057.     
  1058.     return result;
  1059. }
  1060.  
  1061. //----------------------------------------------------------------------------------------
  1062. //    FW_CDesc::PrivCompareColors
  1063. //----------------------------------------------------------------------------------------
  1064.  
  1065. FW_Boolean FW_CDesc::PrivCompareColors(ODDescType operation,
  1066.                                     const FW_CColor& lhs, 
  1067.                                     const FW_CColor& rhs) const
  1068. {
  1069.     FW_Boolean result;
  1070.     
  1071.     switch (operation)
  1072.     {
  1073.         case kAEEquals:
  1074.             result = (lhs == rhs);
  1075.             break;
  1076.             
  1077.         case kASNotEqual:
  1078.             result = (lhs != rhs);
  1079.             break;
  1080.             
  1081.         case kAEGreaterThan:
  1082.             result = lhs.IsLighterThan(rhs);
  1083.             break;
  1084.             
  1085.         case kAEGreaterThanEquals:
  1086.             result = (lhs == rhs || lhs.IsLighterThan(rhs));
  1087.             break;
  1088.             
  1089.         case kAELessThan:
  1090.             result = lhs.IsDarkerThan(rhs);
  1091.             break;
  1092.             
  1093.         case kAELessThanEquals:
  1094.             result = (lhs == rhs || lhs.IsDarkerThan(rhs));
  1095.             break;
  1096.  
  1097.         default:
  1098.             FW_THROW(FW_XException(errAEEventNotHandled));
  1099.             break;
  1100.     }
  1101.     return result;
  1102. }
  1103. //----------------------------------------------------------------------------------------
  1104. //    FW_CDesc::PrivCompareData
  1105. //----------------------------------------------------------------------------------------
  1106.  
  1107. FW_Boolean FW_CDesc::PrivCompareData(ODDescType operation,
  1108.                                     const FW_CDesc& lhDesc,
  1109.                                     const FW_CDesc& rhDesc) const
  1110. {
  1111.     
  1112.     long lhDataSize = FW_CMemoryManager::GetSystemHandleSize(lhDesc.PlatformDataHandle());
  1113.     long rhDataSize = FW_CMemoryManager::GetSystemHandleSize(rhDesc.PlatformDataHandle());
  1114.  
  1115.     FW_CAcquireLockedSystemHandle lhLock(lhDesc.PlatformDataHandle());
  1116.     FW_CAcquireLockedSystemHandle rhLock(rhDesc.PlatformDataHandle());
  1117.  
  1118.     const char* lhData = *lhDesc.PlatformDataHandle();
  1119.     const char* rhData = *rhDesc.PlatformDataHandle();
  1120.  
  1121.     long bytesToCompare;
  1122.  
  1123.     FW_Boolean result = TRUE;
  1124.     FW_Boolean resultConclusive = FALSE;
  1125.  
  1126.     switch (operation)
  1127.     {
  1128.         case kAEEquals:
  1129.             bytesToCompare = lhDataSize;
  1130.             if (bytesToCompare != rhDataSize)
  1131.             {
  1132.                 result = FALSE;
  1133.                 resultConclusive = TRUE;
  1134.             }
  1135.             break;
  1136.             
  1137.         case kASNotEqual:
  1138.             bytesToCompare = lhDataSize;
  1139.             if (bytesToCompare != rhDataSize)
  1140.             {
  1141.                 result = TRUE;
  1142.                 resultConclusive = TRUE;
  1143.             }
  1144.             break;
  1145.             
  1146.         case kAEBeginsWith:
  1147.             bytesToCompare = rhDataSize;
  1148.             if (bytesToCompare > lhDataSize)
  1149.             {
  1150.                 result = FALSE;
  1151.                 resultConclusive = TRUE;
  1152.             }
  1153.             break;
  1154.             
  1155.         case kAEEndsWith:
  1156.             bytesToCompare = rhDataSize;
  1157.             if (bytesToCompare > lhDataSize)
  1158.             {
  1159.                 result = FALSE;
  1160.                 resultConclusive = TRUE;
  1161.             }
  1162.             else
  1163.                 lhData = (*lhDesc.PlatformDataHandle()) + lhDataSize - bytesToCompare;
  1164.             break;
  1165.             
  1166.         default:
  1167.             result = FALSE;
  1168.             resultConclusive = FALSE;
  1169.             break;
  1170.     }
  1171.         
  1172.     while (bytesToCompare && !resultConclusive)
  1173.     {
  1174.         switch (operation)
  1175.         {
  1176.             case kAEEquals:
  1177.             case kAEBeginsWith:
  1178.             case kAEEndsWith:
  1179.                 result = (*lhData == *rhData);
  1180.                 if (!result)
  1181.                     resultConclusive = TRUE;
  1182.                 break;
  1183.             
  1184.             case kASNotEqual:
  1185.                 result = (*lhData != *rhData);
  1186.                 if (result)
  1187.                     resultConclusive = TRUE;
  1188.                 break;
  1189.                 
  1190.             case kAEGreaterThan:
  1191.                 result = *lhData > *rhData;
  1192.                 if (!result)
  1193.                     resultConclusive = TRUE;
  1194.                 break;
  1195.                 
  1196.             case kAEGreaterThanEquals:
  1197.                 result = *lhData >= *rhData;
  1198.                 if (!result)
  1199.                     resultConclusive = TRUE;
  1200.                 break;
  1201.                 
  1202.             case kAELessThan:
  1203.                 result = *lhData < *rhData;
  1204.                 if (!result)
  1205.                     resultConclusive = TRUE;
  1206.                 break;
  1207.                 
  1208.             case kAELessThanEquals:
  1209.                 result = *lhData <= *rhData;
  1210.                 if (!result)
  1211.                     resultConclusive = TRUE;
  1212.                 break;
  1213.             
  1214.             default:
  1215.                 result = FALSE;
  1216.                 resultConclusive = TRUE;
  1217.         }
  1218.         
  1219.         lhData++;
  1220.         rhData++;
  1221.         bytesToCompare--;
  1222.     }
  1223.     return result;
  1224. }
  1225.  
  1226. //----------------------------------------------------------------------------------------
  1227. //    FW_CDesc::PrivFlushPlatformData
  1228. //----------------------------------------------------------------------------------------
  1229.  
  1230. void FW_CDesc::PrivFlushPlatformData() const
  1231. {
  1232.     FW_CDesc* mutableDesc = (FW_CDesc*)this;
  1233.     
  1234.     if ((fPlatformDesc.descriptorType != typeNull) || (fPlatformDesc.dataHandle != NULL))
  1235.         ::AEDisposeDesc(*mutableDesc);
  1236. }
  1237.  
  1238. //----------------------------------------------------------------------------------------
  1239. //    FW_CDesc::PrivFlushODData
  1240. //----------------------------------------------------------------------------------------
  1241.  
  1242. void FW_CDesc::PrivFlushODData() const
  1243. {
  1244.     if (fODDesc)
  1245.     {
  1246.         FW_CByteArray        byteArray;
  1247.         FW_SOMEnvironment    ev;                
  1248.         
  1249.         byteArray.Set(NULL, 0);
  1250.         fODDesc->SetRawData(ev, byteArray);
  1251.         fODDesc->SetDescType(ev, typeNull);
  1252.     }
  1253. }
  1254.  
  1255. //----------------------------------------------------------------------------------------
  1256. //    FW_CDesc::PrivFlushData
  1257. //----------------------------------------------------------------------------------------
  1258.  
  1259. void FW_CDesc::PrivFlushData()
  1260. {
  1261.     PrivFlushPlatformData();
  1262.     PrivFlushODData();
  1263.         
  1264.     fDataState = FW_kPlatformMatchesOD;
  1265. }
  1266.  
  1267. //----------------------------------------------------------------------------------------
  1268. //    FW_CDesc::PrivDispose
  1269. //----------------------------------------------------------------------------------------
  1270.  
  1271. void FW_CDesc::PrivDispose()
  1272. {
  1273.     if (fODDesc)
  1274.     {
  1275.         if (fOwnODDesc)
  1276.             delete fODDesc;
  1277.         else
  1278.             PrivUpdateODDescIfStale();
  1279.         
  1280.         fODDesc = NULL;
  1281.         fOwnODDesc = TRUE;
  1282.     }
  1283.     
  1284.     fDataState = FW_kPlatformMatchesOD;
  1285.  
  1286.     PrivFlushPlatformData();
  1287.     
  1288. }
  1289.  
  1290. //----------------------------------------------------------------------------------------
  1291. //    FW_CDesc::PrivUpdatePlatformDesc
  1292. //----------------------------------------------------------------------------------------
  1293.  
  1294. void FW_CDesc::PrivUpdatePlatformDesc() const
  1295. {
  1296.     FW_ASSERT(fODDesc);
  1297.     
  1298.     FW_CDesc*            mutableDesc = (FW_CDesc*)this;
  1299.     FW_SOMEnvironment    ev;
  1300.     ODDescType            odDescType = fODDesc->GetDescType(ev);
  1301.     
  1302.     mutableDesc->fDataState = FW_kSynchronizing;
  1303.  
  1304.     PrivFlushPlatformData();
  1305.         
  1306.     if (odDescType != typeNull)
  1307.     {
  1308.         ODByteArray byteArray;
  1309.         byteArray = fODDesc->GetRawData(ev); 
  1310.             // use a temporary type to prevent redundant list/record
  1311.             // header info from being generated when AECreateDesc is called
  1312.         mutableDesc->CreateSimple('greg', byteArray._buffer, byteArray._length);
  1313.         mutableDesc->fPlatformDesc.descriptorType = odDescType;
  1314.     }
  1315.     
  1316.     mutableDesc->fDataState = FW_kPlatformMatchesOD;
  1317. }
  1318.  
  1319. //----------------------------------------------------------------------------------------
  1320. //    FW_CDesc::PrivUpdateODDesc
  1321. //----------------------------------------------------------------------------------------
  1322.  
  1323. void FW_CDesc::PrivUpdateODDesc() const
  1324. {
  1325.     
  1326.     FW_CByteArray        byteArray;
  1327.     FW_CDesc*            mutableDesc = (FW_CDesc*)this;
  1328.     FW_SOMEnvironment    ev;                
  1329.  
  1330.     mutableDesc->fDataState = FW_kSynchronizing;
  1331.     
  1332.     PrivFlushODData();
  1333.     
  1334.     if (!fODDesc)
  1335.         mutableDesc->fODDesc = PrivCreateODDesc(ev);
  1336.     
  1337.     if (fPlatformDesc.descriptorType != typeNull)
  1338.         fODDesc->SetDescType(ev, fPlatformDesc.descriptorType);
  1339.             
  1340.     if (fPlatformDesc.dataHandle != NULL)
  1341.     {
  1342.         FW_CAcquireLockedSystemHandle lock(fPlatformDesc.dataHandle);
  1343.         byteArray.Set(*fPlatformDesc.dataHandle, FW_CMemoryManager::GetSystemHandleSize(fPlatformDesc.dataHandle));
  1344.         fODDesc->SetRawData(ev, byteArray);
  1345.     }
  1346.     else
  1347.         fODDesc->SetRawData(ev, byteArray);
  1348.     
  1349.     mutableDesc->fODDescType = fPlatformDesc.descriptorType;
  1350.     mutableDesc->fODDescTypeValid = TRUE;
  1351.     mutableDesc->fDataState = FW_kPlatformMatchesOD;
  1352. }
  1353.  
  1354. //----------------------------------------------------------------------------------------
  1355. //    FW_CDesc::PrivCreateODDesc
  1356. //----------------------------------------------------------------------------------------
  1357.  
  1358. ODDesc* FW_CDesc::PrivCreateODDesc(Environment* ev) const
  1359. {    
  1360.     ODDesc* odDesc = new ODDesc;
  1361.     odDesc->InitODDesc(ev);
  1362.     
  1363.     return odDesc;
  1364. }