diff --git a/dtool/src/interrogate/interrogateBuilder.cxx b/dtool/src/interrogate/interrogateBuilder.cxx index 1d1a3e868d..56ba78e345 100644 --- a/dtool/src/interrogate/interrogateBuilder.cxx +++ b/dtool/src/interrogate/interrogateBuilder.cxx @@ -1357,6 +1357,11 @@ scan_element(CPPInstance *element, CPPStructType *struct_type, ielement._name = element->get_local_name(scope); ielement._scoped_name = descope(element->get_local_name(&parser)); + // See if there happens to be a comment before the element. + if (element->_leading_comment != (CPPCommentBlock *)NULL) { + ielement._comment = trim_blanks(element->_leading_comment->_comment); + } + ielement._type = get_type(TypeManager::unwrap_reference(element_type), false); if (ielement._type == 0) { // If we can't understand what type it is, forget it. @@ -1641,6 +1646,7 @@ get_function(CPPInstance *function, string description, CPPStructType *struct_type, CPPScope *scope, int flags, const string &expression) { + // Get a unique function signature. Make sure we tell the function // where its native scope is, so we get a fully-scoped signature. diff --git a/dtool/src/interrogatedb/interrogateDatabase.cxx b/dtool/src/interrogatedb/interrogateDatabase.cxx index 69499f8dbc..c800b81ed3 100644 --- a/dtool/src/interrogatedb/interrogateDatabase.cxx +++ b/dtool/src/interrogatedb/interrogateDatabase.cxx @@ -21,7 +21,7 @@ InterrogateDatabase *InterrogateDatabase::_global_ptr = NULL; int InterrogateDatabase::_file_major_version = 0; int InterrogateDatabase::_file_minor_version = 0; int InterrogateDatabase::_current_major_version = 2; -int InterrogateDatabase::_current_minor_version = 2; +int InterrogateDatabase::_current_minor_version = 3; //////////////////////////////////////////////////////////////////// // Function: InterrogateDatabase::Constructor diff --git a/dtool/src/interrogatedb/interrogateElement.I b/dtool/src/interrogatedb/interrogateElement.I index 9faa823077..5f9cca0b52 100644 --- a/dtool/src/interrogatedb/interrogateElement.I +++ b/dtool/src/interrogatedb/interrogateElement.I @@ -48,6 +48,7 @@ operator = (const InterrogateElement ©) { InterrogateComponent::operator = (copy); _flags = copy._flags; _scoped_name = copy._scoped_name; + _comment = copy._comment; _type = copy._type; _getter = copy._getter; _setter = copy._setter; @@ -85,6 +86,26 @@ get_scoped_name() const { return _scoped_name; } +//////////////////////////////////////////////////////////////////// +// Function: InterrogateElement::has_comment +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +INLINE bool InterrogateElement:: +has_comment() const { + return !_comment.empty(); +} + +//////////////////////////////////////////////////////////////////// +// Function: InterrogateElement::get_comment +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +INLINE const string &InterrogateElement:: +get_comment() const { + return _comment; +} + //////////////////////////////////////////////////////////////////// // Element: InterrogateElement::get_type // Access: Public diff --git a/dtool/src/interrogatedb/interrogateElement.cxx b/dtool/src/interrogatedb/interrogateElement.cxx index c472d79289..1c74a208d6 100644 --- a/dtool/src/interrogatedb/interrogateElement.cxx +++ b/dtool/src/interrogatedb/interrogateElement.cxx @@ -30,6 +30,7 @@ output(ostream &out) const { << _getter << " " << _setter << " "; idf_output_string(out, _scoped_name); + idf_output_string(out, _comment, '\n'); } //////////////////////////////////////////////////////////////////// @@ -43,6 +44,10 @@ input(istream &in) { InterrogateComponent::input(in); in >> _flags >> _type >> _getter >> _setter; idf_input_string(in, _scoped_name); + + if (InterrogateDatabase::get_file_minor_version() >= 3) { + idf_input_string(in, _comment); + } } //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/interrogatedb/interrogateElement.h b/dtool/src/interrogatedb/interrogateElement.h index 5134f5b57f..863e502545 100644 --- a/dtool/src/interrogatedb/interrogateElement.h +++ b/dtool/src/interrogatedb/interrogateElement.h @@ -37,6 +37,9 @@ public: INLINE bool has_scoped_name() const; INLINE const string &get_scoped_name() const; + INLINE bool has_comment() const; + INLINE const string &get_comment() const; + INLINE TypeIndex get_type() const; INLINE bool has_getter() const; INLINE FunctionIndex get_getter() const; @@ -57,6 +60,7 @@ private: int _flags; string _scoped_name; + string _comment; TypeIndex _type; FunctionIndex _getter; FunctionIndex _setter;