/Foundation/CPPropertyListSerialization.j

http://github.com/cacaodev/cappuccino · Unknown · 65 lines · 52 code · 13 blank · 0 comment · 0 complexity · a0e2077c92efcb821664f912438b7612 MD5 · raw file

  1. /*
  2. * CPPropertyListSerialization.j
  3. * Foundation
  4. *
  5. * Created by Francisco Tolmasky.
  6. * Copyright 2008, 280 North, Inc.
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with this library; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. @import "CPException.j"
  23. @import "CPObject.j"
  24. CPPropertyListUnknownFormat = 0;
  25. CPPropertyListOpenStepFormat = kCFPropertyListOpenStepFormat;
  26. CPPropertyListXMLFormat_v1_0 = kCFPropertyListXMLFormat_v1_0;
  27. CPPropertyListBinaryFormat_v1_0 = kCFPropertyListBinaryFormat_v1_0;
  28. CPPropertyList280NorthFormat_v1_0 = kCFPropertyList280NorthFormat_v1_0;
  29. @implementation CPPropertyListSerialization : CPObject
  30. {
  31. }
  32. + (CPData)dataFromPropertyList:(id)aPlist format:(CPPropertyListFormat)aFormat
  33. {
  34. return CPPropertyListCreateData(aPlist, aFormat);
  35. }
  36. + (id)propertyListFromData:(CPData)data format:(CPPropertyListFormat)aFormat
  37. {
  38. return CPPropertyListCreateFromData(data, aFormat);
  39. }
  40. @end
  41. @implementation CPPropertyListSerialization (Deprecated)
  42. + (CPData)dataFromPropertyList:(id)aPlist format:(CPPropertyListFormat)aFormat errorDescription:(id)anErrorString
  43. {
  44. _CPReportLenientDeprecation(self, _cmd, @selector(dataFromPropertyList:format:));
  45. return [self dataFromPropertyList:aPlist format:aFormat];
  46. }
  47. + (id)propertyListFromData:(CPData)data format:(CPPropertyListFormat)aFormat errorDescription:(id)errorString
  48. {
  49. _CPReportLenientDeprecation(self, _cmd, @selector(propertyListFromData:format:));
  50. return [self propertyListFromData:data format:aFormat];
  51. }
  52. @end