libosmscout
0.1
|
#include <FileWriter.h>
Public Member Functions | |
void | Close () |
void | CloseFailsafe () |
FileWriter ()=default | |
void | Flush () |
void | FlushCurrentBlockWithZeros (size_t blockSize) |
std::string | GetFilename () const |
FileOffset | GetPos () |
Returns the current position of the writing cursor in relation to the begining of the file. More... | |
void | GotoBegin () |
Moves the writing cursor to the start of the file (offset 0) More... | |
bool | HasError () const |
bool | IsOpen () const |
void | Open (const std::string &filename) |
void | SetPos (FileOffset pos) |
Moves the writing cursor to the given file position. More... | |
void | Write (bool boolean) |
void | Write (const char *buffer, size_t bytes) |
void | Write (const Color &color) |
void | Write (const MagnificationLevel &level) |
void | Write (const ObjectFileRef &ref) |
void | Write (const std::string &value) |
void | Write (const std::vector< GeoCoord > &nodes) |
void | Write (const std::vector< Point > &nodes, bool writeIds) |
void | Write (int16_t number) |
void | Write (int32_t number) |
void | Write (int64_t number) |
void | Write (int8_t number) |
void | Write (std::byte byteValue) |
void | Write (uint16_t number) |
void | Write (uint16_t number, size_t bytes) |
void | Write (uint32_t number) |
void | Write (uint32_t number, size_t bytes) |
void | Write (uint64_t number) |
void | Write (uint64_t number, size_t bytes) |
void | Write (uint8_t number) |
void | WriteBox (const GeoBox &bbox) |
Writes GeoBox instance. More... | |
void | WriteCoord (const GeoCoord &coord) |
Writes GeoCoord instance. More... | |
void | WriteFileOffset (FileOffset offset) |
void | WriteFileOffset (FileOffset offset, size_t bytes) |
void | WriteInvalidCoord () |
void | WriteNumber (const MagnificationLevel &level) |
void | WriteNumber (int16_t number) |
Write a numeric value to the file using some internal encoding to reduce storage size. More... | |
void | WriteNumber (int32_t number) |
Write a numeric value to the file using some internal encoding to reduce storage size. More... | |
void | WriteNumber (int64_t number) |
Write a numeric value to the file using some internal encoding to reduce storage size. More... | |
void | WriteNumber (uint16_t number) |
Write a numeric value to the file using some internal encoding to reduce storage size. More... | |
void | WriteNumber (uint32_t number) |
Write a numeric value to the file using some internal encoding to reduce storage size. More... | |
void | WriteNumber (uint64_t number) |
Write a numeric value to the file using some internal encoding to reduce storage size. More... | |
void | WriteTypeId (TypeId id, uint8_t maxBytes) |
~FileWriter () | |
Static Public Attributes | |
static const uint64_t | MAX_NODES =0x03FFFFFFu |
FileScanner implements platform independent writing to data in files. It uses C standard library FILE internally and wraps it to offer a number of convenience methods.
|
default |
osmscout::FileWriter::~FileWriter | ( | ) |
References CloseFailsafe(), osmscout::log, and osmscout::Log::Warn().
void osmscout::FileWriter::Close | ( | ) |
IOException |
Referenced by osmscout::TypeConfig::StoreToDataFile().
void osmscout::FileWriter::CloseFailsafe | ( | ) |
References osmscout::log, and osmscout::Log::Warn().
Referenced by osmscout::TypeConfig::StoreToDataFile(), and ~FileWriter().
void osmscout::FileWriter::Flush | ( | ) |
IOException |
References HasError().
void osmscout::FileWriter::FlushCurrentBlockWithZeros | ( | size_t | blockSize | ) |
IOException |
References GetPos(), and HasError().
std::string osmscout::FileWriter::GetFilename | ( | ) | const |
FileOffset osmscout::FileWriter::GetPos | ( | ) |
Returns the current position of the writing cursor in relation to the begining of the file.
IOException |
References HasError().
Referenced by FlushCurrentBlockWithZeros().
void osmscout::FileWriter::GotoBegin | ( | ) |
Moves the writing cursor to the start of the file (offset 0)
IOException |
References SetPos().
|
inline |
Referenced by Flush(), FlushCurrentBlockWithZeros(), GetPos(), SetPos(), Write(), WriteCoord(), WriteFileOffset(), WriteInvalidCoord(), and WriteNumber().
|
inline |
void osmscout::FileWriter::Open | ( | const std::string & | filename | ) |
IOException |
Referenced by osmscout::TypeConfig::StoreToDataFile().
void osmscout::FileWriter::SetPos | ( | FileOffset | pos | ) |
Moves the writing cursor to the given file position.
IOException |
References HasError().
Referenced by GotoBegin().
void osmscout::FileWriter::Write | ( | bool | boolean | ) |
IOException |
References HasError().
void osmscout::FileWriter::Write | ( | const char * | buffer, |
size_t | bytes | ||
) |
IOException |
References HasError().
Referenced by osmscout::TypeConfig::StoreToDataFile(), osmscout::ObjectVariantData::Write(), osmscout::GradeFeatureValue::Write(), osmscout::LayerFeatureValue::Write(), osmscout::MaxSpeedFeatureValue::Write(), osmscout::WidthFeatureValue::Write(), osmscout::IsInFeatureValue::Write(), osmscout::DestinationFeatureValue::Write(), osmscout::WebsiteFeatureValue::Write(), osmscout::NameShortFeatureValue::Write(), osmscout::PhoneFeatureValue::Write(), osmscout::PostalCodeFeatureValue::Write(), osmscout::RefFeatureValue::Write(), osmscout::LocationFeatureValue::Write(), osmscout::ColorFeatureValue::Write(), osmscout::BrandFeatureValue::Write(), osmscout::NameFeatureValue::Write(), osmscout::NameAltFeatureValue::Write(), osmscout::NetworkFeatureValue::Write(), osmscout::OperatorFeatureValue::Write(), osmscout::OpeningHoursFeatureValue::Write(), osmscout::AddressFeatureValue::Write(), osmscout::AdminLevelFeatureValue::Write(), osmscout::MaxStayFeatureValue::Write(), osmscout::ConstructionYearFeatureValue::Write(), osmscout::ChargingStationFeatureValue::Write(), osmscout::FeeFeatureValue::Write(), osmscout::FromToFeatureValue::Write(), osmscout::SidewayFeatureValue::Write(), Write(), osmscout::AccessRestrictedFeatureValue::Write(), osmscout::LanesFeatureValue::Write(), osmscout::Route::Write(), osmscout::RouteNode::Write(), osmscout::Way::Write(), osmscout::AccessFeatureValue::Write(), osmscout::PTRoute::Write(), osmscout::Area::Write(), osmscout::FeatureValueBuffer::Write(), osmscout::Area::WriteImport(), osmscout::Way::WriteOptimized(), osmscout::Area::WriteOptimized(), and WriteTypeId().
void osmscout::FileWriter::Write | ( | const Color & | color | ) |
IOException |
References osmscout::Color::GetA(), osmscout::Color::GetB(), osmscout::Color::GetG(), and osmscout::Color::GetR().
|
inline |
References osmscout::MagnificationLevel::Get().
void osmscout::FileWriter::Write | ( | const ObjectFileRef & | ref | ) |
IOException |
References osmscout::ObjectFileRef::GetFileOffset(), osmscout::ObjectFileRef::GetType(), Write(), and WriteFileOffset().
void osmscout::FileWriter::Write | ( | const std::string & | value | ) |
IOException |
References HasError().
void osmscout::FileWriter::Write | ( | const std::vector< GeoCoord > & | nodes | ) |
References osmscout::latConversionFactor, osmscout::lonConversionFactor, MAX_NODES, Write(), and WriteCoord().
void osmscout::FileWriter::Write | ( | const std::vector< Point > & | nodes, |
bool | writeIds | ||
) |
References osmscout::latConversionFactor, osmscout::lonConversionFactor, MAX_NODES, Write(), and WriteCoord().
void osmscout::FileWriter::Write | ( | int16_t | number | ) |
IOException |
References HasError().
void osmscout::FileWriter::Write | ( | int32_t | number | ) |
IOException |
References HasError().
void osmscout::FileWriter::Write | ( | int64_t | number | ) |
IOException |
References HasError().
void osmscout::FileWriter::Write | ( | int8_t | number | ) |
IOException |
References HasError().
void osmscout::FileWriter::Write | ( | std::byte | byteValue | ) |
IOException |
References HasError().
void osmscout::FileWriter::Write | ( | uint16_t | number | ) |
IOException |
References HasError().
void osmscout::FileWriter::Write | ( | uint16_t | number, |
size_t | bytes | ||
) |
IOException |
References HasError().
void osmscout::FileWriter::Write | ( | uint32_t | number | ) |
IOException |
References HasError().
void osmscout::FileWriter::Write | ( | uint32_t | number, |
size_t | bytes | ||
) |
IOException |
References HasError().
void osmscout::FileWriter::Write | ( | uint64_t | number | ) |
IOException |
References HasError().
void osmscout::FileWriter::Write | ( | uint64_t | number, |
size_t | bytes | ||
) |
IOException |
References HasError().
void osmscout::FileWriter::Write | ( | uint8_t | number | ) |
IOException |
References HasError().
void osmscout::FileWriter::WriteBox | ( | const GeoBox & | bbox | ) |
Writes GeoBox instance.
It have to valid.
IOException |
References osmscout::GeoBox::GetMaxCoord(), osmscout::GeoBox::GetMinCoord(), osmscout::GeoBox::IsValid(), and WriteCoord().
Referenced by osmscout::Route::Write().
void osmscout::FileWriter::WriteCoord | ( | const GeoCoord & | coord | ) |
Writes GeoCoord instance.
It have to normalised (latitude <-90, 90>, longitude <-180, 180>)
IOException |
References osmscout::coordByteSize, osmscout::GeoCoord::GetLat(), osmscout::GeoCoord::GetLon(), HasError(), osmscout::latConversionFactor, and osmscout::lonConversionFactor.
Referenced by osmscout::Node::Write(), Write(), osmscout::RouteNode::Write(), osmscout::Area::Write(), WriteBox(), and osmscout::Area::WriteOptimized().
void osmscout::FileWriter::WriteFileOffset | ( | FileOffset | fileOffset | ) |
void osmscout::FileWriter::WriteFileOffset | ( | FileOffset | fileOffset, |
size_t | bytes | ||
) |
IOException |
References HasError().
void osmscout::FileWriter::WriteInvalidCoord | ( | ) |
IOException |
References osmscout::coordByteSize, and HasError().
|
inline |
References osmscout::MagnificationLevel::Get().
void osmscout::FileWriter::WriteNumber | ( | int16_t | number | ) |
Write a numeric value to the file using some internal encoding to reduce storage size.
Note that this works only if the average number is small.
IOException |
References osmscout::EncodeNumber(), and HasError().
Referenced by osmscout::TypeConfig::StoreToDataFile(), osmscout::ObjectVariantData::Write(), osmscout::EleFeatureValue::Write(), osmscout::ChargingStationFeatureValue::Write(), osmscout::TurnRestriction::Write(), osmscout::Route::Write(), osmscout::RouteNode::Write(), osmscout::ObjectFileRefStreamWriter::Write(), osmscout::PTRoute::Write(), osmscout::Area::Write(), osmscout::Area::WriteImport(), and osmscout::Area::WriteOptimized().
void osmscout::FileWriter::WriteNumber | ( | int32_t | number | ) |
Write a numeric value to the file using some internal encoding to reduce storage size.
Note that this works only if the average number is small.
IOException |
References osmscout::EncodeNumber(), and HasError().
void osmscout::FileWriter::WriteNumber | ( | int64_t | number | ) |
Write a numeric value to the file using some internal encoding to reduce storage size.
Note that this works only if the average number is small.
IOException |
References osmscout::EncodeNumber(), and HasError().
void osmscout::FileWriter::WriteNumber | ( | uint16_t | number | ) |
Write a numeric value to the file using some internal encoding to reduce storage size.
Note that this works only if the average number is small.
IOException |
References osmscout::EncodeNumber(), and HasError().
void osmscout::FileWriter::WriteNumber | ( | uint32_t | number | ) |
Write a numeric value to the file using some internal encoding to reduce storage size.
Note that this works only if the average number is small.
IOException |
References osmscout::EncodeNumber(), and HasError().
void osmscout::FileWriter::WriteNumber | ( | uint64_t | number | ) |
Write a numeric value to the file using some internal encoding to reduce storage size.
Note that this works only if the average number is small.
IOException |
References osmscout::EncodeNumber(), and HasError().
void osmscout::FileWriter::WriteTypeId | ( | TypeId | id, |
uint8_t | maxBytes | ||
) |
IOException |
References Write().
Referenced by osmscout::Node::Write(), osmscout::Route::Write(), osmscout::Way::Write(), osmscout::Area::Write(), osmscout::Area::WriteImport(), osmscout::Way::WriteOptimized(), and osmscout::Area::WriteOptimized().
|
static |
Referenced by Write().