| 1 |
/* |
| 2 |
* Created by SharpDevelop. |
| 3 |
* User: lextm |
| 4 |
* Date: 2008/5/17 |
| 5 |
* Time: 17:38 |
| 6 |
* |
| 7 |
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
| 8 |
*/ |
| 9 |
|
| 10 |
using System.Collections.Generic; |
| 11 |
|
| 12 |
namespace Lextm.SharpSnmpLib.Mib |
| 13 |
{ |
| 14 |
/// <summary> |
| 15 |
/// MIB document. |
| 16 |
/// </summary> |
| 17 |
public sealed class MibDocument |
| 18 |
{ |
| 19 |
private readonly List<IModule> _modules = new List<IModule>(); |
| 20 |
|
| 21 |
/// <summary> |
| 22 |
/// Initializes a new instance of the <see cref="MibDocument" /> class. |
| 23 |
/// </summary> |
| 24 |
/// <param name="file">The file.</param> |
| 25 |
public MibDocument(string file) |
| 26 |
: this(new Lexer(file)) |
| 27 |
{ |
| 28 |
} |
| 29 |
|
| 30 |
/// <summary> |
| 31 |
/// Initializes a new instance of the <see cref="MibDocument"/> class. |
| 32 |
/// </summary> |
| 33 |
/// <param name="lexer">The lexer.</param> |
| 34 |
public MibDocument(Lexer lexer) |
| 35 |
{ |
| 36 |
ISymbolEnumerator symbols = lexer.GetEnumerator(); |
| 37 |
|
| 38 |
Symbol current; |
| 39 |
while ((current = symbols.NextNonEOLSymbol()) != null) |
| 40 |
{ |
| 41 |
symbols.PutBack(current); |
| 42 |
_modules.Add(new MibModule(symbols)); |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
/// <summary> |
| 47 |
/// <see cref="MibModule"/> containing in this document. |
| 48 |
/// </summary> |
| 49 |
public IList<IModule> Modules |
| 50 |
{ |
| 51 |
get |
| 52 |
{ |
| 53 |
return _modules; |
| 54 |
} |
| 55 |
} |
| 56 |
} |
| 57 |
} |