![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /proc/self/root/usr/share/doc/gnustep-base-doc/Base/Reference/ |
Upload File : |
<?xml version="1.0"?> <!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 1.0.4//EN" "http://www.gnustep.org/gsdoc-1_0_4.dtd"> <gsdoc base="NSPropertyList" up="Base"> <head> <title>NSPropertyListSerialization class documentation</title> <author name="Richard Frith-Macdonald"> <email address="rfm@gnu.org"> rfm@gnu.org </email> </author> <copy>2004 Free Software Foundation, Inc.</copy> </head> <body> <front><contents /></front> <chapter> <heading> Software documentation for the NSPropertyListSerialization class </heading> <class name="NSPropertyListSerialization" super="NSObject" ovadd="10.0.0"> <declared>Foundation/NSPropertyList.h</declared> <desc> <p> The NSPropertyListSerialization class provides facilities for serialising and deserializing property list data in a number of formats. A property list is roughly an <ref type="class" id="NSArray">NSArray</ref> or <ref type="class" id="NSDictionary">NSDictionary</ref> object, with these or <ref type="class" id="NSNumber">NSNumber</ref> , <ref type="class" id="NSData">NSData</ref> , <ref type="class" id="NSString">NSString</ref> , or <ref type="class" id="NSDate">NSDate</ref> objects as members. (See below.) </p> <p> You do not work with instances of this class, instead you use a small number of class methods to serialize and deserialize property lists. </p> <br /> A <em>property list</em> may only be one of the following classes - <deflist> <term> <ref type="class" id="NSArray">NSArray</ref> </term> <desc> An array which is either empty or contains only <em>property list</em> objects. <br /> An array is delimited by round brackets and its contents are comma <em>separated</em> (there is no comma after the last array element). <example> ( "one", "two", "three" ) </example> In XML format, an array is an element whose name is <code>array</code> and whose content is the array content. <example> <array><string>one</string><string>two</string><string>three</string></array> </example> </desc> <term> <ref type="class" id="NSData">NSData</ref> </term> <desc> An array is represented as a series of pairs of hexadecimal characters (each pair representing a byte of data) enclosed in angle brackets. Spaces are ignored). <example> < 54637374 696D67 > </example> In XML format, a data object is an element whose name is <code>data</code> and whose content is a stream of base64 encoded bytes. </desc> <term> <ref type="class" id="NSDate">NSDate</ref> </term> <desc> Date objects were not traditionally allowed in <em>property lists</em> but were added when the XML format was introduced. GNUstep provides an extension to the traditional <em>property list</em> format to support date objects, but older code will not read <em>property lists</em> containing this extension. <br /> This format consists of an asterisk followed by the letter 'D' then a date/time in YYYY-MM-DD HH:MM:SS +/-ZZZZ format, all enclosed within angle brackets. <example> <*D2002-03-22 11:30:00 +0100> </example> In XML format, a date object is an element whose name is <code>date</code> and whose content is a date in the format YYYY-MM-DDTHH:MM:SSZ (or the above dfate format). <example> <date>2002-03-22T11:30:00Z</date> </example> </desc> <term> <ref type="class" id="NSDictionary">NSDictionary</ref> </term> <desc> A dictionary which is either empty or contains only <em>string</em> keys and <em>property list</em> objects. <br /> A dictionary is delimited by curly brackets and its contents are semicolon <em>terminated</em> (there is a semicolon after each value). Each item in the dictionary is a key/value pair with an equals sign after the key and before the value. <example> { "key1" = "value1"; } </example> In XML format, a dictionary is an element whose name is <code>dictionary</code> and whose content consists of pairs of strings and other <em>property list</em> objects. <example> <dictionary> <string>key1</string> <string>value1</string> </dictionary> </example> </desc> <term> <ref type="class" id="NSNumber">NSNumber</ref> </term> <desc> Number objects were not traditionally allowed in <em>property lists</em> but were added when the XML format was introduced. GNUstep provides an extension to the traditional <em>property list</em> format to support number objects, but older code will not read <em>property lists</em> containing this extension. <br /> Numbers are stored in a variety of formats depending on their values. <list> <item> boolean... either <code><*BY></code> for <code>YES</code> or <code><*BN></code> for <code>NO</code>. <br /> In XML format this is either <code><true /></code> or <code><false /></code> </item> <item> integer... <code><*INNN></code> where NNN is an integer. <br /> In XML format this is <code><integer>NNN<integer></code> </item> <item> real... <code><*RNNN></code> where NNN is a real number. <br /> In XML format this is <code><real>NNN<real></code> </item> </list> </desc> <term> <ref type="class" id="NSString">NSString</ref> </term> <desc> A string is either stored literally (if it contains no spaces or special characters), or is stored as a quoted string with special characters escaped where necessary. <br /> Escape conventions are similar to those normally used in ObjectiveC programming, using a backslash followed by - <list> <item> <strong>\</strong> a backslash character </item> <item> <strong>"</strong> a quote character </item> <item> <strong>b</strong> a backspace character </item> <item> <strong>n</strong> a newline character </item> <item> <strong>r</strong> a carriage return character </item> <item><strong>t</strong> a tab character</item> <item> <strong>OOO</strong> (three octal digits) an arbitrary ascii character </item> <item> <strong>UXXXX</strong> (where X is a hexadecimal digit) a an arbitrary unicode character </item> </list> <example> "hello world & others" </example> In XML format, the string is simply stored in UTF8 format as the content of a <code>string</code> element, and the only character escapes required are those used by XML such as the '&lt;' markup representing a '<' character. <example> <string>hello world &amp; others</string>" </example> </desc> </deflist> </desc> <method type="NSData*" factory="yes" ovadd="10.0.0"> <sel>dataFromPropertyList:</sel> <arg type="id">aPropertyList</arg> <sel>format:</sel> <arg type="NSPropertyListFormat">aFormat</arg> <sel>errorDescription:</sel> <arg type="NSString**">anErrorString</arg> <desc> Creates and returns a data object containing a serialized representation of plist. The argument <var>aFormat</var> is used to determine the way in which the data is serialised, and the <var>anErrorString</var> argument is a pointer in which an error message is returned on failure ( <code>nil</code> is returned on success). </desc> </method> <method type="NSData*" factory="yes" ovadd="10.6.0"> <sel>dataWithPropertyList:</sel> <arg type="id">aPropertyList</arg> <sel>format:</sel> <arg type="NSPropertyListFormat">aFormat</arg> <sel>options:</sel> <arg type="NSPropertyListWriteOptions">anOption</arg> <sel>error:</sel> <arg type="out NSError**">error</arg> <desc> <em>Description forthcoming.</em> </desc> </method> <method type="BOOL" factory="yes" ovadd="10.0.0"> <sel>propertyList:</sel> <arg type="id">aPropertyList</arg> <sel>isValidForFormat:</sel> <arg type="NSPropertyListFormat">aFormat</arg> <desc> Returns a flag indicating whether it is possible to serialize <var>aPropertyList</var> in the format <var>aFormat</var>. </desc> </method> <method type="id" factory="yes" ovadd="10.0.0"> <sel>propertyListFromData:</sel> <arg type="NSData*">data</arg> <sel>mutabilityOption:</sel> <arg type="NSPropertyListMutabilityOptions">anOption</arg> <sel>format:</sel> <arg type="NSPropertyListFormat*">aFormat</arg> <sel>errorDescription:</sel> <arg type="NSString**">anErrorString</arg> <desc> Deserialises dataItem and returns the resulting property list (or <code>nil</code> if the <var>data</var> does not contain a property list serialised in a supported format). <br /> The argument <var>anOption</var> is used to control whether the objects making up the deserialized property list are mutable or not. <br /> The argument <var>aFormat</var> is either null or a pointer to a location in which the format of the serialized property list will be returned. <br /> Either <code>nil</code> or an error message will be returned in <var>anErrorString</var>. </desc> </method> <method type="id" factory="yes" ovadd="10.6.0"> <sel>propertyListWithData:</sel> <arg type="NSData*">data</arg> <sel>options:</sel> <arg type="NSPropertyListReadOptions">anOption</arg> <sel>format:</sel> <arg type="NSPropertyListFormat*">aFormat</arg> <sel>error:</sel> <arg type="out NSError**">error</arg> <desc> <em>Description forthcoming.</em> </desc> </method> <method type="id" factory="yes" ovadd="10.6.0"> <sel>propertyListWithStream:</sel> <arg type="NSInputStream*">stream</arg> <sel>options:</sel> <arg type="NSPropertyListReadOptions">anOption</arg> <sel>format:</sel> <arg type="NSPropertyListFormat*">aFormat</arg> <sel>error:</sel> <arg type="out NSError**">error</arg> <desc> <em>Description forthcoming.</em> </desc> </method> <method type="NSInteger" factory="yes" ovadd="10.6.0"> <sel>writePropertyList:</sel> <arg type="id">aPropertyList</arg> <sel>toStream:</sel> <arg type="NSOutputStream*">stream</arg> <sel>format:</sel> <arg type="NSPropertyListFormat">aFormat</arg> <sel>options:</sel> <arg type="NSPropertyListWriteOptions">anOption</arg> <sel>error:</sel> <arg type="out NSError**">error</arg> <desc> <em>Description forthcoming.</em> </desc> </method> </class> </chapter> </body> </gsdoc>