public override void Parse(ArgsIterator iter) { if (!iter.HasNext()) { throw new CommandLineException("Filename expected"); } m_fileName = iter.Next(); }
public void Parse(String[] args) { ArgsIterator iter = new ArgsIterator(args); while (iter.HasNext()) { String arg = iter.Next(); if (arg.StartsWith("--")) { String longParam = arg.Substring(2); if (longParam.Length == 0) { throw new CommandLineException("Long param expected"); } CommandLineEntry entry = FindEntry(longParam, false); if (entry == null) { throw new CommandLineException("Unknown param: " + arg); } entry.Parse(iter); } else if (arg.StartsWith("-")) { String shortParam = arg.Substring(1); if (shortParam.Length == 0) { throw new CommandLineException("Short param expected"); } CommandLineEntry entry = FindEntry(shortParam, true); if (entry == null) { throw new CommandLineException("Unknown param: " + arg); } entry.Parse(iter); } else { if (m_defaultEntry == null) { throw new CommandLineException("Default entry is not set"); } m_defaultEntry.Parse(iter); } } }
public abstract void Parse(ArgsIterator iter);