diff --git a/include/osgIntrospection/ReflectionMacros b/include/osgIntrospection/ReflectionMacros index 1a96287df..7fdf86205 100644 --- a/include/osgIntrospection/ReflectionMacros +++ b/include/osgIntrospection/ReflectionMacros @@ -164,6 +164,8 @@ namespace osgIntrospection // BASIC CONFIGURATION // -------------------------------------------------------------------------- +#define I_DeclaringFile(f) setDeclaringFile(f); + #define I_Attribute(c) cap->addAttribute(new c); #define I_ReaderWriter(x) setReaderWriter(new x); diff --git a/include/osgIntrospection/Reflector b/include/osgIntrospection/Reflector index 10cec79a0..ff236a862 100644 --- a/include/osgIntrospection/Reflector +++ b/include/osgIntrospection/Reflector @@ -113,6 +113,9 @@ namespace osgIntrospection /// Sets the current type's ReaderWriter object. void setReaderWriter(const ReaderWriter* rw); + + /// Sets the current type's declaring file. + void setDeclaringFile(const std::string& file) const; private: struct PtrConstructor: ConstructorInfo @@ -962,6 +965,12 @@ namespace osgIntrospection _type->_cmp = cmp; } + template + void Reflector::setDeclaringFile(const std::string& file) const + { + _type->_declaringFile = file; + } + } #endif diff --git a/include/osgIntrospection/Type b/include/osgIntrospection/Type index 2bb3db48e..359e24c65 100644 --- a/include/osgIntrospection/Type +++ b/include/osgIntrospection/Type @@ -242,6 +242,11 @@ namespace osgIntrospection /// this type, if any. Otherwise it returns the null pointer. inline const Comparator* getComparator() const; + /// Returns the path to the file where this type is declared, + /// relative the the OpenSceneGraph include directory. Returns + /// the empty string if no path information is available. + inline const std::string &getDeclaringFile() const; + /// Creates an instance of the reflected type. The returned Value /// can be casted to T*, where T is the reflected type. If the type /// is abstract, an exception is thrown. @@ -302,6 +307,8 @@ namespace osgIntrospection std::string _briefHelp; std::string _detailedHelp; + + std::string _declaringFile; }; // OPERATORS @@ -550,6 +557,10 @@ namespace osgIntrospection return false; } + inline const std::string &Type::getDeclaringFile() const + { + return _declaringFile; + } } #endif