#ifndef VIRTUALMODELADAPTER_H
#define VIRTUALMODELADAPTER_H

#include <QVariant>

class VirtualModelInterface;

class VirtualModelAdapter {
private:
  VirtualModelInterface *m_virtualModelInterface;

public:
  VirtualModelInterface *getModel();
  void setModel(VirtualModelInterface *virtualModel);

public:
  void beginUpdate();
  void endUpdate();
  void queuedUpdate();

public:
  virtual int getItemsCount(void *parent) = 0;
  virtual void *getItem(void *parent, int index) = 0;
  virtual QVariant data(void *item, int role) = 0;

  // reimplement if you can optimize them
  virtual int indexOfItem(void *parent, void *item, int start = 0);
  virtual bool hasItems(void *parent);
  // needed to map item to QIndex by VirtualTreeModel::getItemIndex only
  virtual void *getItemParent(void *item);
};

#endif // VIRTUALMODELADAPTER_H
