Libosmium 2.22.0 Fast and flexible C++ library for working with OpenStreetMap data

Loading...
Searching...
No Matches
file_format.hpp
Go to the documentation of this file.
1#ifndef OSMIUM_IO_FILE_FORMAT_HPP
2#define OSMIUM_IO_FILE_FORMAT_HPP
3
4/*
5
6 This file is part of Osmium (https://osmcode.org/libosmium).
7
8 Copyright 2013-2025 Jochen Topf <jochen@topf.org> and others (see README).
9
10 Boost Software License - Version 1.0 - August 17th, 2003
11
12 Permission is hereby granted, free of charge, to any person or organization
13 obtaining a copy of the software and accompanying documentation covered by
14 this license (the "Software") to use, reproduce, display, distribute,
15 execute, and transmit the Software, and to prepare derivative works of the
16 Software, and to permit third-parties to whom the Software is furnished to
17 do so, all subject to the following:
18
19 The copyright notices in the Software and this entire statement, including
20 the above license grant, this restriction and the following disclaimer,
21 must be included in all copies of the Software, in whole or in part, and
22 all derivative works of the Software, unless such copies or derivative
23 works are solely in the form of machine-executable object code generated by
24 a source language processor.
25
26 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
29 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
30 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
31 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
32 DEALINGS IN THE SOFTWARE.
33
34*/
35
36#include <iosfwd>
37
38 namespace osmium {
39
40 namespace io {
41
42 enum class file_format {
43 unknown = 0,
44 xml = 1,
45 pbf = 2,
46 opl = 3,
47 json = 4,
48 o5m = 5,
49 debug = 6,
50 blackhole = 7,
51 ids = 8,
52 last = 8 // must have the same value as the last real value
53 };
54
55 enum class read_meta {
56 no = 0,
57 yes = 1
58 };
59
60 enum class buffers_type {
61 any = 0,
62 single = 1
63 };
64
65 inline const char* as_string(const file_format format) noexcept {
66 switch (format) {
67 case file_format::xml:
68 return "XML";
69 case file_format::pbf:
70 return "PBF";
71 case file_format::opl:
72 return "OPL";
73 case file_format::json:
74 return "JSON";
75 case file_format::o5m:
76 return "O5M";
77 case file_format::debug:
78 return "DEBUG";
79 case file_format::blackhole:
80 return "BLACKHOLE";
81 case file_format::ids:
82 return "IDS";
83 default: // file_format::unknown
84 break;
85 }
86 return "unknown";
87 }
88
89 template <typename TChar, typename TTraits>
90 inline std::basic_ostream<TChar, TTraits>& operator<<(std::basic_ostream<TChar, TTraits>& out, const file_format format) {
91 return out << as_string(format);
92 }
93
94 } // namespace io
95
96} // namespace osmium
97
98#endif // OSMIUM_IO_FILE_FORMAT_HPP
osmium::io::file_format
file_format
Definition file_format.hpp:42
osmium::io::file_format::xml
@ xml
osmium::io::file_format::json
@ json
osmium::io::file_format::pbf
@ pbf
osmium::io::file_format::opl
@ opl
osmium::io::file_format::last
@ last
osmium::io::file_format::blackhole
@ blackhole
osmium::io::file_format::debug
@ debug
osmium::io::file_format::unknown
@ unknown
osmium::io::file_format::o5m
@ o5m
osmium::io::file_format::ids
@ ids
osmium::io::as_string
const char * as_string(file_compression compression)
Definition file_compression.hpp:48
osmium::io::buffers_type
buffers_type
Definition file_format.hpp:60
osmium::io::buffers_type::any
@ any
osmium::io::buffers_type::single
@ single
osmium::io::read_meta
read_meta
Definition file_format.hpp:55
osmium::io::read_meta::no
@ no
osmium::io::read_meta::yes
@ yes
osmium::io::operator<<
std::basic_ostream< TChar, TTraits > & operator<<(std::basic_ostream< TChar, TTraits > &out, const file_compression compression)
Definition file_compression.hpp:61
osmium
Namespace for everything in the Osmium library.
Definition assembler.hpp:53