Help offered

Lior Mualem lior.com at gmail.com
Wed Feb 25 22:38:53 UTC 2009


On Wed, Feb 25, 2009 at 5:41 PM, David Nolden <
david.nolden.kdevelop at art-master.de> wrote:

> Am Mittwoch 25 Februar 2009 14:10:46 schrieb Lior Mualem:
> > 1. I couldn't find a "Class Browser" tool, is anyone doing something like
> > that? or can I start sketching something? I would hate doing duplicate
> > work.
> That thing has been moved into playground because it isn't ready yet. If
> you
> would fix it up, we could move it back into kdevplatform. I personally
> don't
> really need it, but it feels like there is high demand for it. :-)

We'll the reason I wanted such a thing is to be able to search and navigate
the classes in the project easily. sometimes having a file view from the
project isn't enough.
I also noticed that there exists a duchainviewer project under
extra-plugins, I didn't try to compile it or use it yet but isn't it the
same as a class browser? or is it ment to show lower level than a class
(such as code block).



> The main problem of the class-browser is that it currently is somewhat
> inefficient, because it loads too much duchain data. I have some ideas on
> how
> to make it more efficient, by only loading data for really visible items,
> and
> only when the class-browser is actually visible.

I'll be sure to contact you about this once I have the class browser under
control.


> Any help here would greatly be appreciated.
> > I already think that kdevelop rocks, especially it's cpp parser - one of
> > the best ones I've seen (although it still can't parse
> > boost::multi_index_container properly, no one can, but I'm sure it's just
> > temporary ;) ).
> > I can't wait to help improve it further and make it the best IDE around!
>
>
> I haven't used multi_index_container. If you could extract a minimal
> example
> from it that shows what is not working about it, then I could fix it.


Well, it's not exactly minimal.
I'll give a small program and comment about the stuff that didn't parse
well.
The program compiles successfully so it means that no include directive is
missing

** CODE **

#include <boost/foreach.hpp>
#include <iostream>

#include <string>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/composite_key.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/ordered_index.hpp>

struct Entry
{
    Entry(int ValA,
          int ValB,
          std::string ValC) :
        m_ValA(ValA),
        m_ValB(ValB),
        m_ValC(ValC)
    {}

    int m_ValA;
    int m_ValB;
    std::string m_ValC;
};

typedef boost::multi_index::member<
    Entry,
    int,
    &Entry::m_ValA> TValAMember;

typedef boost::multi_index::member<
    Entry,
    int,
    &Entry::m_ValB> TValBMember;

typedef boost::multi_index::member<
    Entry,
    std::string,
    &Entry::m_ValC> TValCMember;

// the "composite_key" class is not recognized.
// I don't think I ever used it directly, it's more for the indexing below
but
// I guess that if we failed to identify it here than we'll fail to complete
// the definition of the index below.
typedef boost::multi_index::composite_key<
    Entry,
    TValBMember,
    TValCMember
> TValBCCompositeKey;

struct ValAIndex {};
struct ValBCIndex {};

// Below, the "indexed_by" class and the "tag" classes are not recognized.
// since it's the heart of the whole multi_index_container, i guess that
// failure to recognize this class will cause the entire
multi_index_container
// definition to fail parsing.
typedef boost::multi_index::multi_index_container<
    Entry,
    boost::multi_index::indexed_by<
        boost::multi_index::hashed_unique<
            boost::multi_index::tag<ValAIndex>,
            TValAMember
        >,
        boost::multi_index::ordered_non_unique<
            boost::multi_index::tag<ValBCIndex>,
            TValBCCompositeKey
        >
    >
> TContainer;

// The "index_iterator" class is not recognized - I can't go to its
definition
// but it's not marked with a red underline as well.
// The "type" class is not recognized - but I guess it's because the
// index_iterator class is not recognized (maybe it's because the
// TContainer class wasn't parsed well?).
typedef TContainer::index_iterator<ValAIndex>::type TValAIterator;
typedef TContainer::index_iterator<ValBCIndex>::type TValBCInterator;

void UseContainer()
{
  TContainer Container;

  Container.insert( Entry(1, 1, "1") );
  Container.insert( Entry(2, 2, "2") );
  Container.insert( Entry(3, 3, "3") );
  Container.insert( Entry(4, 4, "4") );

  BOOST_FOREACH( const Entry& value, Container.get<ValBCIndex>() )
  {
    std::cout << value.m_ValC << std::endl;
  }

  TValAIterator iter = Container.get<ValAIndex>().find(1);
  std::cout << iter->m_ValC << std::endl;

  // Needless to say that I get no results for the "Container" class members
when I try code
  // completion for the above code.

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20090226/56bf1681/attachment.html>


More information about the KDevelop-devel mailing list