mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
I... think it's done? That was suspiciously easy.
This commit is contained in:
11
lib/flags.cc
11
lib/flags.cc
@@ -49,10 +49,12 @@ void FlagGroup::parseFlags(int argc, const char* argv[])
|
|||||||
|
|
||||||
for (Flag* flag : group->_flags)
|
for (Flag* flag : group->_flags)
|
||||||
{
|
{
|
||||||
const auto& name = flag->name();
|
for (const auto& name : flag->names())
|
||||||
if (flags_by_name.find(name) != flags_by_name.end())
|
{
|
||||||
Error() << "two flags use the name '" << name << "'";
|
if (flags_by_name.find(name) != flags_by_name.end())
|
||||||
flags_by_name[name] = flag;
|
Error() << "two flags use the name '" << name << "'";
|
||||||
|
flags_by_name[name] = flag;
|
||||||
|
}
|
||||||
|
|
||||||
all_flags.push_back(flag);
|
all_flags.push_back(flag);
|
||||||
}
|
}
|
||||||
@@ -60,6 +62,7 @@ void FlagGroup::parseFlags(int argc, const char* argv[])
|
|||||||
group->_initialised = true;
|
group->_initialised = true;
|
||||||
};
|
};
|
||||||
recurse(this);
|
recurse(this);
|
||||||
|
recurse(&helpGroup);
|
||||||
|
|
||||||
/* Now actually parse them. */
|
/* Now actually parse them. */
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
#ifndef FLUXSOURCE_H
|
#ifndef FLUXSOURCE_H
|
||||||
#define FLUXSOURCE_H
|
#define FLUXSOURCE_H
|
||||||
|
|
||||||
|
#include "flags.h"
|
||||||
|
|
||||||
|
extern FlagGroup hardwareFluxSourceFlags;
|
||||||
|
|
||||||
class Fluxmap;
|
class Fluxmap;
|
||||||
class DataSpec;
|
class DataSpec;
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
#include "track.h"
|
#include "track.h"
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
|
|
||||||
FlagGroup readerFlags;
|
FlagGroup readerFlags { &hardwareFluxSourceFlags, &fluxmapReaderFlags };
|
||||||
|
|
||||||
static DataSpecFlag source(
|
static DataSpecFlag source(
|
||||||
{ "--source", "-s" },
|
{ "--source", "-s" },
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
#ifndef READER_H
|
#ifndef READER_H
|
||||||
#define READER_H
|
#define READER_H
|
||||||
|
|
||||||
|
#include "flags.h"
|
||||||
|
|
||||||
class Fluxmap;
|
class Fluxmap;
|
||||||
class FluxSource;
|
class FluxSource;
|
||||||
class AbstractDecoder;
|
class AbstractDecoder;
|
||||||
class Track;
|
class Track;
|
||||||
|
|
||||||
|
extern FlagGroup readerFlags;
|
||||||
|
|
||||||
extern void setReaderDefaultSource(const std::string& source);
|
extern void setReaderDefaultSource(const std::string& source);
|
||||||
extern void setReaderRevolutions(int revolutions);
|
extern void setReaderRevolutions(int revolutions);
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "fluxsink.h"
|
#include "fluxsink.h"
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
|
|
||||||
FlagGroup writerFlags;
|
FlagGroup writerFlags { &hardwareFluxSourceFlags };
|
||||||
|
|
||||||
static DataSpecFlag dest(
|
static DataSpecFlag dest(
|
||||||
{ "--dest", "-d" },
|
{ "--dest", "-d" },
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
#ifndef WRITER_H
|
#ifndef WRITER_H
|
||||||
#define WRITER_H
|
#define WRITER_H
|
||||||
|
|
||||||
|
#include "flags.h"
|
||||||
|
|
||||||
|
extern FlagGroup writerFlags;
|
||||||
|
|
||||||
class Fluxmap;
|
class Fluxmap;
|
||||||
|
|
||||||
extern void setWriterDefaultDest(const std::string& dest);
|
extern void setWriterDefaultDest(const std::string& dest);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "ibm.h"
|
#include "ibm.h"
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
FlagGroup flags;
|
FlagGroup flags { &readerFlags };
|
||||||
|
|
||||||
static StringFlag outputFilename(
|
static StringFlag outputFilename(
|
||||||
{ "--output", "-o" },
|
{ "--output", "-o" },
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "aeslanier.h"
|
#include "aeslanier.h"
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
FlagGroup flags;
|
FlagGroup flags { &readerFlags };
|
||||||
|
|
||||||
static StringFlag outputFilename(
|
static StringFlag outputFilename(
|
||||||
{ "--output", "-o" },
|
{ "--output", "-o" },
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
FlagGroup flags;
|
FlagGroup flags { &readerFlags };
|
||||||
|
|
||||||
static StringFlag outputFilename(
|
static StringFlag outputFilename(
|
||||||
{ "--output", "-o" },
|
{ "--output", "-o" },
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "ibm.h"
|
#include "ibm.h"
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
FlagGroup flags;
|
FlagGroup flags { &readerFlags };
|
||||||
|
|
||||||
static StringFlag outputFilename(
|
static StringFlag outputFilename(
|
||||||
{ "--output", "-o" },
|
{ "--output", "-o" },
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
FlagGroup flags;
|
FlagGroup flags { &readerFlags };
|
||||||
|
|
||||||
static StringFlag outputFilename(
|
static StringFlag outputFilename(
|
||||||
{ "--output", "-o" },
|
{ "--output", "-o" },
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
FlagGroup flags;
|
FlagGroup flags { &readerFlags };
|
||||||
|
|
||||||
static StringFlag outputFilename(
|
static StringFlag outputFilename(
|
||||||
{ "--output", "-o" },
|
{ "--output", "-o" },
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
FlagGroup flags;
|
FlagGroup flags { &readerFlags };
|
||||||
|
|
||||||
static StringFlag outputFilename(
|
static StringFlag outputFilename(
|
||||||
{ "--output", "-o" },
|
{ "--output", "-o" },
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "ibm.h"
|
#include "ibm.h"
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
FlagGroup flags;
|
FlagGroup flags { &readerFlags };
|
||||||
|
|
||||||
static StringFlag outputFilename(
|
static StringFlag outputFilename(
|
||||||
{ "--output", "-o" },
|
{ "--output", "-o" },
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
FlagGroup flags;
|
FlagGroup flags { &readerFlags };
|
||||||
|
|
||||||
static StringFlag outputFilename(
|
static StringFlag outputFilename(
|
||||||
{ "--output", "-o" },
|
{ "--output", "-o" },
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "fb100.h"
|
#include "fb100.h"
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
FlagGroup flags;
|
FlagGroup flags { &readerFlags };
|
||||||
|
|
||||||
static StringFlag outputFilename(
|
static StringFlag outputFilename(
|
||||||
{ "--output", "-o" },
|
{ "--output", "-o" },
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "ibm.h"
|
#include "ibm.h"
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
FlagGroup flags;
|
FlagGroup flags { &readerFlags };
|
||||||
|
|
||||||
static StringFlag outputFilename(
|
static StringFlag outputFilename(
|
||||||
{ "--output", "-o" },
|
{ "--output", "-o" },
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
FlagGroup flags;
|
FlagGroup flags { &readerFlags };
|
||||||
|
|
||||||
static StringFlag outputFilename(
|
static StringFlag outputFilename(
|
||||||
{ "--output", "-o" },
|
{ "--output", "-o" },
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
FlagGroup flags;
|
FlagGroup flags { &readerFlags };
|
||||||
|
|
||||||
static StringFlag outputFilename(
|
static StringFlag outputFilename(
|
||||||
{ "--output", "-o" },
|
{ "--output", "-o" },
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "zilogmcz.h"
|
#include "zilogmcz.h"
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
FlagGroup flags;
|
FlagGroup flags { &readerFlags };
|
||||||
|
|
||||||
static StringFlag outputFilename(
|
static StringFlag outputFilename(
|
||||||
{ "--output", "-o" },
|
{ "--output", "-o" },
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
FlagGroup flags;
|
FlagGroup flags { &writerFlags };
|
||||||
|
|
||||||
static StringFlag inputFilename(
|
static StringFlag inputFilename(
|
||||||
{ "--input", "-i" },
|
{ "--input", "-i" },
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
FlagGroup flags;
|
FlagGroup flags { &writerFlags };
|
||||||
|
|
||||||
int main(int argc, const char* argv[])
|
int main(int argc, const char* argv[])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
FlagGroup flags;
|
FlagGroup flags { &writerFlags };
|
||||||
|
|
||||||
static DoubleFlag interval(
|
static DoubleFlag interval(
|
||||||
{ "--interval" },
|
{ "--interval" },
|
||||||
|
|||||||
Reference in New Issue
Block a user