libosmscout 0.1
|
FileScanner implements platform independent writing to data in files. More...
#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. | |
void | GotoBegin () |
Moves the writing cursor to the start of the file (offset 0) | |
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. | |
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. | |
void | WriteCoord (const GeoCoord &coord) |
Writes GeoCoord instance. | |
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. | |
void | WriteNumber (int32_t number) |
Write a numeric value to the file using some internal encoding to reduce storage size. | |
void | WriteNumber (int64_t number) |
Write a numeric value to the file using some internal encoding to reduce storage size. | |
void | WriteNumber (uint16_t number) |
Write a numeric value to the file using some internal encoding to reduce storage size. | |
void | WriteNumber (uint32_t number) |
Write a numeric value to the file using some internal encoding to reduce storage size. | |
void | WriteNumber (uint64_t number) |
Write a numeric value to the file using some internal encoding to reduce storage size. | |
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(), Write(), Write(), Write(), Write(), Write(), Write(), Write(), Write(), Write(), Write(), Write(), Write(), Write(), Write(), WriteCoord(), WriteFileOffset(), WriteFileOffset(), WriteInvalidCoord(), WriteNumber(), WriteNumber(), WriteNumber(), WriteNumber(), WriteNumber(), 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(), Write(), Write(), Write(), osmscout::Area::Write(), osmscout::PTRoute::Write(), osmscout::Route::Write(), osmscout::Way::Write(), osmscout::ObjectVariantData::Write(), osmscout::RouteNode::Write(), osmscout::AccessFeatureValue::Write(), osmscout::AccessRestrictedFeatureValue::Write(), osmscout::AddressFeatureValue::Write(), osmscout::AdminLevelFeatureValue::Write(), osmscout::BrandFeatureValue::Write(), osmscout::ChargingStationFeatureValue::Write(), osmscout::ColorFeatureValue::Write(), osmscout::ConstructionYearFeatureValue::Write(), osmscout::DestinationFeatureValue::Write(), osmscout::FeeFeatureValue::Write(), osmscout::FromToFeatureValue::Write(), osmscout::GradeFeatureValue::Write(), osmscout::IsInFeatureValue::Write(), osmscout::LanesFeatureValue::Write(), osmscout::LayerFeatureValue::Write(), osmscout::LocationFeatureValue::Write(), osmscout::MaxSpeedFeatureValue::Write(), osmscout::MaxStayFeatureValue::Write(), osmscout::NameAltFeatureValue::Write(), osmscout::NameFeatureValue::Write(), osmscout::NameShortFeatureValue::Write(), osmscout::NetworkFeatureValue::Write(), osmscout::OpeningHoursFeatureValue::Write(), osmscout::OperatorFeatureValue::Write(), osmscout::PhoneFeatureValue::Write(), osmscout::PostalCodeFeatureValue::Write(), osmscout::RefFeatureValue::Write(), osmscout::SidewayFeatureValue::Write(), osmscout::WebsiteFeatureValue::Write(), osmscout::WidthFeatureValue::Write(), osmscout::FeatureValueBuffer::Write(), osmscout::Area::WriteImport(), osmscout::Area::WriteOptimized(), osmscout::Way::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 Write(), Write(), osmscout::Area::Write(), osmscout::Node::Write(), osmscout::RouteNode::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::ObjectFileRefStreamWriter::Write(), osmscout::Area::Write(), osmscout::PTRoute::Write(), osmscout::Route::Write(), osmscout::ObjectVariantData::Write(), osmscout::RouteNode::Write(), osmscout::TurnRestriction::Write(), osmscout::ChargingStationFeatureValue::Write(), osmscout::EleFeatureValue::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::Area::Write(), osmscout::Node::Write(), osmscout::Route::Write(), osmscout::Way::Write(), osmscout::Area::WriteImport(), osmscout::Area::WriteOptimized(), and osmscout::Way::WriteOptimized().
|
static |