From 0a48e99a25759ae979a41f95d481a85c58ba027a Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 24 Jun 2011 08:32:25 +0000 Subject: [PATCH] From Ulrich Hertlein, "While we're on osgSim/ShapeAttribute, here's a fix that fixes the 'UNKNOW' typo and some doxygen" --- include/osgSim/ShapeAttribute | 20 +++++++++++++++---- src/osgSim/ShapeAttribute.cpp | 10 +++++----- .../osgSim/IO_ShapeAttribute.cpp | 2 +- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/include/osgSim/ShapeAttribute b/include/osgSim/ShapeAttribute index 36d762a0f..87caa7df7 100644 --- a/include/osgSim/ShapeAttribute +++ b/include/osgSim/ShapeAttribute @@ -25,10 +25,10 @@ namespace osgSim class OSGSIM_EXPORT ShapeAttribute { public: - + /// ShapeAttribute data type. enum Type { - UNKNOW, + UNKNOWN, INTEGER, DOUBLE, STRING @@ -55,17 +55,31 @@ class OSGSIM_EXPORT ShapeAttribute inline bool operator != (const osgSim::ShapeAttribute& sa) const { return compare(sa)!=0; } inline bool operator < (const osgSim::ShapeAttribute& sa) const { return compare(sa)<0; } + /// Get the attribute name. const std::string & getName() const { return _name; } + + /// Set the attribute name. void setName(const std::string& name) { _name = name; } + /// Get the attribute data type. const Type getType() const { return _type; } + /// Get the attribute data as an int. int getInt() const { return _integer; } + + /// Get the attribute data as a double. double getDouble() const { return _double; } + + /// Get the attribute data as a string. const char * getString() const { return _string; } + /// Set an integer attribute data. void setValue(int value) { free(); _type = INTEGER; _integer = value; } + + /// Set a double attribute data. void setValue(double value) { free(); _type = DOUBLE; _double = value; } + + /// Set a string attribute data. void setValue(const char * value); @@ -83,8 +97,6 @@ class OSGSIM_EXPORT ShapeAttribute double _double; char* _string; }; - - }; class OSGSIM_EXPORT ShapeAttributeList : public osg::Object, public osg::MixinVector diff --git a/src/osgSim/ShapeAttribute.cpp b/src/osgSim/ShapeAttribute.cpp index 0b40f5f91..b45103560 100644 --- a/src/osgSim/ShapeAttribute.cpp +++ b/src/osgSim/ShapeAttribute.cpp @@ -20,19 +20,19 @@ namespace osgSim { ShapeAttribute::ShapeAttribute() : - _type(UNKNOW), + _type(UNKNOWN), _integer(0) {} ShapeAttribute::ShapeAttribute(const char * name) : _name(name), - _type(UNKNOW), + _type(UNKNOWN), _integer(0) {} ShapeAttribute::ShapeAttribute(const char * name, int value) : _name(name), - _type(INTEGER), + _type(UNKNOWN), _integer(value) {} @@ -98,7 +98,7 @@ void ShapeAttribute::copy(const ShapeAttribute& sa) _double = sa._double; break; } - case UNKNOW: + case UNKNOWN: default: { _integer = 0; @@ -142,7 +142,7 @@ int ShapeAttribute::compare(const osgSim::ShapeAttribute& sa) const if (sa._double<_double) return 1; } case INTEGER: - case UNKNOW: + case UNKNOWN: default: { if (_integergetName())<<" "<getDouble() << std::endl; break; } - case osgSim::ShapeAttribute::UNKNOW: + case osgSim::ShapeAttribute::UNKNOWN: default: break; } }