From Mike Wittman, "This change to genwrapper and osgIntrospection gives access to

the declaring file for a given type via the new member function
osgIntrospection::Type::getDeclaringFile.  This information is useful
in order to know what header to include when auto-generating wrappers
for a given type.

During the C# wrapper generator development I've been keeping the
declaring file configuration state up-to-date manually with changes
to OSG, and it's proven to require substantial effort.  So it would be
extremely valuable to get this change in before 2.0 to reduce maintenance
during the lifetime of the release.  It'll also be equally useful to
others looking to create wrapper generators using osgIntrospection.

This is a fairly simple change and was tested with a fresh rebuild of the
entire suite of osgWrapper libraries, so it should be relatively low risk
(fingers crossed)."
This commit is contained in:
Robert Osfield 2007-06-08 10:11:00 +00:00
parent 0cd7dd12bc
commit 2fbbbca1a0
3 changed files with 22 additions and 0 deletions

View File

@ -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);

View File

@ -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<typename T>
void Reflector<T>::setDeclaringFile(const std::string& file) const
{
_type->_declaringFile = file;
}
}
#endif

View File

@ -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