MCPcopy Create free account
hub / github.com/PDAL/PDAL / parseArgs

Method parseArgs

tools/nitfwrap/NitfWrap.cpp:168–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166
167
168bool NitfWrap::parseArgs(std::vector<std::string>& argList)
169{
170 ProgramArgs args;
171
172 args.add("input,i", "Input filename", m_inputFile).setPositional();
173 args.add("output,o", "Output filename",
174 m_outputFile).setOptionalPositional();
175 args.add("unwrap,u", "Unwrap NITF file", m_unwrap);
176 try
177 {
178 m_nitfWriter.addArgs(args);
179 }
180 catch (arg_error& e)
181 {
182 throw error(e.m_error);
183 }
184
185 try
186 {
187 args.parse(argList);
188 }
189 catch (arg_error& e)
190 {
191 std::cerr << "nitfwrap: " << e.m_error << std::endl;
192 outputHelp(args);
193 return false;
194 }
195
196 if (!FileUtils::fileExists(m_inputFile))
197 {
198 std::ostringstream oss;
199
200 oss << "Input file '" << m_inputFile << "' doesn't exist.";
201 throw error(oss.str());
202 }
203 if (m_outputFile.empty())
204 if (!m_unwrap)
205 m_outputFile = FileUtils::stem(m_inputFile) + ".ntf";
206 return true;
207}
208
209
210void NitfWrap::verify(BOX3D& bounds)

Callers

nothing calls this directly

Calls 9

outputHelpFunction · 0.85
stemFunction · 0.85
strMethod · 0.80
errorClass · 0.70
fileExistsFunction · 0.50
addMethod · 0.45
addArgsMethod · 0.45
parseMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected