DISTRHO Plugin Framework
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

789 lines
17KB

  1. /* Copyright © 2007 Apple Inc. All Rights Reserved.
  2. Disclaimer: IMPORTANT: This Apple software is supplied to you by
  3. Apple Inc. ("Apple") in consideration of your agreement to the
  4. following terms, and your use, installation, modification or
  5. redistribution of this Apple software constitutes acceptance of these
  6. terms. If you do not agree with these terms, please do not use,
  7. install, modify or redistribute this Apple software.
  8. In consideration of your agreement to abide by the following terms, and
  9. subject to these terms, Apple grants you a personal, non-exclusive
  10. license, under Apple's copyrights in this original Apple software (the
  11. "Apple Software"), to use, reproduce, modify and redistribute the Apple
  12. Software, with or without modifications, in source and/or binary forms;
  13. provided that if you redistribute the Apple Software in its entirety and
  14. without modifications, you must retain this notice and the following
  15. text and disclaimers in all such redistributions of the Apple Software.
  16. Neither the name, trademarks, service marks or logos of Apple Inc.
  17. may be used to endorse or promote products derived from the Apple
  18. Software without specific prior written permission from Apple. Except
  19. as expressly stated in this notice, no other rights or licenses, express
  20. or implied, are granted by Apple herein, including but not limited to
  21. any patent rights that may be infringed by your derivative works or by
  22. other works in which the Apple Software may be incorporated.
  23. The Apple Software is provided by Apple on an "AS IS" basis. APPLE
  24. MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
  25. THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
  26. FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
  27. OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
  28. IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
  29. OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  30. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  31. INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
  32. MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
  33. AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
  34. STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
  35. POSSIBILITY OF SUCH DAMAGE.
  36. */
  37. //=============================================================================
  38. // Includes
  39. //=============================================================================
  40. // Self Include
  41. #include "CACFArray.h"
  42. // PublicUtility Includes
  43. #include "CACFDictionary.h"
  44. #include "CACFNumber.h"
  45. #include "CACFString.h"
  46. //=============================================================================
  47. // CACFArray
  48. //=============================================================================
  49. bool CACFArray::HasItem(const void* inItem) const
  50. {
  51. bool theAnswer = false;
  52. if(mCFArray != NULL)
  53. {
  54. CFRange theRange = { 0, CFArrayGetCount(mCFArray)};
  55. theAnswer = CFArrayContainsValue(mCFArray, theRange, inItem);
  56. }
  57. return theAnswer;
  58. }
  59. bool CACFArray::GetIndexOfItem(const void* inItem, UInt32& outIndex) const
  60. {
  61. bool theAnswer = false;
  62. outIndex = 0;
  63. if(mCFArray != NULL)
  64. {
  65. CFRange theRange = { 0, CFArrayGetCount(mCFArray)};
  66. CFIndex theIndex = CFArrayGetFirstIndexOfValue(mCFArray, theRange, inItem);
  67. if(theIndex != -1)
  68. {
  69. theAnswer = true;
  70. outIndex = ToUInt32(theIndex);
  71. }
  72. }
  73. return theAnswer;
  74. }
  75. bool CACFArray::GetBool(UInt32 inIndex, bool& outValue) const
  76. {
  77. bool theAnswer = false;
  78. CFTypeRef theValue = NULL;
  79. if(GetCFType(inIndex, theValue))
  80. {
  81. if((theValue != NULL) && (CFGetTypeID(theValue) == CFBooleanGetTypeID()))
  82. {
  83. outValue = CFBooleanGetValue(static_cast<CFBooleanRef>(theValue));
  84. theAnswer = true;
  85. }
  86. else if((theValue != NULL) && (CFGetTypeID(theValue) == CFNumberGetTypeID()))
  87. {
  88. SInt32 theNumericValue = 0;
  89. CFNumberGetValue(static_cast<CFNumberRef>(theValue), kCFNumberSInt32Type, &theNumericValue);
  90. outValue = theNumericValue != 0;
  91. theAnswer = true;
  92. }
  93. }
  94. return theAnswer;
  95. }
  96. bool CACFArray::GetSInt32(UInt32 inIndex, SInt32& outItem) const
  97. {
  98. bool theAnswer = false;
  99. CFTypeRef theItem = NULL;
  100. if(GetCFType(inIndex, theItem))
  101. {
  102. if((theItem != NULL) && (CFGetTypeID(theItem) == CFNumberGetTypeID()))
  103. {
  104. CFNumberGetValue(static_cast<CFNumberRef>(theItem), kCFNumberSInt32Type, &outItem);
  105. theAnswer = true;
  106. }
  107. }
  108. return theAnswer;
  109. }
  110. bool CACFArray::GetUInt32(UInt32 inIndex, UInt32& outItem) const
  111. {
  112. bool theAnswer = false;
  113. CFTypeRef theItem = NULL;
  114. if(GetCFType(inIndex, theItem))
  115. {
  116. if((theItem != NULL) && (CFGetTypeID(theItem) == CFNumberGetTypeID()))
  117. {
  118. CFNumberGetValue(static_cast<CFNumberRef>(theItem), kCFNumberSInt32Type, &outItem);
  119. theAnswer = true;
  120. }
  121. }
  122. return theAnswer;
  123. }
  124. bool CACFArray::GetSInt64(UInt32 inIndex, SInt64& outItem) const
  125. {
  126. bool theAnswer = false;
  127. CFTypeRef theItem = NULL;
  128. if(GetCFType(inIndex, theItem))
  129. {
  130. if((theItem != NULL) && (CFGetTypeID(theItem) == CFNumberGetTypeID()))
  131. {
  132. CFNumberGetValue(static_cast<CFNumberRef>(theItem), kCFNumberSInt64Type, &outItem);
  133. theAnswer = true;
  134. }
  135. }
  136. return theAnswer;
  137. }
  138. bool CACFArray::GetUInt64(UInt32 inIndex, UInt64& outItem) const
  139. {
  140. bool theAnswer = false;
  141. CFTypeRef theItem = NULL;
  142. if(GetCFType(inIndex, theItem))
  143. {
  144. if((theItem != NULL) && (CFGetTypeID(theItem) == CFNumberGetTypeID()))
  145. {
  146. CFNumberGetValue(static_cast<CFNumberRef>(theItem), kCFNumberSInt64Type, &outItem);
  147. theAnswer = true;
  148. }
  149. }
  150. return theAnswer;
  151. }
  152. bool CACFArray::GetFloat32(UInt32 inIndex, Float32& outItem) const
  153. {
  154. bool theAnswer = false;
  155. CFTypeRef theItem = NULL;
  156. if(GetCFType(inIndex, theItem))
  157. {
  158. if((theItem != NULL) && (CFGetTypeID(theItem) == CFNumberGetTypeID()))
  159. {
  160. CFNumberGetValue(static_cast<CFNumberRef>(theItem), kCFNumberFloat32Type, &outItem);
  161. theAnswer = true;
  162. }
  163. }
  164. return theAnswer;
  165. }
  166. bool CACFArray::GetFloat64(UInt32 inIndex, Float64& outItem) const
  167. {
  168. bool theAnswer = false;
  169. CFTypeRef theItem = NULL;
  170. if(GetCFType(inIndex, theItem))
  171. {
  172. if((theItem != NULL) && (CFGetTypeID(theItem) == CFNumberGetTypeID()))
  173. {
  174. CFNumberGetValue(static_cast<CFNumberRef>(theItem), kCFNumberFloat64Type, &outItem);
  175. theAnswer = true;
  176. }
  177. }
  178. return theAnswer;
  179. }
  180. bool CACFArray::GetString(UInt32 inIndex, CFStringRef& outItem) const
  181. {
  182. bool theAnswer = false;
  183. CFTypeRef theItem = NULL;
  184. if(GetCFType(inIndex, theItem))
  185. {
  186. if((theItem != NULL) && (CFGetTypeID(theItem) == CFStringGetTypeID()))
  187. {
  188. outItem = static_cast<CFStringRef>(theItem);
  189. theAnswer = true;
  190. }
  191. }
  192. return theAnswer;
  193. }
  194. bool CACFArray::GetArray(UInt32 inIndex, CFArrayRef& outItem) const
  195. {
  196. bool theAnswer = false;
  197. CFTypeRef theItem = NULL;
  198. if(GetCFType(inIndex, theItem))
  199. {
  200. if((theItem != NULL) && (CFGetTypeID(theItem) == CFArrayGetTypeID()))
  201. {
  202. outItem = static_cast<CFArrayRef>(theItem);
  203. theAnswer = true;
  204. }
  205. }
  206. return theAnswer;
  207. }
  208. bool CACFArray::GetDictionary(UInt32 inIndex, CFDictionaryRef& outItem) const
  209. {
  210. bool theAnswer = false;
  211. CFTypeRef theItem = NULL;
  212. if(GetCFType(inIndex, theItem))
  213. {
  214. if((theItem != NULL) && (CFGetTypeID(theItem) == CFDictionaryGetTypeID()))
  215. {
  216. outItem = static_cast<CFDictionaryRef>(theItem);
  217. theAnswer = true;
  218. }
  219. }
  220. return theAnswer;
  221. }
  222. bool CACFArray::GetData(UInt32 inIndex, CFDataRef& outItem) const
  223. {
  224. bool theAnswer = false;
  225. CFTypeRef theItem = NULL;
  226. if(GetCFType(inIndex, theItem))
  227. {
  228. if((theItem != NULL) && (CFGetTypeID(theItem) == CFDataGetTypeID()))
  229. {
  230. outItem = static_cast<CFDataRef>(theItem);
  231. theAnswer = true;
  232. }
  233. }
  234. return theAnswer;
  235. }
  236. bool CACFArray::GetUUID(UInt32 inIndex, CFUUIDRef& outItem) const
  237. {
  238. bool theAnswer = false;
  239. CFTypeRef theItem = NULL;
  240. if(GetCFType(inIndex, theItem))
  241. {
  242. if((theItem != NULL) && (CFGetTypeID(theItem) == CFUUIDGetTypeID()))
  243. {
  244. outItem = static_cast<CFUUIDRef>(theItem);
  245. theAnswer = true;
  246. }
  247. }
  248. return theAnswer;
  249. }
  250. bool CACFArray::GetCFType(UInt32 inIndex, CFTypeRef& outItem) const
  251. {
  252. bool theAnswer = false;
  253. if((mCFArray != NULL) && (inIndex < GetNumberItems()))
  254. {
  255. outItem = CFArrayGetValueAtIndex(mCFArray, inIndex);
  256. theAnswer = outItem != NULL;
  257. }
  258. return theAnswer;
  259. }
  260. void CACFArray::GetCACFString(UInt32 inIndex, CACFString& outItem) const
  261. {
  262. outItem = static_cast<CFStringRef>(NULL);
  263. CFTypeRef theItem = NULL;
  264. if(GetCFType(inIndex, theItem))
  265. {
  266. if((theItem != NULL) && (CFGetTypeID(theItem) == CFStringGetTypeID()))
  267. {
  268. outItem = static_cast<CFStringRef>(theItem);
  269. }
  270. }
  271. }
  272. void CACFArray::GetCACFArray(UInt32 inIndex, CACFArray& outItem) const
  273. {
  274. outItem = static_cast<CFArrayRef>(NULL);
  275. CFTypeRef theItem = NULL;
  276. if(GetCFType(inIndex, theItem))
  277. {
  278. if((theItem != NULL) && (CFGetTypeID(theItem) == CFArrayGetTypeID()))
  279. {
  280. outItem = static_cast<CFArrayRef>(theItem);
  281. }
  282. }
  283. }
  284. void CACFArray::GetCACFDictionary(UInt32 inIndex, CACFDictionary& outItem) const
  285. {
  286. outItem = static_cast<CFDictionaryRef>(NULL);
  287. CFTypeRef theItem = NULL;
  288. if(GetCFType(inIndex, theItem))
  289. {
  290. if((theItem != NULL) && (CFGetTypeID(theItem) == CFDictionaryGetTypeID()))
  291. {
  292. outItem = static_cast<CFDictionaryRef>(theItem);
  293. }
  294. }
  295. }
  296. bool CACFArray::AppendBool(bool inItem)
  297. {
  298. bool theAnswer = false;
  299. if((mCFArray != NULL) && mMutable)
  300. {
  301. CACFBoolean theItem(inItem);
  302. if(theItem.IsValid())
  303. {
  304. theAnswer = AppendCFType(theItem.GetCFBoolean());
  305. }
  306. }
  307. return theAnswer;
  308. }
  309. bool CACFArray::AppendSInt32(SInt32 inItem)
  310. {
  311. bool theAnswer = false;
  312. if((mCFArray != NULL) && mMutable)
  313. {
  314. CACFNumber theItem(inItem);
  315. if(theItem.IsValid())
  316. {
  317. theAnswer = AppendCFType(theItem.GetCFNumber());
  318. }
  319. }
  320. return theAnswer;
  321. }
  322. bool CACFArray::AppendUInt32(UInt32 inItem)
  323. {
  324. bool theAnswer = false;
  325. if((mCFArray != NULL) && mMutable)
  326. {
  327. CACFNumber theItem(inItem);
  328. if(theItem.IsValid())
  329. {
  330. theAnswer = AppendCFType(theItem.GetCFNumber());
  331. }
  332. }
  333. return theAnswer;
  334. }
  335. bool CACFArray::AppendSInt64(SInt64 inItem)
  336. {
  337. bool theAnswer = false;
  338. if((mCFArray != NULL) && mMutable)
  339. {
  340. CACFNumber theItem(inItem);
  341. if(theItem.IsValid())
  342. {
  343. theAnswer = AppendCFType(theItem.GetCFNumber());
  344. }
  345. }
  346. return theAnswer;
  347. }
  348. bool CACFArray::AppendUInt64(UInt64 inItem)
  349. {
  350. bool theAnswer = false;
  351. if((mCFArray != NULL) && mMutable)
  352. {
  353. CACFNumber theItem(inItem);
  354. if(theItem.IsValid())
  355. {
  356. theAnswer = AppendCFType(theItem.GetCFNumber());
  357. }
  358. }
  359. return theAnswer;
  360. }
  361. bool CACFArray::AppendFloat32(Float32 inItem)
  362. {
  363. bool theAnswer = false;
  364. if((mCFArray != NULL) && mMutable)
  365. {
  366. CACFNumber theItem(inItem);
  367. if(theItem.IsValid())
  368. {
  369. theAnswer = AppendCFType(theItem.GetCFNumber());
  370. }
  371. }
  372. return theAnswer;
  373. }
  374. bool CACFArray::AppendFloat64(Float64 inItem)
  375. {
  376. bool theAnswer = false;
  377. if((mCFArray != NULL) && mMutable)
  378. {
  379. CACFNumber theItem(inItem);
  380. if(theItem.IsValid())
  381. {
  382. theAnswer = AppendCFType(theItem.GetCFNumber());
  383. }
  384. }
  385. return theAnswer;
  386. }
  387. bool CACFArray::AppendString(const CFStringRef inItem)
  388. {
  389. return AppendCFType(inItem);
  390. }
  391. bool CACFArray::AppendArray(const CFArrayRef inItem)
  392. {
  393. return AppendCFType(inItem);
  394. }
  395. bool CACFArray::AppendDictionary(const CFDictionaryRef inItem)
  396. {
  397. return AppendCFType(inItem);
  398. }
  399. bool CACFArray::AppendData(const CFDataRef inItem)
  400. {
  401. return AppendCFType(inItem);
  402. }
  403. bool CACFArray::AppendCFType(const CFTypeRef inItem)
  404. {
  405. bool theAnswer = false;
  406. if((mCFArray != NULL) && mMutable)
  407. {
  408. CFArrayAppendValue(mCFArray, inItem);
  409. theAnswer = true;
  410. }
  411. return theAnswer;
  412. }
  413. bool CACFArray::InsertBool(UInt32 inIndex, bool inItem)
  414. {
  415. bool theAnswer = false;
  416. if((mCFArray != NULL) && mMutable)
  417. {
  418. CACFBoolean theItem(inItem);
  419. if(theItem.IsValid())
  420. {
  421. theAnswer = InsertCFType(inIndex, theItem.GetCFBoolean());
  422. }
  423. }
  424. return theAnswer;
  425. }
  426. bool CACFArray::InsertSInt32(UInt32 inIndex, SInt32 inItem)
  427. {
  428. bool theAnswer = false;
  429. if((mCFArray != NULL) && mMutable)
  430. {
  431. CACFNumber theItem(inItem);
  432. if(theItem.IsValid())
  433. {
  434. theAnswer = InsertCFType(inIndex, theItem.GetCFNumber());
  435. }
  436. }
  437. return theAnswer;
  438. }
  439. bool CACFArray::InsertUInt32(UInt32 inIndex, UInt32 inItem)
  440. {
  441. bool theAnswer = false;
  442. if((mCFArray != NULL) && mMutable)
  443. {
  444. CACFNumber theItem(inItem);
  445. if(theItem.IsValid())
  446. {
  447. theAnswer = InsertCFType(inIndex, theItem.GetCFNumber());
  448. }
  449. }
  450. return theAnswer;
  451. }
  452. bool CACFArray::InsertSInt64(UInt32 inIndex, SInt64 inItem)
  453. {
  454. bool theAnswer = false;
  455. if((mCFArray != NULL) && mMutable)
  456. {
  457. CACFNumber theItem(inItem);
  458. if(theItem.IsValid())
  459. {
  460. theAnswer = InsertCFType(inIndex, theItem.GetCFNumber());
  461. }
  462. }
  463. return theAnswer;
  464. }
  465. bool CACFArray::InsertUInt64(UInt32 inIndex, UInt64 inItem)
  466. {
  467. bool theAnswer = false;
  468. if((mCFArray != NULL) && mMutable)
  469. {
  470. CACFNumber theItem(inItem);
  471. if(theItem.IsValid())
  472. {
  473. theAnswer = InsertCFType(inIndex, theItem.GetCFNumber());
  474. }
  475. }
  476. return theAnswer;
  477. }
  478. bool CACFArray::InsertFloat32(UInt32 inIndex, Float32 inItem)
  479. {
  480. bool theAnswer = false;
  481. if((mCFArray != NULL) && mMutable)
  482. {
  483. CACFNumber theItem(inItem);
  484. if(theItem.IsValid())
  485. {
  486. theAnswer = InsertCFType(inIndex, theItem.GetCFNumber());
  487. }
  488. }
  489. return theAnswer;
  490. }
  491. bool CACFArray::InsertFloat64(UInt32 inIndex, Float64 inItem)
  492. {
  493. bool theAnswer = false;
  494. if((mCFArray != NULL) && mMutable)
  495. {
  496. CACFNumber theItem(inItem);
  497. if(theItem.IsValid())
  498. {
  499. theAnswer = InsertCFType(inIndex, theItem.GetCFNumber());
  500. }
  501. }
  502. return theAnswer;
  503. }
  504. bool CACFArray::InsertString(UInt32 inIndex, const CFStringRef inItem)
  505. {
  506. return InsertCFType(inIndex, inItem);
  507. }
  508. bool CACFArray::InsertArray(UInt32 inIndex, const CFArrayRef inItem)
  509. {
  510. return InsertCFType(inIndex, inItem);
  511. }
  512. bool CACFArray::InsertDictionary(UInt32 inIndex, const CFDictionaryRef inItem)
  513. {
  514. return InsertCFType(inIndex, inItem);
  515. }
  516. bool CACFArray::InsertData(UInt32 inIndex, const CFDataRef inItem)
  517. {
  518. return InsertCFType(inIndex, inItem);
  519. }
  520. bool CACFArray::InsertCFType(UInt32 inIndex, const CFTypeRef inItem)
  521. {
  522. bool theAnswer = false;
  523. if((mCFArray != NULL) && mMutable)
  524. {
  525. if(inIndex < GetNumberItems())
  526. {
  527. CFArrayInsertValueAtIndex(mCFArray, inIndex, inItem);
  528. }
  529. else
  530. {
  531. CFArrayAppendValue(mCFArray, inItem);
  532. }
  533. theAnswer = true;
  534. }
  535. return theAnswer;
  536. }
  537. bool CACFArray::SetBool(UInt32 inIndex, bool inItem)
  538. {
  539. bool theAnswer = false;
  540. if((mCFArray != NULL) && mMutable && (inIndex <= GetNumberItems()))
  541. {
  542. CACFBoolean theItem(inItem);
  543. if(theItem.IsValid())
  544. {
  545. theAnswer = SetCFType(inIndex, theItem.GetCFBoolean());
  546. }
  547. }
  548. return theAnswer;
  549. }
  550. bool CACFArray::SetSInt32(UInt32 inIndex, SInt32 inItem)
  551. {
  552. bool theAnswer = false;
  553. if((mCFArray != NULL) && mMutable && (inIndex <= GetNumberItems()))
  554. {
  555. CACFNumber theItem(inItem);
  556. if(theItem.IsValid())
  557. {
  558. theAnswer = SetCFType(inIndex, theItem.GetCFNumber());
  559. }
  560. }
  561. return theAnswer;
  562. }
  563. bool CACFArray::SetUInt32(UInt32 inIndex, UInt32 inItem)
  564. {
  565. bool theAnswer = false;
  566. if((mCFArray != NULL) && mMutable && (inIndex <= GetNumberItems()))
  567. {
  568. CACFNumber theItem(inItem);
  569. if(theItem.IsValid())
  570. {
  571. theAnswer = SetCFType(inIndex, theItem.GetCFNumber());
  572. }
  573. }
  574. return theAnswer;
  575. }
  576. bool CACFArray::SetSInt64(UInt32 inIndex, SInt64 inItem)
  577. {
  578. bool theAnswer = false;
  579. if((mCFArray != NULL) && mMutable && (inIndex <= GetNumberItems()))
  580. {
  581. CACFNumber theItem(inItem);
  582. if(theItem.IsValid())
  583. {
  584. theAnswer = SetCFType(inIndex, theItem.GetCFNumber());
  585. }
  586. }
  587. return theAnswer;
  588. }
  589. bool CACFArray::SetUInt64(UInt32 inIndex, UInt64 inItem)
  590. {
  591. bool theAnswer = false;
  592. if((mCFArray != NULL) && mMutable && (inIndex <= GetNumberItems()))
  593. {
  594. CACFNumber theItem(inItem);
  595. if(theItem.IsValid())
  596. {
  597. theAnswer = SetCFType(inIndex, theItem.GetCFNumber());
  598. }
  599. }
  600. return theAnswer;
  601. }
  602. bool CACFArray::SetFloat32(UInt32 inIndex, Float32 inItem)
  603. {
  604. bool theAnswer = false;
  605. if((mCFArray != NULL) && mMutable && (inIndex <= GetNumberItems()))
  606. {
  607. CACFNumber theItem(inItem);
  608. if(theItem.IsValid())
  609. {
  610. theAnswer = SetCFType(inIndex, theItem.GetCFNumber());
  611. }
  612. }
  613. return theAnswer;
  614. }
  615. bool CACFArray::SetFloat64(UInt32 inIndex, Float64 inItem)
  616. {
  617. bool theAnswer = false;
  618. if((mCFArray != NULL) && mMutable && (inIndex <= GetNumberItems()))
  619. {
  620. CACFNumber theItem(inItem);
  621. if(theItem.IsValid())
  622. {
  623. theAnswer = SetCFType(inIndex, theItem.GetCFNumber());
  624. }
  625. }
  626. return theAnswer;
  627. }
  628. bool CACFArray::SetString(UInt32 inIndex, const CFStringRef inItem)
  629. {
  630. return SetCFType(inIndex, inItem);
  631. }
  632. bool CACFArray::SetArray(UInt32 inIndex, const CFArrayRef inItem)
  633. {
  634. return SetCFType(inIndex, inItem);
  635. }
  636. bool CACFArray::SetDictionary(UInt32 inIndex, const CFDictionaryRef inItem)
  637. {
  638. return SetCFType(inIndex, inItem);
  639. }
  640. bool CACFArray::SetData(UInt32 inIndex, const CFDataRef inItem)
  641. {
  642. return SetCFType(inIndex, inItem);
  643. }
  644. bool CACFArray::SetCFType(UInt32 inIndex, const CFTypeRef inItem)
  645. {
  646. bool theAnswer = false;
  647. if((mCFArray != NULL) && mMutable && (inIndex <= GetNumberItems()))
  648. {
  649. CFArraySetValueAtIndex(mCFArray, inIndex, inItem);
  650. theAnswer = true;
  651. }
  652. return theAnswer;
  653. }