Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3028


Ignore:
Timestamp:
03/15/10 12:01:10 (14 years ago)
Author:
epitzer
Message:

add more API docs (#548)

Location:
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlGenerator.cs

    r3016 r3028  
    189189    }
    190190
     191    /// <summary>
     192    /// Formats the specified type cache.
     193    /// </summary>
     194    /// <param name="typeCache">The type cache.</param>
     195    /// <returns>An enumerable of formatted type cache tags.</returns>
    191196    public IEnumerable<string> Format(List<TypeMapping> typeCache) {
    192197      yield return CreateNodeStart(XmlStringConstants.TYPECACHE);
     
    211216    /// <summary>
    212217    /// Serialize an object into a file.
    213     ///
    214218    /// The XML configuration is obtained from the <c>ConfigurationService</c>.
    215219    /// Needed assemblies are not included.
    216220    /// </summary>
     221    /// <param name="o">The object.</param>
     222    /// <param name="filename">The filename.</param>
    217223    /// <param name="compression">ZIP file compression level</param>
    218224    public static void Serialize(object o, string filename, int compression) {
     
    220226    }
    221227
     228    /// <summary>
     229    /// Serializes the specified object into a file.
     230    /// Needed assemblies are not included, ZIP compression level is set to 5.
     231    /// </summary>
     232    /// <param name="obj">The object.</param>
     233    /// <param name="filename">The filename.</param>
     234    /// <param name="config">The configuration.</param>
    222235    public static void Serialize(object obj, string filename, Configuration config) {
    223236      Serialize(obj, filename, config, false, 5);
    224237    }
    225238
     239    /// <summary>
     240    /// Serializes the specified object into a file.
     241    /// </summary>
     242    /// <param name="obj">The object.</param>
     243    /// <param name="filename">The filename.</param>
     244    /// <param name="config">The configuration.</param>
     245    /// <param name="includeAssemblies">if set to <c>true</c> include needed assemblies.</param>
     246    /// <param name="compression">The ZIP compression level.</param>
    226247    public static void Serialize(object obj, string filename, Configuration config, bool includeAssemblies, int compression) {     
    227248      try {
     
    278299    }
    279300
     301    /// <summary>
     302    /// Serializes the specified object into a stream using the <see cref="XmlFormat"/>
     303    /// obtained from the <see cref="ConfigurationService"/>.
     304    /// </summary>
     305    /// <param name="obj">The object.</param>
     306    /// <param name="stream">The stream.</param>
    280307    public static void Serialize(object obj, Stream stream) {
    281308      Serialize(obj, stream, ConfigurationService.Instance.GetConfiguration(new XmlFormat()));
     
    283310
    284311
     312    /// <summary>
     313    /// Serializes the specified object into a stream.
     314    /// </summary>
     315    /// <param name="obj">The object.</param>
     316    /// <param name="stream">The stream.</param>
     317    /// <param name="config">The configuration.</param>
    285318    public static void Serialize(object obj, Stream stream, Configuration config) {
    286319      Serialize(obj, stream, config, false);
    287320    }
    288321
    289     public static void Serialize(object obj, Stream stream, Configuration config, bool includeAssemblies) {
    290       Serialize(obj, stream, config, includeAssemblies, true);
    291     }
    292 
    293     public static void Serialize(object obj, Stream stream, Configuration config, bool includeAssemblies, bool interleaveTypeInfo) {     
     322    /// <summary>
     323    /// Serializes the specified object into a stream.
     324    /// </summary>
     325    /// <param name="obj">The object.</param>
     326    /// <param name="stream">The stream.</param>
     327    /// <param name="config">The configuration.</param>
     328    /// <param name="includeAssemblies">if set to <c>true</c> include need assemblies.</param>
     329    public static void Serialize(object obj, Stream stream, Configuration config, bool includeAssemblies) {     
    294330      try {
    295331        using (StreamWriter writer = new StreamWriter(new GZipStream(stream, CompressionMode.Compress))) {
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlParser.cs

    r3005 r3028  
    1212namespace HeuristicLab.Persistence.Default.Xml {
    1313
     14  /// <summary>
     15  /// Main entry point of persistence loading from XML. Use the static
     16  /// methods to load from a file or stream.
     17  /// </summary>
    1418  public class XmlParser : IEnumerable<ISerializationToken> {
    1519
     
    1822    private readonly Dictionary<string, Handler> handlers;
    1923
     24    /// <summary>
     25    /// Initializes a new instance of the <see cref="XmlParser"/> class.
     26    /// </summary>
     27    /// <param name="input">The input.</param>
    2028    public XmlParser(TextReader input) {
    2129      XmlReaderSettings settings = new XmlReaderSettings {
     
    3543    }
    3644
     45    /// <summary>
     46    /// Returns an enumerator that iterates through the serialization tokens.
     47    /// </summary>
     48    /// <returns>
     49    /// An that can be used to iterate through the collection of serialization tokens.
     50    /// </returns>
    3751    public IEnumerator<ISerializationToken> GetEnumerator() {
    3852      while (reader.Read()) {
     
    5266        }
    5367      }
     68    }
     69
     70    /// <summary>
     71    /// Returns an enumerator that iterates through the serialization tokens.
     72    /// </summary>
     73    /// <returns>
     74    /// An that can be used to iterate through the collection of serialization tokens.
     75    /// </returns>
     76    IEnumerator IEnumerable.GetEnumerator() {
     77      return GetEnumerator();
    5478    }
    5579
     
    115139    }
    116140
    117     IEnumerator IEnumerable.GetEnumerator() {
    118       return GetEnumerator();
    119     }
    120 
     141    /// <summary>
     142    /// Parses the type cache.
     143    /// </summary>
     144    /// <param name="reader">The reader.</param>
     145    /// <returns>A list of type mapping entries.</returns>
    121146    public static List<TypeMapping> ParseTypeCache(TextReader reader) {
    122147      try {
     
    139164    }
    140165
     166    /// <summary>
     167    /// Deserializes an object from the specified filename.
     168    /// </summary>
     169    /// <param name="filename">The filename.</param>
     170    /// <returns>A fresh object instance</returns>
    141171    public static object Deserialize(string filename) {
    142172      using (ZipFile file = new ZipFile(filename)) {
     
    145175    }
    146176
     177    /// <summary>
     178    /// Deserializes the specified filename.
     179    /// </summary>
     180    /// <typeparam name="T">object type expected from the serialized file</typeparam>
     181    /// <param name="filename">The filename.</param>
     182    /// <returns>A fresh object of type T</returns>
     183    public static T Deserialize<T>(string filename) {
     184      return (T)Deserialize(filename);
     185    }
     186
     187
     188    /// <summary>
     189    /// Deserializes an object from the specified stream.
     190    /// </summary>
     191    /// <param name="stream">The stream.</param>
     192    /// <returns>A fresh object instance.</returns>
    147193    public static object Deserialize(Stream stream) {
    148194      try {
     
    157203        throw new PersistenceException("Unexpected exception during deserialization", x);
    158204      }
     205    }
     206
     207    /// <summary>
     208    /// Deserializes an object from the specified stream.
     209    /// </summary>
     210    /// <typeparam name="T">object type expected from the serialized stream</typeparam>
     211    /// <param name="stream">The stream.</param>
     212    /// <returns>A fresh object instance.</returns>
     213    public static T Deserialize<T>(Stream stream) {
     214      return (T)Deserialize(stream);
    159215    }
    160216
Note: See TracChangeset for help on using the changeset viewer.