Loading...
Searching...
No Matches
osmium::io::File Class Reference

`#include <file.hpp>`

## Public Member Functions

| File (std::string filename="", std::string format="")
| File (const char *buffer, size_t size, const std::string &format="")
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

## Private Attributes

std::string | m_filename
const char * | m_buffer = nullptr
size_t | m_buffer_size = 0
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

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

## File() [1/2]

osmium::io::File::File | ( | std::string | filename = "",
|  | std::string | format = "" )

inlineexplicit

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.

## File() [2/2]

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

  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.

## Member Function Documentation

## buffer()

const char * osmium::io::File::buffer | ( |  | ) | const

inlinenoexcept

## buffer_size()

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

inlinenoexcept

## check()

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 |

## compression()

file_compression osmium::io::File::compression | ( |  | ) | const

inlinenoexcept

## detect_format_from_suffix()

void osmium::io::File::detect_format_from_suffix | ( | const std::string & | name | ) |

inline

## filename() [1/2]

const std::string & osmium::io::File::filename | ( |  | ) | const

inlinenoexcept

## filename() [2/2]

File & osmium::io::File::filename | ( | const std::string & | filename | ) |

inline

## format()

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

inlinenoexcept

## has_multiple_object_versions()

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

inlinenoexcept

## parse_format()

void osmium::io::File::parse_format | ( | const std::string & | format | ) |

inline

## set_compression()

File & osmium::io::File::set_compression | ( | file_compression | compression | ) |

inlinenoexcept

## set_format()

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

inlinenoexcept

## set_has_multiple_object_versions()

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

inlinenoexcept

## Member Data Documentation

## m_buffer

const char* osmium::io::File::m_buffer = nullptr

private

## m_buffer_size

size_t osmium::io::File::m_buffer_size = 0

private

## m_file_compression

file_compression osmium::io::File::m_file_compression = file_compression::none

private

## m_file_format

file_format osmium::io::File::m_file_format = file_format::unknown

private

## m_filename

std::string osmium::io::File::m_filename

private

## m_format_string

std::string osmium::io::File::m_format_string

private

## m_has_multiple_object_versions

bool osmium::io::File::m_has_multiple_object_versions = false

private

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

- include/osmium/io/file.hpp