libosmscout  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups
osmscout::FileWriter Class Reference

FileScanner implements platform independent writing to data in files. More...

#include <FileWriter.h>

Public Member Functions

void Close ()
 
void CloseFailsafe ()
 
 FileWriter ()
 
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 (const char *buffer, size_t bytes)
 
void Write (const std::string &value)
 
void Write (bool boolean)
 
void Write (int8_t number)
 
void Write (int16_t number)
 
void Write (int32_t number)
 
void Write (int64_t number)
 
void Write (uint8_t number)
 
void Write (uint16_t number)
 
void Write (uint32_t number)
 
void Write (uint64_t number)
 
void Write (uint16_t number, size_t bytes)
 
void Write (uint32_t number, size_t bytes)
 
void Write (uint64_t number, size_t bytes)
 
void Write (const ObjectFileRef &ref)
 
void Write (const std::vector< Point > &nodes, bool writeIds)
 
void Write (const std::vector< GeoCoord > &nodes)
 
void WriteCoord (const GeoCoord &coord)
 
void WriteFileOffset (FileOffset offset)
 
void WriteFileOffset (FileOffset offset, size_t bytes)
 
void WriteInvalidCoord ()
 
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)
 
virtual ~FileWriter ()
 

Static Public Attributes

static const uint64_t MAX_NODES =0x03FFFFFF
 

Detailed Description

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.

Constructor & Destructor Documentation

osmscout::FileWriter::FileWriter ( )
osmscout::FileWriter::~FileWriter ( )
virtual

Member Function Documentation

void osmscout::FileWriter::Close ( )
Exceptions
IOException
void osmscout::FileWriter::CloseFailsafe ( )

Referenced by ~FileWriter().

void osmscout::FileWriter::Flush ( )
Exceptions
IOException

References HasError().

void osmscout::FileWriter::FlushCurrentBlockWithZeros ( size_t  blockSize)
Exceptions
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.

Exceptions
IOException

References HasError().

Referenced by FlushCurrentBlockWithZeros().

void osmscout::FileWriter::GotoBegin ( )

Moves the writing cursor to the start of the file (offset 0)

Exceptions
IOException

References SetPos().

bool osmscout::FileWriter::HasError ( ) const
inline
bool osmscout::FileWriter::IsOpen ( ) const
inline
void osmscout::FileWriter::Open ( const std::string &  filename)
Exceptions
IOException
void osmscout::FileWriter::SetPos ( FileOffset  pos)

Moves the writing cursor to the given file position.

Exceptions
IOException

References HasError().

Referenced by GotoBegin().

void osmscout::FileWriter::Write ( const std::string &  value)
Exceptions
IOException

References HasError().

void osmscout::FileWriter::Write ( bool  boolean)
Exceptions
IOException

References HasError().

void osmscout::FileWriter::Write ( int8_t  number)
Exceptions
IOException

References HasError().

void osmscout::FileWriter::Write ( int16_t  number)
Exceptions
IOException

References HasError().

void osmscout::FileWriter::Write ( int32_t  number)
Exceptions
IOException

References HasError().

void osmscout::FileWriter::Write ( int64_t  number)
Exceptions
IOException

References HasError().

void osmscout::FileWriter::Write ( uint8_t  number)
Exceptions
IOException

References HasError().

void osmscout::FileWriter::Write ( uint16_t  number)
Exceptions
IOException

References HasError().

void osmscout::FileWriter::Write ( uint32_t  number)
Exceptions
IOException

References HasError().

void osmscout::FileWriter::Write ( uint64_t  number)
Exceptions
IOException

References HasError().

void osmscout::FileWriter::Write ( uint16_t  number,
size_t  bytes 
)
Exceptions
IOException

References HasError().

void osmscout::FileWriter::Write ( uint32_t  number,
size_t  bytes 
)
Exceptions
IOException

References HasError().

void osmscout::FileWriter::Write ( uint64_t  number,
size_t  bytes 
)
Exceptions
IOException

References HasError().

void osmscout::FileWriter::Write ( const ObjectFileRef &  ref)
Exceptions
IOException

References Write(), and WriteFileOffset().

void osmscout::FileWriter::Write ( const std::vector< Point > &  nodes,
bool  writeIds 
)
void osmscout::FileWriter::Write ( const std::vector< GeoCoord > &  nodes)
void osmscout::FileWriter::WriteCoord ( const GeoCoord &  coord)
void osmscout::FileWriter::WriteFileOffset ( FileOffset  fileOffset)
Exceptions
IOException

References HasError().

Referenced by Write(), and osmscout::RouteNode::Write().

void osmscout::FileWriter::WriteFileOffset ( FileOffset  fileOffset,
size_t  bytes 
)
Exceptions
IOException

References HasError().

void osmscout::FileWriter::WriteInvalidCoord ( )
Exceptions
IOException

References osmscout::coordByteSize, and HasError().

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.

Exceptions
IOException

References osmscout::EncodeNumber(), and HasError().

Referenced by osmscout::ObjectVariantData::Write(), osmscout::ObjectFileRefStreamWriter::Write(), osmscout::RouteNode::Write(), and osmscout::EleFeatureValue::Write().

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.

Exceptions
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.

Exceptions
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.

Exceptions
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.

Exceptions
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.

Exceptions
IOException

References osmscout::EncodeNumber(), and HasError().

void osmscout::FileWriter::WriteTypeId ( TypeId  id,
uint8_t  maxBytes 
)
Exceptions
IOException

References Write().

Member Data Documentation

const uint64_t osmscout::FileWriter::MAX_NODES =0x03FFFFFF
static

Referenced by Write().


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