1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
/*
* Created by SharpDevelop.
* User: lextm
* Date: 2008/5/31
* Time: 12:07
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System.Collections.Generic;
namespace Lextm.SharpSnmpLib.Mib.Elements
{
/// <summary>
/// The IMPORTS construct is used to specify items used in the current MIB module which are defined in another MIB module or ASN.1 module.
/// </summary>
public sealed class Imports : List<ImportsFrom>, IElement
{
private IModule _module;
/// <summary>
/// Creates an <see cref="Imports"/> instance.
/// </summary>
/// <param name="lexer"></param>
public Imports(IModule module, ISymbolEnumerator symbols)
{
_module = module;
Symbol current;
while ((current = symbols.NextSymbol()) != Symbol.Semicolon)
{
if (current == Symbol.EOL)
{
continue;
}
ImportsFrom imports = new ImportsFrom(current, symbols);
this.Add(imports);
}
}
public IList<string> Dependents
{
get
{
List<string> result = new List<string>();
foreach (ImportsFrom import in this)
{
result.Add(import.Module);
}
return result;
}
}
public ImportsFrom GetImportFromType(string type)
{
foreach (ImportsFrom import in this)
{
if (import.Types.Contains(type))
{
return import;
}
}
return null;
}
#region IElement Member
public IModule Module
{
get { return _module; }
}
#endregion
}
}
|