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) | ||||
|         { | ||||
|             const auto& name = flag->name(); | ||||
|             if (flags_by_name.find(name) != flags_by_name.end()) | ||||
|                 Error() << "two flags use the name '" << name << "'"; | ||||
|             flags_by_name[name] = flag; | ||||
|             for (const auto& name : flag->names()) | ||||
|             { | ||||
|                 if (flags_by_name.find(name) != flags_by_name.end()) | ||||
|                     Error() << "two flags use the name '" << name << "'"; | ||||
|                 flags_by_name[name] = flag; | ||||
|             } | ||||
|  | ||||
|             all_flags.push_back(flag); | ||||
|         } | ||||
| @@ -60,6 +62,7 @@ void FlagGroup::parseFlags(int argc, const char* argv[]) | ||||
|         group->_initialised = true; | ||||
|     }; | ||||
|     recurse(this); | ||||
|     recurse(&helpGroup); | ||||
|  | ||||
|     /* Now actually parse them. */ | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,10 @@ | ||||
| #ifndef FLUXSOURCE_H | ||||
| #define FLUXSOURCE_H | ||||
|  | ||||
| #include "flags.h" | ||||
|  | ||||
| extern FlagGroup hardwareFluxSourceFlags; | ||||
|  | ||||
| class Fluxmap; | ||||
| class DataSpec; | ||||
|  | ||||
|   | ||||
| @@ -16,7 +16,7 @@ | ||||
| #include "track.h" | ||||
| #include "fmt/format.h" | ||||
|  | ||||
| FlagGroup readerFlags; | ||||
| FlagGroup readerFlags { &hardwareFluxSourceFlags, &fluxmapReaderFlags }; | ||||
|  | ||||
| static DataSpecFlag source( | ||||
|     { "--source", "-s" }, | ||||
|   | ||||
| @@ -1,11 +1,15 @@ | ||||
| #ifndef READER_H | ||||
| #define READER_H | ||||
|  | ||||
| #include "flags.h" | ||||
|  | ||||
| class Fluxmap; | ||||
| class FluxSource; | ||||
| class AbstractDecoder; | ||||
| class Track; | ||||
|  | ||||
| extern FlagGroup readerFlags; | ||||
|  | ||||
| extern void setReaderDefaultSource(const std::string& source); | ||||
| extern void setReaderRevolutions(int revolutions); | ||||
|  | ||||
|   | ||||
| @@ -10,7 +10,7 @@ | ||||
| #include "fluxsink.h" | ||||
| #include "fmt/format.h" | ||||
|  | ||||
| FlagGroup writerFlags; | ||||
| FlagGroup writerFlags { &hardwareFluxSourceFlags }; | ||||
|  | ||||
| static DataSpecFlag dest( | ||||
|     { "--dest", "-d" }, | ||||
|   | ||||
| @@ -1,6 +1,10 @@ | ||||
| #ifndef WRITER_H | ||||
| #define WRITER_H | ||||
|  | ||||
| #include "flags.h" | ||||
|  | ||||
| extern FlagGroup writerFlags; | ||||
|  | ||||
| class Fluxmap; | ||||
|  | ||||
| extern void setWriterDefaultDest(const std::string& dest); | ||||
|   | ||||
| @@ -10,7 +10,7 @@ | ||||
| #include "ibm.h" | ||||
| #include <fmt/format.h> | ||||
|  | ||||
| FlagGroup flags; | ||||
| FlagGroup flags { &readerFlags }; | ||||
|  | ||||
| static StringFlag outputFilename( | ||||
|     { "--output", "-o" }, | ||||
|   | ||||
| @@ -10,7 +10,7 @@ | ||||
| #include "aeslanier.h" | ||||
| #include <fmt/format.h> | ||||
|  | ||||
| FlagGroup flags; | ||||
| FlagGroup flags { &readerFlags }; | ||||
|  | ||||
| static StringFlag outputFilename( | ||||
|     { "--output", "-o" }, | ||||
|   | ||||
| @@ -11,7 +11,7 @@ | ||||
| #include <fmt/format.h> | ||||
| #include <fstream> | ||||
|  | ||||
| FlagGroup flags; | ||||
| FlagGroup flags { &readerFlags }; | ||||
|  | ||||
| static StringFlag outputFilename( | ||||
|     { "--output", "-o" }, | ||||
|   | ||||
| @@ -10,7 +10,7 @@ | ||||
| #include "ibm.h" | ||||
| #include <fmt/format.h> | ||||
|  | ||||
| FlagGroup flags; | ||||
| FlagGroup flags { &readerFlags }; | ||||
|  | ||||
| static StringFlag outputFilename( | ||||
|     { "--output", "-o" }, | ||||
|   | ||||
| @@ -11,7 +11,7 @@ | ||||
| #include <fmt/format.h> | ||||
| #include <fstream> | ||||
|  | ||||
| FlagGroup flags; | ||||
| FlagGroup flags { &readerFlags }; | ||||
|  | ||||
| static StringFlag outputFilename( | ||||
|     { "--output", "-o" }, | ||||
|   | ||||
| @@ -11,7 +11,7 @@ | ||||
| #include <fmt/format.h> | ||||
| #include <fstream> | ||||
|  | ||||
| FlagGroup flags; | ||||
| FlagGroup flags { &readerFlags }; | ||||
|  | ||||
| static StringFlag outputFilename( | ||||
|     { "--output", "-o" }, | ||||
|   | ||||
| @@ -11,7 +11,7 @@ | ||||
| #include <fmt/format.h> | ||||
| #include <fstream> | ||||
|  | ||||
| FlagGroup flags; | ||||
| FlagGroup flags { &readerFlags }; | ||||
|  | ||||
| static StringFlag outputFilename( | ||||
|     { "--output", "-o" }, | ||||
|   | ||||
| @@ -10,7 +10,7 @@ | ||||
| #include "ibm.h" | ||||
| #include <fmt/format.h> | ||||
|  | ||||
| FlagGroup flags; | ||||
| FlagGroup flags { &readerFlags }; | ||||
|  | ||||
| static StringFlag outputFilename( | ||||
|     { "--output", "-o" }, | ||||
|   | ||||
| @@ -11,7 +11,7 @@ | ||||
| #include <fmt/format.h> | ||||
| #include <fstream> | ||||
|  | ||||
| FlagGroup flags; | ||||
| FlagGroup flags { &readerFlags }; | ||||
|  | ||||
| static StringFlag outputFilename( | ||||
|     { "--output", "-o" }, | ||||
|   | ||||
| @@ -10,7 +10,7 @@ | ||||
| #include "fb100.h" | ||||
| #include <fmt/format.h> | ||||
|  | ||||
| FlagGroup flags; | ||||
| FlagGroup flags { &readerFlags }; | ||||
|  | ||||
| static StringFlag outputFilename( | ||||
|     { "--output", "-o" }, | ||||
|   | ||||
| @@ -10,7 +10,7 @@ | ||||
| #include "ibm.h" | ||||
| #include <fmt/format.h> | ||||
|  | ||||
| FlagGroup flags; | ||||
| FlagGroup flags { &readerFlags }; | ||||
|  | ||||
| static StringFlag outputFilename( | ||||
|     { "--output", "-o" }, | ||||
|   | ||||
| @@ -11,7 +11,7 @@ | ||||
| #include <fmt/format.h> | ||||
| #include <fstream> | ||||
|  | ||||
| FlagGroup flags; | ||||
| FlagGroup flags { &readerFlags }; | ||||
|  | ||||
| static StringFlag outputFilename( | ||||
|     { "--output", "-o" }, | ||||
|   | ||||
| @@ -11,7 +11,7 @@ | ||||
| #include <fmt/format.h> | ||||
| #include <fstream> | ||||
|  | ||||
| FlagGroup flags; | ||||
| FlagGroup flags { &readerFlags }; | ||||
|  | ||||
| static StringFlag outputFilename( | ||||
|     { "--output", "-o" }, | ||||
|   | ||||
| @@ -10,7 +10,7 @@ | ||||
| #include "zilogmcz.h" | ||||
| #include <fmt/format.h> | ||||
|  | ||||
| FlagGroup flags; | ||||
| FlagGroup flags { &readerFlags }; | ||||
|  | ||||
| static StringFlag outputFilename( | ||||
|     { "--output", "-o" }, | ||||
|   | ||||
| @@ -11,7 +11,7 @@ | ||||
| #include <fstream> | ||||
| #include <ctype.h> | ||||
|  | ||||
| FlagGroup flags; | ||||
| FlagGroup flags { &writerFlags }; | ||||
|  | ||||
| static StringFlag inputFilename( | ||||
|     { "--input", "-i" }, | ||||
|   | ||||
| @@ -10,7 +10,7 @@ | ||||
| #include <fstream> | ||||
| #include <ctype.h> | ||||
|  | ||||
| FlagGroup flags; | ||||
| FlagGroup flags { &writerFlags }; | ||||
|  | ||||
| int main(int argc, const char* argv[]) | ||||
| { | ||||
|   | ||||
| @@ -8,7 +8,7 @@ | ||||
| #include <fstream> | ||||
| #include <ctype.h> | ||||
|  | ||||
| FlagGroup flags; | ||||
| FlagGroup flags { &writerFlags }; | ||||
|  | ||||
| static DoubleFlag interval( | ||||
| 	{ "--interval" }, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user