Libosmium  2.6.1
Fast and flexible C++ library for working with OpenStreetMap data
Public Member Functions | Private Attributes | List of all members
osmium::io::File Class Reference

#include <file.hpp>

Inheritance diagram for osmium::io::File:
Inheritance graph
[legend]
Collaboration diagram for osmium::io::File:
Collaboration graph
[legend]

Public Member Functions

 File (const std::string &filename="", const std::string &format="")
 
 File (const char *buffer, size_t size, const std::string &format="")
 
 File (const File &)=default
 
Fileoperator= (const File &)=default
 
 File (File &&)=default
 
Fileoperator= (File &&)=default
 
 ~File ()=default
 
const char * buffer () const noexcept
 
size_t buffer_size () const noexcept
 
void parse_format (const std::string &format)
 
void detect_format_from_suffix (const std::string &name)
 
const Filecheck () const
 
file_format format () const noexcept
 
Fileset_format (file_format format) noexcept
 
file_compression compression () const noexcept
 
Fileset_compression (file_compression compression) noexcept
 
bool has_multiple_object_versions () const noexcept
 
Fileset_has_multiple_object_versions (bool value) noexcept
 
Filefilename (const std::string &filename)
 
const std::string & filename () const noexcept
 
- Public Member Functions inherited from osmium::util::Options
 Options ()=default
 
 Options (const std::initializer_list< value_type > &values)
 
void set (const std::string &key, const std::string &value)
 
void set (const std::string &key, const char *value)
 
void set (const std::string &key, bool value)
 
void set (std::string data)
 
std::string get (const std::string &key, const std::string &default_value="") const noexcept
 
bool is_true (const std::string &key) const noexcept
 
bool is_not_false (const std::string &key) const noexcept
 
size_t size () const noexcept
 
iterator begin () noexcept
 
iterator end () noexcept
 
const_iterator begin () const noexcept
 
const_iterator end () const noexcept
 
const_iterator cbegin () const noexcept
 
const_iterator cend () const noexcept
 

Private Attributes

std::string m_filename
 
const char * m_buffer
 
size_t m_buffer_size
 
std::string m_format_string
 
file_format m_file_format {file_format::unknown}
 
file_compression m_file_compression {file_compression::none}
 
bool m_has_multiple_object_versions {false}
 

Additional Inherited Members

- Public Types inherited from osmium::util::Options
using iterator = option_map::iterator
 
using const_iterator = option_map::const_iterator
 
using value_type = option_map::value_type
 

Detailed Description

This class describes an OSM file in one of several different formats.

If the filename is empty or "-", this means stdin or stdout is used.

Constructor & Destructor Documentation

osmium::io::File::File ( const std::string &  filename = "",
const std::string &  format = "" 
)
inlineexplicit

Create File using type and encoding from filename or given format specification.

Parameters
filenameFilename including suffix. The type and encoding of the file will be taken from the suffix. An empty filename or "-" means stdin or stdout.
formatFile format as string. See the description of the parse_format() function for details. If this is empty the format will be deduced from the suffix of the filename.
osmium::io::File::File ( const char *  buffer,
size_t  size,
const std::string &  format = "" 
)
inlineexplicit

Create File using buffer pointer and size and type and encoding from given format specification.

Parameters
bufferPointer to buffer with data.
sizeSize of buffer.
formatFile format as string. See the description of the parse_format() function for details.
osmium::io::File::File ( const File )
default
osmium::io::File::File ( File &&  )
default
osmium::io::File::~File ( )
default

Member Function Documentation

const char* osmium::io::File::buffer ( ) const
inlinenoexcept
size_t osmium::io::File::buffer_size ( ) const
inlinenoexcept
const File& osmium::io::File::check ( ) const
inline

Check file format etc. for consistency and throw exception if there is a problem.

Exceptions
osmium::io_error
file_compression osmium::io::File::compression ( ) const
inlinenoexcept
void osmium::io::File::detect_format_from_suffix ( const std::string &  name)
inline
File& osmium::io::File::filename ( const std::string &  filename)
inline
const std::string& osmium::io::File::filename ( ) const
inlinenoexcept
file_format osmium::io::File::format ( ) const
inlinenoexcept
bool osmium::io::File::has_multiple_object_versions ( ) const
inlinenoexcept
File& osmium::io::File::operator= ( const File )
default
File& osmium::io::File::operator= ( File &&  )
default
void osmium::io::File::parse_format ( const std::string &  format)
inline
File& osmium::io::File::set_compression ( file_compression  compression)
inlinenoexcept
File& osmium::io::File::set_format ( file_format  format)
inlinenoexcept
File& osmium::io::File::set_has_multiple_object_versions ( bool  value)
inlinenoexcept

Member Data Documentation

const char* osmium::io::File::m_buffer
private
size_t osmium::io::File::m_buffer_size
private
file_compression osmium::io::File::m_file_compression {file_compression::none}
private
file_format osmium::io::File::m_file_format {file_format::unknown}
private
std::string osmium::io::File::m_filename
private
std::string osmium::io::File::m_format_string
private
bool osmium::io::File::m_has_multiple_object_versions {false}
private

The documentation for this class was generated from the following file: