Rogue Wave Views
Maps Package API Reference Guide
Product Documentation:

Rogue Wave Views
Documentation Home
List of all members | Public Member Functions
IlvShapeDBFReader Class Reference

This class reads attributes from .dbf files. More...

#include <ilviews/maps/format/shapefile/dbfreader.h>

Public Member Functions

 IlvShapeDBFReader (const char *filename)
 Initializes a new IlvShapeDBFReader to read from the file whose name is specified. More...
 
 IlvShapeDBFReader (std::istream &stream)
 Initializes a new IlvShapeDBFReader to read from the specified input stream. More...
 
int getCurrentIndex () const
 Returns the index of the next field that will be read. More...
 
const IlvFeatureAttributeInfogetInfo () const
 Returns a description of the attributes. More...
 
IlvMapsError getInitStatus ()
 Checks the initialization status of this reader. More...
 
IlvFeatureAttributePropertygetNextRecord (IlvMapsError &status)
 Reads the next record in the .dbf file. The caller is responsible for deallocation of returned data. More...
 
int getRecordCount ()
 Returns the number of records contained in the .dbf file from which the attributes are read. More...
 
IlvFeatureAttributePropertyreadRecord (int index, IlvMapsError &status)
 Reads the record corresponding to the specified index. More...
 

Detailed Description

This class reads attributes from .dbf files.

Library: ilvmaps
This class can be used to read shape files with the .dbf extension. The .dbf files contain the attributes of the map objects.

This reader can be used as an iterator on a .dbf file. It can also be used to directly access the records in the file (or more precisely their index) if it was created with the constructor that takes a file name as argument.

See also
IlvShapeFileReader.

Constructor & Destructor Documentation

§ IlvShapeDBFReader() [1/2]

IlvShapeDBFReader::IlvShapeDBFReader ( const char *  filename)

Initializes a new IlvShapeDBFReader to read from the file whose name is specified.

Parameters
filenameThe name of the input file.

§ IlvShapeDBFReader() [2/2]

IlvShapeDBFReader::IlvShapeDBFReader ( std::istream &  stream)

Initializes a new IlvShapeDBFReader to read from the specified input stream.

Parameters
streamThe input stream.

Member Function Documentation

§ getCurrentIndex()

int IlvShapeDBFReader::getCurrentIndex ( ) const

Returns the index of the next field that will be read.

Returns
The index of the next field that will be read.

§ getInfo()

const IlvFeatureAttributeInfo* IlvShapeDBFReader::getInfo ( ) const

Returns a description of the attributes.

Returns the types and names of the field contained in the .dbf file.

Returns
An IlvFeatureAttributeInfo that describes this attribute file.

§ getInitStatus()

IlvMapsError IlvShapeDBFReader::getInitStatus ( )

Checks the initialization status of this reader.

Returns
IlvMaps::NoError() if the initialization of this reader is successful, or an error if an error occured during the initalization.

§ getNextRecord()

IlvFeatureAttributeProperty* IlvShapeDBFReader::getNextRecord ( IlvMapsError &  status)

Reads the next record in the .dbf file. The caller is responsible for deallocation of returned data.

Parameters
statusAn IlvMapsError to store the status of the read process.
Returns
The read feature attributes.

§ getRecordCount()

int IlvShapeDBFReader::getRecordCount ( )

Returns the number of records contained in the .dbf file from which the attributes are read.

Returns
The number of records.

§ readRecord()

IlvFeatureAttributeProperty* IlvShapeDBFReader::readRecord ( int  index,
IlvMapsError &  status 
)

Reads the record corresponding to the specified index.

Restrictions:

  • Since this function uses a random access to the file, this method can only be called when this dbf reader is built from a filename or a random access able input stream.
  • Since this function changes the current index, it should not be used if the reader itself is used by another feature iterator, such as the IlvShapeFileReader.
Parameters
indexThe index of the record to be read, in the range [0, this->getRecordCount()].
statusAn IlvMapsError to store the status of the read process.
Returns
The read feature attributes.

© Copyright 2018, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.