diff --git a/plist-cil/ASCIIPropertyListParser.cs b/plist-cil/ASCIIPropertyListParser.cs index de8590e..30ea4c8 100644 --- a/plist-cil/ASCIIPropertyListParser.cs +++ b/plist-cil/ASCIIPropertyListParser.cs @@ -91,44 +91,140 @@ namespace Claunia.PropertyList return parser.Parse(); } + /// + /// A space + /// public const char WHITESPACE_SPACE = ' '; + /// + /// A tabulator + /// public const char WHITESPACE_TAB = '\t'; + /// + /// A newline + /// public const char WHITESPACE_NEWLINE = '\n'; + /// + /// A carriage return + /// public const char WHITESPACE_CARRIAGE_RETURN = '\r'; + /// + /// Token of NSArray start + /// public const char ARRAY_BEGIN_TOKEN = '('; + /// + /// Token of NSArray end + /// public const char ARRAY_END_TOKEN = ')'; + /// + /// Token of NSArray item delimiter + /// public const char ARRAY_ITEM_DELIMITER_TOKEN = ','; + /// + /// Token of NSDictionary start + /// public const char DICTIONARY_BEGIN_TOKEN = '{'; + /// + /// Token of NSDictionary end + /// public const char DICTIONARY_END_TOKEN = '}'; + /// + /// Token of NSDictionary assignment + /// public const char DICTIONARY_ASSIGN_TOKEN = '='; + /// + /// Token of NSDictionary item delimiter + /// public const char DICTIONARY_ITEM_DELIMITER_TOKEN = ';'; + /// + /// Token of quoted NSString start + /// public const char QUOTEDSTRING_BEGIN_TOKEN = '"'; + /// + /// Token of quoted NSString end + /// public const char QUOTEDSTRING_END_TOKEN = '"'; + /// + /// Token of quoted NSString escaped character + /// public const char QUOTEDSTRING_ESCAPE_TOKEN = '\\'; + /// + /// Token of NSData start + /// public const char DATA_BEGIN_TOKEN = '<'; + /// + /// Token of NSData end + /// public const char DATA_END_TOKEN = '>'; + /// + /// Token of GSObject start + /// public const char DATA_GSOBJECT_BEGIN_TOKEN = '*'; + /// + /// Token of GSDate start + /// public const char DATA_GSDATE_BEGIN_TOKEN = 'D'; + /// + /// Token of GSBoolean start + /// public const char DATA_GSBOOL_BEGIN_TOKEN = 'B'; + /// + /// Token for GSBoolen's true + /// public const char DATA_GSBOOL_TRUE_TOKEN = 'Y'; + /// + /// Token for GSBoolen's false + /// public const char DATA_GSBOOL_FALSE_TOKEN = 'N'; + /// + /// Token for GSInteger + /// public const char DATA_GSINT_BEGIN_TOKEN = 'I'; + /// + /// Token for GSReal + /// public const char DATA_GSREAL_BEGIN_TOKEN = 'R'; + /// + /// Token for NSDate date field delimited + /// public const char DATE_DATE_FIELD_DELIMITER = '-'; + /// + /// Token for NSDate time field delimiter + /// public const char DATE_TIME_FIELD_DELIMITER = ':'; + /// + /// Token for GSDate date and time delimiter + /// public const char DATE_GS_DATE_TIME_DELIMITER = ' '; + /// + /// Token for NSDate date and time delimiter + /// public const char DATE_APPLE_DATE_TIME_DELIMITER = 'T'; + /// + /// Token for NSDate end + /// public const char DATE_APPLE_END_TOKEN = 'Z'; + /// + /// Token for comment start + /// public const char COMMENT_BEGIN_TOKEN = '/'; + /// + /// Second token for multiline comment + /// public const char MULTILINE_COMMENT_SECOND_TOKEN = '*'; + /// + /// Second token for singleline comment + /// public const char SINGLELINE_COMMENT_SECOND_TOKEN = '/'; + /// + /// End token for multiline comment + /// public const char MULTILINE_COMMENT_END_TOKEN = '/'; /** diff --git a/plist-cil/BinaryPropertyListParser.cs b/plist-cil/BinaryPropertyListParser.cs index 99adf94..da01580 100644 --- a/plist-cil/BinaryPropertyListParser.cs +++ b/plist-cil/BinaryPropertyListParser.cs @@ -33,7 +33,8 @@ namespace Claunia.PropertyList /// Use this class when you are sure about the format of the property list. /// Otherwise use the PropertyListParser class. /// - /// Parsing is done by calling the static methods. + /// Parsing is done by calling the static , + /// and methods. /// /// /// @author Daniel Dreibrodt @@ -42,33 +43,39 @@ namespace Claunia.PropertyList { int majorVersion, minorVersion; - /** - * property list in bytes * - */ + /// + /// Property list in bytes + /// byte[] bytes; - /** - * Length of an offset definition in bytes * - */ + + /// + /// Length of an offset definition in bytes + /// int offsetSize; - /** - * Length of an object reference in bytes * - */ + + /// + /// Length of an object reference in bytes + /// int objectRefSize; - /** - * Number of objects stored in this property list * - */ + + /// + /// Number of objects stored in this property list + /// int numObjects; - /** - * Reference to the top object of the property list * - */ + + /// + /// Reference to the top object of the property list + /// int topObject; - /** - * Offset of the offset table from the beginning of the file * - */ + + /// + /// Offset of the offset table from the beginning of the file + /// int offsetTableOffset; - /** - * The table holding the information at which offset each object is found * - */ + + /// + /// The table holding the information at which offset each object is found + /// int[] offsetTable; /// @@ -78,7 +85,6 @@ namespace Claunia.PropertyList /// protected BinaryPropertyListParser() { - /** empty **/ } /// diff --git a/plist-cil/BinaryPropertyListWriter.cs b/plist-cil/BinaryPropertyListWriter.cs index 113a800..0d2c87e 100644 --- a/plist-cil/BinaryPropertyListWriter.cs +++ b/plist-cil/BinaryPropertyListWriter.cs @@ -38,9 +38,21 @@ namespace Claunia.PropertyList /// @author Natalia Portillo public class BinaryPropertyListWriter { + /// + /// Binary property list version 0.0 + /// public const int VERSION_00 = 0; + /// + /// Binary property list version 1.0 + /// public const int VERSION_10 = 10; + /// + /// Binary property list version 1.5 + /// public const int VERSION_15 = 15; + /// + /// Binary property list version 2.0 + /// public const int VERSION_20 = 20; /// diff --git a/plist-cil/ChangeLog b/plist-cil/ChangeLog index d12e4f7..8a08b87 100644 --- a/plist-cil/ChangeLog +++ b/plist-cil/ChangeLog @@ -1,3 +1,19 @@ +2015-02-20 Natalia Portillo + + * UID.cs: + * NSSet.cs: + * NSDate.cs: + * NSData.cs: + * NSArray.cs: + * NSString.cs: + * NSObject.cs: + * NSNumber.cs: + * NSDictionary.cs: + * ASCIIPropertyListParser.cs: + * BinaryPropertyListParser.cs: + * BinaryPropertyListWriter.cs: + Added all missing documentation for public methods. + 2015-02-20 Natalia Portillo * NSDate.cs: diff --git a/plist-cil/NSArray.cs b/plist-cil/NSArray.cs index c50fe4b..4df77ec 100644 --- a/plist-cil/NSArray.cs +++ b/plist-cil/NSArray.cs @@ -198,6 +198,12 @@ namespace Claunia.PropertyList return result; } + /// + /// Determines whether the specified is equal to the current . + /// + /// The to compare with the current . + /// true if the specified is equal to the current + /// ; otherwise, false. public override bool Equals(Object obj) { if (obj.GetType().Equals(typeof(NSArray))) @@ -215,6 +221,11 @@ namespace Claunia.PropertyList return false; } + /// + /// Serves as a hash function for a object. + /// + /// A hash code for this instance that is suitable for use in hashing algorithms and data structures such as a + /// hash table. public override int GetHashCode() { int hash = 7; @@ -353,6 +364,12 @@ namespace Claunia.PropertyList ascii.Append(ASCIIPropertyListParser.ARRAY_END_TOKEN); } + /// + /// Determines whether the specified is equal to the current . + /// + /// The to compare with the current . + /// true if the specified is equal to the current + /// ; otherwise, false. public override bool Equals(NSObject obj) { if (!(obj is NSArray)) diff --git a/plist-cil/NSData.cs b/plist-cil/NSData.cs index 0ee55c7..1b253c9 100644 --- a/plist-cil/NSData.cs +++ b/plist-cil/NSData.cs @@ -124,11 +124,22 @@ namespace Claunia.PropertyList return Convert.ToBase64String(bytes, Base64FormattingOptions.InsertLineBreaks); } + /// + /// Determines whether the specified is equal to the current . + /// + /// The to compare with the current . + /// true if the specified is equal to the current + /// ; otherwise, false. public override bool Equals(Object obj) { return obj.GetType().Equals(GetType()) && ArrayEquals(((NSData)obj).bytes, bytes); } + /// + /// Serves as a hash function for a object. + /// + /// A hash code for this instance that is suitable for use in hashing algorithms and data structures such as a + /// hash table. public override int GetHashCode() { int hash = 5; @@ -185,6 +196,12 @@ namespace Claunia.PropertyList ToASCII(ascii, level); } + /// + /// Determines whether the specified is equal to the current . + /// + /// The to compare with the current . + /// true if the specified is equal to the current + /// ; otherwise, false. public override bool Equals(NSObject obj) { if (!(obj is NSData)) diff --git a/plist-cil/NSDate.cs b/plist-cil/NSDate.cs index 3732ea0..1a62b1c 100644 --- a/plist-cil/NSDate.cs +++ b/plist-cil/NSDate.cs @@ -126,11 +126,22 @@ namespace Claunia.PropertyList } } + /// + /// Determines whether the specified is equal to the current . + /// + /// The to compare with the current . + /// true if the specified is equal to the current + /// ; otherwise, false. public override bool Equals(Object obj) { return obj.GetType().Equals(GetType()) && date.Equals(((NSDate)obj).Date); } + /// + /// Serves as a hash function for a object. + /// + /// A hash code for this instance that is suitable for use in hashing algorithms and data structures such as a + /// hash table. public override int GetHashCode() { return date.GetHashCode(); @@ -175,6 +186,12 @@ namespace Claunia.PropertyList ascii.Append(">"); } + /// + /// Determines whether the specified is equal to the current . + /// + /// The to compare with the current . + /// true if the specified is equal to the current + /// ; otherwise, false. public override bool Equals(NSObject obj) { if (!(obj is NSDate)) diff --git a/plist-cil/NSDictionary.cs b/plist-cil/NSDictionary.cs index e836228..8fddc9f 100644 --- a/plist-cil/NSDictionary.cs +++ b/plist-cil/NSDictionary.cs @@ -72,6 +72,10 @@ namespace Claunia.PropertyList return dict.TryGetValue(key, out nso) ? nso : null; } + /// + /// Gets a value indicating whether this instance is empty. + /// + /// true if this instance is empty; otherwise, false. public bool IsEmpty { get @@ -80,16 +84,31 @@ namespace Claunia.PropertyList } } + /// + /// Checks if the specified object key is contained in the current instance + /// + /// true, if key is contained, false otherwise. + /// Key. public bool ContainsKey(Object key) { return key is string && dict.ContainsKey((string)key); } + /// + /// Removes the item corresponding to the specified key from the current instance, if found. + /// + /// Key. + /// true, if removed, false otherwise. public bool Remove(Object key) { return key is string && dict.Remove((string)key); } + /// + /// Gets the corresponding to the specified key from the current instance. + /// + /// Key. + /// The object corresponding to the specified key, null if not found in the current instance public NSObject Get(Object key) { if (key is string) @@ -97,6 +116,11 @@ namespace Claunia.PropertyList return null; } + /// + /// Checks if the current instance contains the object corresponding to the specified key. + /// + /// true, if value is contained, false otherwise. + /// Object to search up in the current instance. public bool ContainsValue(Object value) { if (value == null) @@ -262,6 +286,12 @@ namespace Claunia.PropertyList return false; } + /// + /// Determines whether the specified is equal to the current . + /// + /// The to compare with the current . + /// true if the specified is equal to the current + /// ; otherwise, false. public override bool Equals(NSObject obj) { if (!(obj is NSDictionary)) @@ -285,6 +315,11 @@ namespace Claunia.PropertyList return true; } + /// + /// Serves as a hash function for a object. + /// + /// A hash code for this instance that is suitable for use in hashing algorithms and data structures such as a + /// hash table. public override int GetHashCode() { int hash = 7; @@ -437,31 +472,62 @@ namespace Claunia.PropertyList #region IDictionary implementation + /// + /// Add the specified key and value. + /// + /// Key. + /// Value. public void Add(string key, NSObject value) { dict.Add(key, value); } + /// The key to locate in the current instance. + /// Determines whether the current instance contains an entry with the specified key. + /// + /// Containses the key. + /// + /// true, if key was containsed, false otherwise. + /// Key. public bool ContainsKey(string key) { return dict.ContainsKey(key); } + /// + /// Checks if there is any item contained in the current instance corresponding with the specified key. + /// + /// true, if value is contained, false otherwise. + /// Key. public bool ContainsValue(NSObject key) { return dict.ContainsValue(key); } + /// + /// Removes the item belonging to the specified key. + /// + /// Key. public bool Remove(string key) { return dict.Remove(key); } + /// + /// Tries to get the item corresponding to the specified key + /// + /// true, if get value was successfully found and retrieved, false otherwise. + /// Key. + /// Where to store the value. public bool TryGetValue(string key, out NSObject value) { return dict.TryGetValue(key, out value); } + /// + /// Gets or sets the at the specified index. + /// + /// Index. public NSObject this [string index] { get @@ -474,6 +540,10 @@ namespace Claunia.PropertyList } } + /// + /// Gets an array with all the keys contained in the current instance. + /// + /// The keys. public ICollection Keys { get @@ -482,6 +552,10 @@ namespace Claunia.PropertyList } } + /// + /// Gets an array with all the objects contained in the current instance. + /// + /// The objects. public ICollection Values { get @@ -493,32 +567,57 @@ namespace Claunia.PropertyList #endregion #region ICollection implementation - + /// + /// Adds the specified item. + /// + /// Item. public void Add(KeyValuePair item) { dict.Add(item.Key, item.Value); } + /// + /// Clears this instance. + /// public void Clear() { dict.Clear(); } + /// + /// Checks if the current instance contains the specified item. + /// + /// Item. + /// true if it is found, false otherwise. public bool Contains(KeyValuePair item) { return dict.ContainsKey(item.Key); } + /// + /// Copies the elements to an existing one-dimensional , starting at the specified array index. + /// + /// The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing. + /// The zero-based index in array at which copying begins. public void CopyTo(KeyValuePair[] array, int arrayIndex) { throw new NotImplementedException(); } + /// + /// Removes the specified item. + /// + /// Item to remove. + /// true if successfully removed, false if not, or if item is not in current instance public bool Remove(KeyValuePair item) { return dict.Remove(item.Key); } + /// + /// Gets the count of items in the current instance. + /// + /// How many items are contained in the current instance. public int Count { get @@ -527,6 +626,10 @@ namespace Claunia.PropertyList } } + /// + /// Gets a value indicating whether this instance is read only. + /// + /// true if this instance is read only; otherwise, false. public bool IsReadOnly { get @@ -538,7 +641,10 @@ namespace Claunia.PropertyList #endregion #region IEnumerable implementation - + /// + /// Gets the enumerator. + /// + /// The enumerator. public IEnumerator> GetEnumerator() { return dict.GetEnumerator(); diff --git a/plist-cil/NSNumber.cs b/plist-cil/NSNumber.cs index 9a4e4df..2f101fb 100644 --- a/plist-cil/NSNumber.cs +++ b/plist-cil/NSNumber.cs @@ -96,9 +96,9 @@ namespace Claunia.PropertyList /// Creates a number from its textual representation. /// /// The textual representation of the number. - /// - /// - /// + /// + /// + /// public NSNumber(string text) { if (text == null) @@ -281,6 +281,11 @@ namespace Claunia.PropertyList return type == n.type && longValue == n.longValue && doubleValue == n.doubleValue && boolValue == n.boolValue; } + /// + /// Serves as a hash function for a object. + /// + /// A hash code for this instance that is suitable for use in hashing algorithms and data structures such as a + /// hash table. public override int GetHashCode() { int hash = type; @@ -290,6 +295,10 @@ namespace Claunia.PropertyList return hash; } + /// + /// Returns a that represents the current . + /// + /// A that represents the current . public override string ToString() { switch (type) @@ -437,6 +446,12 @@ namespace Claunia.PropertyList } } + /// + /// Compares the current to the specified object. + /// + /// 0 if the numbers are equal, 1 if the current is greater + /// than the argument and -1 if it is less, or the argument is not a number. + /// Object to compare to the current . public int CompareTo(Object o) { double x = ToDouble(); @@ -457,7 +472,7 @@ namespace Claunia.PropertyList /// /// Determines if an object is a number. - /// Substitutes Java's Number class comparison + /// Substitutes .NET's Number class comparison /// /// true if it is a number. /// Object. @@ -504,6 +519,12 @@ namespace Claunia.PropertyList return (double)0; } + /// + /// Determines whether the specified is equal to the current . + /// + /// The to compare with the current . + /// true if the specified is equal to the current + /// ; otherwise, false. public override bool Equals(NSObject obj) { if (!(obj is NSNumber)) diff --git a/plist-cil/NSObject.cs b/plist-cil/NSObject.cs index 49a2383..3ef2e52 100644 --- a/plist-cil/NSObject.cs +++ b/plist-cil/NSObject.cs @@ -377,8 +377,8 @@ namespace Claunia.PropertyList /// of the .NET Runtime Environment. ///
    ///
  • objects are converted to arrays.
  • - ///
  • objects are converted to objects extending the class.
  • - ///
  • objects are converted to objects extending the class.
  • + ///
  • objects are converted to objects extending the class.
  • + ///
  • objects are converted to objects extending the class.
  • ///
  • objects are converted to primitive number values (, , or ).
  • ///
  • objects are converted to objects.
  • ///
  • objects are converted to arrays.
  • @@ -486,6 +486,12 @@ namespace Claunia.PropertyList return false; } + /// + /// Determines if the specific NSObject is the same as the NSObject overriding this method + /// + /// The to compare with the current . + /// true if the specified is equal to the current + /// ; otherwise, false. public abstract bool Equals(NSObject obj); } } diff --git a/plist-cil/NSSet.cs b/plist-cil/NSSet.cs index 8cfaae7..f5b5849 100644 --- a/plist-cil/NSSet.cs +++ b/plist-cil/NSSet.cs @@ -31,7 +31,7 @@ namespace Claunia.PropertyList { /// /// A set is an interface to an unordered collection of objects. - /// This implementation uses a as the underlying + /// This implementation uses a as the underlying /// data structure. /// /// @author Daniel Dreibrodt @@ -250,6 +250,11 @@ namespace Claunia.PropertyList return set; } + /// + /// Serves as a hash function for a object. + /// + /// A hash code for this instance that is suitable for use in hashing algorithms and data structures such as a + /// hash table. public override int GetHashCode() { int hash = 7; @@ -257,6 +262,12 @@ namespace Claunia.PropertyList return hash; } + /// + /// Determines whether the specified is equal to the current . + /// + /// The to compare with the current . + /// true if the specified is equal to the current + /// ; otherwise, false. public override bool Equals(Object obj) { if (obj == null) @@ -423,6 +434,12 @@ namespace Claunia.PropertyList ascii.Append(ASCIIPropertyListParser.ARRAY_END_TOKEN); } + /// + /// Determines whether the specified is equal to the current . + /// + /// The to compare with the current . + /// true if the specified is equal to the current + /// ; otherwise, false. public override bool Equals(NSObject obj) { if (!(obj is NSSet)) diff --git a/plist-cil/NSString.cs b/plist-cil/NSString.cs index 782076f..43320ba 100644 --- a/plist-cil/NSString.cs +++ b/plist-cil/NSString.cs @@ -111,6 +111,12 @@ namespace Claunia.PropertyList Prepend(s.GetContent()); } + /// + /// Determines whether the specified is equal to the current . + /// + /// The to compare with the current . + /// true if the specified is equal to the current + /// ; otherwise, false. public override bool Equals(Object obj) { if (!(obj is NSString)) @@ -118,6 +124,11 @@ namespace Claunia.PropertyList return content.Equals(((NSString)obj).content); } + /// + /// Serves as a hash function for a object. + /// + /// A hash code for this instance that is suitable for use in hashing algorithms and data structures such as a + /// hash table. public override int GetHashCode() { return content.GetHashCode(); @@ -271,6 +282,11 @@ namespace Claunia.PropertyList return outString; } + /// + /// Compares the current to the specified object. + /// + /// A 32-bit signed integer that indicates the lexical relationship between the two comparands. + /// Object to compare to the current . public int CompareTo(Object o) { if (o is NSString) @@ -280,6 +296,12 @@ namespace Claunia.PropertyList return -1; } + /// + /// Determines whether the specified is equal to the current . + /// + /// The to compare with the current . + /// true if the specified is equal to the current + /// ; otherwise, false. public override bool Equals(NSObject obj) { if (!(obj is NSString)) diff --git a/plist-cil/UID.cs b/plist-cil/UID.cs index 7de3798..b9f0ec3 100644 --- a/plist-cil/UID.cs +++ b/plist-cil/UID.cs @@ -37,12 +37,21 @@ namespace Claunia.PropertyList readonly byte[] bytes; readonly string name; + /// + /// Initializes a new instance of the class. + /// + /// Name. + /// Bytes. public UID(String name, byte[] bytes) { this.name = name; this.bytes = bytes; } + /// + /// Gets the bytes. + /// + /// The bytes. public byte[] Bytes { get @@ -51,6 +60,10 @@ namespace Claunia.PropertyList } } + /// + /// Gets the name. + /// + /// The name. public string Name { get @@ -94,6 +107,12 @@ namespace Claunia.PropertyList ToASCII(ascii, level); } + /// + /// Determines whether the specified is equal to the current . + /// + /// The to compare with the current . + /// true if the specified is equal to the current + /// ; otherwise, false. public override bool Equals(NSObject obj) { if (!(obj is UID))