apol added inline comments.

INLINE COMMENTS

> kinotify.cpp:365
>  
> +     // All events which need a decoded path, i.e. everything
> +     // but EventMoveFrom | EventQueueOverflow | EventIgnored

Indentation looks off.

> kinotify.cpp:371
> +            EventMoveTo | EventOpen | EventUnmount;
> +     const QString fname = event->mask & fileEvents ? 
> QFile::decodeName(path) : QString();
> +

This conditional looks off, maybe it would make sense to have an intermediate 
class to decide when to initialize it?

Something like this:

  template <typename T>
  class Delayed
  {
  public:
      Delayed(std::function<T()> func) : m_func(func) {}
      T operator*() {
          if (!m_value) {
              m_value = m_func();
          }
          return *m_value;
      }
      std::function<T()> m_func;
      std::optional<T> m_value;
  };

and consuming it as

  Delayed<QString> fname([&path]{return QFile::decodeName(path);});
  //...
  Q_EMIT accessed(*fname);

Then the object itself makes sure it's initialised just once without the risk 
of forgetting one of the cases.

REPOSITORY
  R293 Baloo

REVISION DETAIL
  https://phabricator.kde.org/D28325

To: bruns, #baloo, ngraham
Cc: apol, kde-frameworks-devel, hurikhan77, lots0logs, LeGast00n, cblack, 
fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, 
ngraham, bruns, abrahams

Reply via email to