osgEarth 2.1.1
Public Member Functions

osgEarth::Features::AttributeValue Struct Reference

List of all members.

Public Member Functions

std::string getString () const
double getDouble (double defaultValue=0.0) const
int getInt (int defaultValue=0) const
bool getBool (bool defaultValue=false) const

Detailed Description

Definition at line 89 of file Feature.


Member Function Documentation

bool AttributeValue::getBool ( bool  defaultValue = false) const

Definition at line 127 of file Feature.cpp.

{
    switch( first ) {
        case ATTRTYPE_STRING: return osgEarth::as<bool>(second.stringValue, defaultValue);
        case ATTRTYPE_DOUBLE: return second.doubleValue != 0.0;
        case ATTRTYPE_INT:    return second.intValue != 0;
        case ATTRTYPE_BOOL:   return second.boolValue;
    }
    return defaultValue;
}

Here is the call graph for this function:

double AttributeValue::getDouble ( double  defaultValue = 0.0) const

Definition at line 103 of file Feature.cpp.

{
    switch( first ) {
        case ATTRTYPE_STRING: return osgEarth::as<double>(second.stringValue, defaultValue);
        case ATTRTYPE_DOUBLE: return second.doubleValue;
        case ATTRTYPE_INT:    return (double)second.intValue;
        case ATTRTYPE_BOOL:   return second.boolValue? 1.0 : 0.0;
    }
    return defaultValue;
}
int AttributeValue::getInt ( int  defaultValue = 0) const

Definition at line 115 of file Feature.cpp.

{
    switch( first ) {
        case ATTRTYPE_STRING: return osgEarth::as<int>(second.stringValue, defaultValue);
        case ATTRTYPE_DOUBLE: return (int)second.doubleValue;
        case ATTRTYPE_INT:    return second.intValue;
        case ATTRTYPE_BOOL:   return second.boolValue? 1 : 0;
    }
    return defaultValue;
}
std::string AttributeValue::getString ( ) const

Definition at line 91 of file Feature.cpp.

{
    switch( first ) {
        case ATTRTYPE_STRING: return second.stringValue;
        case ATTRTYPE_DOUBLE: return osgEarth::toString(second.doubleValue);
        case ATTRTYPE_INT:    return osgEarth::toString(second.intValue);
        case ATTRTYPE_BOOL:   return osgEarth::toString(second.boolValue);
    }
    return EMPTY_STRING;
}

Here is the call graph for this function:


The documentation for this struct was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines