Eric M. Ludlam | 16 Sep 2003 04:19
Gravatar

Re[1]: Some more Qt stuff

>>> myrkraverk <at> users.sourceforge.net seems to think that:
>Hello,
>
>I've successfully manaaged to get semantic to parse most of the Qt
>keywords, I think.  But when it comes to the following, I'm baffled,
>I've pretty much realized how the bnf format works, but not mastered
>it -- yet:
>
>class Q_EXPORT QLCDNumber : public QFrame	// LCD number widget
>{
>	:
>	:
>}
>
>I've simply no idea where to put stuff for the Q_EXPORT macro ;/

Would the Q_EXPORT macro add anything to the class definition?  If
not, I would recommend having the lexer treat it as whitespace using
semantic-flex-extensions.

>Another thing, is that Qt has documentation comments in the source
>code and I've been hoping it's possible to parse these into the
>semantic engine, so that I could have dynamic documentation stuff in
>ECB -- but let's leave out the ECB part for now.  Right now I'd just
>like to be able to access the stuff in semantic.  Here is a sample:
>
>/*!
>  Constructs an LCD number, sets the number of digits to 5, the base
>  to decimal, the decimal point mode to 'small' and the frame style to
>  a raised box. The segmentStyle() is set to \c Outline.
>
>  The \e parent and \e name arguments are passed to the QFrame constructor.
>
>  \sa setNumDigits(), setSmallDecimalPoint()
>*/
>
>QLCDNumber::QLCDNumber( QWidget *parent, const char *name )
>	: QFrame( parent, name )
>{
>    ndigits = 5;
>    init();
>}
>
>
>As you can see, the comment precedes the definition of the function,
>and in cases of inline functions, defined directly in the header
>files, the definition isn't even there.  There are also cross links in
>these comments (not whis one) and sometimes html tags (Qt docs are
>html, not info ;)  that I'd like to take advantages of, though I'm not
>sure that has anything to do with semantic.  There are also some \tags
>there I'm not sure what mean, but I don't think that's really
>important right now.
>
>Is it possible to parse this into docstrings in semantic?  What do I
>need to read/do to get this to work?

The function `semantic-find-documentation' should work already.  This
is the preferred way to get the doc for a tag/token as actually
storing documentation in the tag table can be a big waste of space
for something that is not searched on.  (At least, not yet.)

>What I'd ultimately like to do, is to get the following behaviour:
>
>  QWidget *w = new QWidget( this, "some widget");
>  w->setName("some name");
>        ^--------- point is here,
>        ECB shows me docs for QWidget::setName( const char * )
>
>(The above Qt classes and methods may not actually exist)
>
>So another question, is semantic smart enough to know the type of w,
>and be able to apply it to setName()?
>
>Please remember that I'm only using semantic becouse I'm using ECB and
>I'm not really a great elisp hacker ;)

This sounds like an extension to the existing `eldoc-mode' which is
wrapped up as `semantic-summary-mode'.  This function shows a
prototype in the minibuffer.  I've discovered the print mechanism for
our eldoc extension is not customizable.  I'll have to fix that.

Anyway, if you use `semantic-find-documentation' you should be able
to get what you want.

Eric

--

-- 
          Eric Ludlam:                 zappo <at> gnu.org, eric <at> siege-engine.com
   Home: http://www.ludlam.net            Siege: www.siege-engine.com
Emacs: http://cedet.sourceforge.net               GNU: www.gnu.org

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

Gmane