-revert janderwalds change until because it breaks the gcc 4.x build
[reactos.git] / irc / TechBot / CHMLibrary / InformationType.cs
1 using System;
2 using System.IO;
3
4 namespace HtmlHelp
5 {
6 /// <summary>
7 /// Enumeration for specifying the mode of the information type
8 /// </summary>
9 public enum InformationTypeMode
10 {
11 /// <summary>
12 /// Inclusive information type. The user will be allowed to select from one or more information types.
13 /// </summary>
14 Inclusive = 0,
15 /// <summary>
16 /// Exclusive information type. The user will be allowed to choose only one information type within each category
17 /// </summary>
18 Exclusive = 1,
19 /// <summary>
20 /// Hidden information type. The user cannot see this information types (only for API calls).
21 /// </summary>
22 Hidden = 2
23 }
24
25 /// <summary>
26 /// The class <c>InformationType</c> implements a methods/properties for an information type.
27 /// </summary>
28 /// <remarks>Note: Information types and categories allow users to filter help contents.
29 /// They are only supported if using sitemap TOC and/or sitemap Index.</remarks>
30 public class InformationType
31 {
32 private string _name = "";
33 private string _description = "";
34 private InformationTypeMode _typeMode = InformationTypeMode.Inclusive;
35 private bool _isInCategory = false;
36 private int _referenceCount = 1;
37
38 /// <summary>
39 /// Standard constructor
40 /// </summary>
41 /// <remarks>the mode is set to InformationTypeMode.Inclusive by default</remarks>
42 public InformationType() : this("","")
43 {
44 }
45
46 /// <summary>
47 /// Standard constructor
48 /// </summary>
49 /// <param name="name">name of the information type</param>
50 /// <param name="description">description</param>
51 /// <remarks>the mode is set to InformationTypeMode.Inclusive by default</remarks>
52 public InformationType(string name, string description) : this(name, description, InformationTypeMode.Inclusive)
53 {
54 }
55
56 /// <summary>
57 /// Standard constructor
58 /// </summary>
59 /// <param name="name">name of the information type</param>
60 /// <param name="description">description</param>
61 /// <param name="mode">mode of the information type</param>
62 public InformationType(string name, string description, InformationTypeMode mode)
63 {
64 _name = name;
65 _description = description;
66 _typeMode = mode;
67 }
68
69 #region Data dumping
70 /// <summary>
71 /// Dump the class data to a binary writer
72 /// </summary>
73 /// <param name="writer">writer to write the data</param>
74 internal void Dump(ref BinaryWriter writer)
75 {
76 writer.Write( (int)_typeMode );
77 writer.Write( _name );
78 writer.Write( _description );
79 }
80
81 /// <summary>
82 /// Reads the object data from a dump store
83 /// </summary>
84 /// <param name="reader">reader to read the data</param>
85 internal void ReadDump(ref BinaryReader reader)
86 {
87 _typeMode = (InformationTypeMode)reader.ReadInt32();
88 _name = reader.ReadString();
89 _description = reader.ReadString();
90 }
91 #endregion
92
93 /// <summary>
94 /// Sets the flag if this information type is nested in at least one category
95 /// </summary>
96 /// <param name="newValue">true or false</param>
97 internal void SetCategoryFlag(bool newValue)
98 {
99 _isInCategory = newValue;
100 }
101
102 /// <summary>
103 /// Gets/Sets the reference count of this information type instance
104 /// </summary>
105 internal int ReferenceCount
106 {
107 get { return _referenceCount; }
108 set { _referenceCount = value; }
109 }
110
111 /// <summary>
112 /// Gets true if this information type is nested in at least one category
113 /// </summary>
114 public bool IsInCategory
115 {
116 get { return _isInCategory; }
117 }
118
119 /// <summary>
120 /// Gets/Sets the name of the information type
121 /// </summary>
122 public string Name
123 {
124 get { return _name; }
125 set { _name = value; }
126 }
127
128 /// <summary>
129 /// Gets/Sets the description of the information type
130 /// </summary>
131 public string Description
132 {
133 get { return _description; }
134 set { _name = value; }
135 }
136
137 /// <summary>
138 /// Gets/Sets the mode of the information type
139 /// </summary>
140 public InformationTypeMode Mode
141 {
142 get { return _typeMode; }
143 set { _typeMode = value; }
144 }
145 }
146 }