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

A feature combines one or multiple tags to build information attribute for a type. More...

#include <TypeConfig.h>

+ Inheritance diagram for osmscout::Feature:

Public Member Functions

void AddDescription (const std::string &languageCode, const std::string &description)
 Add a description of the feature for the given language code. More...
 
virtual FeatureValueAllocateValue (void *buffer)
 
 Feature ()
 
std::string GetDescription (const std::string &languageCode) const
 Returns the description for the given language code. More...
 
const std::unordered_map
< std::string, std::string > & 
GetDescriptions () const
 
virtual size_t GetFeatureBitCount () const
 This method returns the number of additional feature bits reserved. More...
 
bool GetLabelIndex (const std::string &labelName, size_t &index) const
 Returns the index of the label with the given name. More...
 
virtual std::string GetName () const =0
 Returns the name of the feature. More...
 
virtual size_t GetValueSize () const
 A feature, if set for an object, can hold a value. More...
 
virtual bool HasLabel () const
 Returns 'true' if the feature provides labels. More...
 
virtual bool HasValue () const
 Returns 'true' if the feature has an value object. More...
 
virtual void Initialize (TypeConfig &typeConfig)=0
 Does further initialization based on the current TypeConfig. More...
 
virtual void Parse (TagErrorReporter &reporter, const TypeConfig &typeConfig, const FeatureInstance &feature, const ObjectOSMRef &object, const TagMap &tags, FeatureValueBuffer &buffer) const =0
 
virtual ~Feature ()
 

Protected Member Functions

size_t RegisterLabel (const std::string &labelName, size_t index)
 

Detailed Description

A feature combines one or multiple tags to build information attribute for a type.

The class "Feature" is the abstract base class for a concrete feature implementation like "NameFeature" or "AccessFeature".

A feature could just be an alias for one tag (like "name") but it could also combine a number of attributes (e.g. access and all its variations).

Constructor & Destructor Documentation

osmscout::Feature::Feature ( )
osmscout::Feature::~Feature ( )
virtual

Member Function Documentation

void osmscout::Feature::AddDescription ( const std::string &  languageCode,
const std::string &  description 
)

Add a description of the feature for the given language code.

Parameters
languageCodelanguage code like for example 'en'or 'de'
descriptiondescription of the type
Returns
type info instance

Referenced by osmscout::ost::Parser::FEATUREDESCS().

std::string osmscout::Feature::GetDescription ( const std::string &  languageCode) const

Returns the description for the given language code.

Returns an empty string, if no description is available for the given language code.

Parameters
languageCodelanguageCode like for example 'en' or 'de'
Returns
Description or empty string
const std::unordered_map<std::string,std::string>& osmscout::Feature::GetDescriptions ( ) const
inline
virtual size_t osmscout::Feature::GetFeatureBitCount ( ) const
inlinevirtual

This method returns the number of additional feature bits reserved.

If there are additional features bit, 0 is returned.

A feature may reserve additional feature bits. Feature bits should be used if a custom value object is too expensive. Space for feature bits is always reserved even if the feature itself is not set for a certain object.

bool osmscout::Feature::GetLabelIndex ( const std::string &  labelName,
size_t &  index 
) const

Returns the index of the label with the given name.

Method returns 'true' if the feature has labels and a label with the given name exists. Else 'false' is returned.

virtual bool osmscout::Feature::HasLabel ( ) const
inlinevirtual

Returns 'true' if the feature provides labels.

virtual bool osmscout::Feature::HasValue ( ) const
inlinevirtual

Returns 'true' if the feature has an value object.


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