Bookcase thoughts

My current area of play with Bookcase is changing the way the books are grouped. I'd like to show them grouped by author, and them change to genre, for example. I decided to cache a list of pointers to the book objects for each group. This became a bit tricky. My collection object holds a QDict, where the keys are the name of the attributes which may be used to group the books. The entry, though, is another QDict, where the keys are the values of the groups.

Now, I want to keep a list of pointers to the books which fall under this category, so I use a QPtrList of Books. So the variable becomes QDict<QDict<QPtrList<Book>>>. Typedefs made this look a bit clearer, but wow...

On top of that, since when a Book is modified or added, the QDict must be updated, I needed a way for the Book to know which lists it was in. The only implementation I could think of was the brute-force way of adding a QPtrList<QPtrList<Book>> to each Book. Then I go through and delete the Book from each QPtrList and so feels monstrously inefficient, but it seems to work.

Recent Entries