File: options_parser.h

package info (click to toggle)
tilemaker 3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 78,284 kB
  • sloc: cpp: 28,715; ansic: 4,052; makefile: 180; ruby: 77; sh: 6
file content (55 lines) | stat: -rw-r--r-- 1,177 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef OPTIONS_PARSER_H
#define OPTIONS_PARSER_H

#include <cstdint>
#include <exception>
#include <string>
#include <vector>

namespace OptionsParser {
	struct OptionException : std::exception {
		OptionException(std::string message): message(message) {}

		/// Returns the explanatory string.
		const char* what() const noexcept override {
				return message.data();
		}

		private:
			std::string message;
	};

	enum class OutputMode: char { File = 0, MBTiles = 1, PMTiles = 2 };

	struct OsmOptions {
		std::string storeFile;
		bool fast = false;
		bool compact = false;
		bool skipIntegrity = false;
		bool uncompressedNodes = false;
		bool uncompressedWays = false;
		bool materializeGeometries = false;
		bool shardStores = false;
	};

	struct Options {
		std::vector<std::string> inputFiles;
		std::string luaFile;
		std::string jsonFile;
		uint32_t threadNum = 0;
		std::string outputFile;
		std::string bbox;

		OsmOptions osm;
		bool showHelp = false;
		bool verbose = false;
		bool mergeSqlite = false;
		OutputMode outputMode = OutputMode::File;
		bool logTileTimings = false;
	};

	Options parse(const int argc, const char* argv[]);
	void showHelp();
};

#endif