Last change
on this file since 457 was 457, checked in by coas-nagasima, 4 years ago |
ファイルを追加
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csharp;charset=UTF-8
|
File size:
1.5 KB
|
Rev | Line | |
---|
[457] | 1 | /*
|
---|
| 2 | * Created by SharpDevelop.
|
---|
| 3 | * User: lextm
|
---|
| 4 | * Date: 2008/5/31
|
---|
| 5 | * Time: 12:07
|
---|
| 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.Elements
|
---|
| 13 | {
|
---|
| 14 | public sealed class ImportsFrom
|
---|
| 15 | {
|
---|
| 16 | private readonly string _module;
|
---|
| 17 | private readonly List<string> _types = new List<string>();
|
---|
| 18 |
|
---|
| 19 | public ImportsFrom(Symbol last, ISymbolEnumerator symbols)
|
---|
| 20 | {
|
---|
| 21 | Symbol previous = last;
|
---|
| 22 | Symbol current;
|
---|
| 23 | while ((current = symbols.NextSymbol()) != Symbol.From)
|
---|
| 24 | {
|
---|
| 25 | if (current == Symbol.EOL)
|
---|
| 26 | {
|
---|
| 27 | continue;
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | if (current == Symbol.Comma)
|
---|
| 31 | {
|
---|
| 32 | previous.AssertIsValidIdentifier();
|
---|
| 33 | _types.Add(previous.ToString());
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | previous = current;
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | previous.AssertIsValidIdentifier();
|
---|
| 40 | _types.Add(previous.ToString());
|
---|
| 41 |
|
---|
| 42 | _module = symbols.NextSymbol().ToString().ToUpperInvariant(); // module names are uppercase
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | public string Module
|
---|
| 46 | {
|
---|
| 47 | get { return _module; }
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | public IList<string> Types
|
---|
| 51 | {
|
---|
| 52 | get { return _types; }
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | public override string ToString()
|
---|
| 56 | {
|
---|
| 57 | return string.Join(", ", _types.ToArray()) + " FROM " + _module;
|
---|
| 58 | }
|
---|
| 59 | }
|
---|
| 60 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.