osmium::io::File Class Reference

`#include <file.hpp>`

Inheritance diagram for osmium::io::File:
[legend]
Collaboration diagram for osmium::io::File:
[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
File & | operator= (const File &)=default
| File (File &&)=default
File & | operator= (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 File & | check () const
file_format | format () const noexcept
File & | set_format (file_format format) noexcept
file_compression | compression () const noexcept
File & | set_compression (file_compression compression) noexcept
bool | has_multiple_object_versions () const noexcept
File & | set_has_multiple_object_versions (bool value) noexcept
File & | filename (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 = `""`
| ) |  |

inline explicit

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

Parameters

  filename | Filename including suffix. The type and encoding of the file will be taken from the suffix. An empty filename or "-" means stdin or stdout.
  format | File 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 = `""`
| ) |  |

inline explicit

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

Parameters

  buffer | Pointer to buffer with data.
  size | Size of buffer.
  format | File 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

inline noexcept

size_t osmium::io::File::buffer_size | ( |  | ) | const

inline noexcept

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

inline noexcept

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

inline noexcept

file_format osmium::io::File::format | ( |  | ) | const

inline noexcept

bool osmium::io::File::has_multiple_object_versions | ( |  | ) | const

inline noexcept

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 | ) |

inline noexcept

File& osmium::io::File::set_format | ( | file_format | format | ) |

inline noexcept

File& osmium::io::File::set_has_multiple_object_versions | ( | bool | value | ) |

inline noexcept

## 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:

- osmium/io/file.hpp