Overview
Features
Download
Documentation
Community
Add-Ons & Services

Using DirectoryWatcher

Please post support and help requests here.

Using DirectoryWatcher

Postby skegg » 25 Nov 2012, 21:35

I want to use class Poco::DirectoryWatcher to receive notifications about new files appearing in a directory. I create DirectoryWatcher object

Code: Select all
DirectoryWatcher dw (string ("dir"));


Then I have a problem adding a delagate to event itemAdded. I want to use a method onAdd of the object listener, that instantiates class Controller

Code: Select all
class Controller {
  public:
  void onAdd (const void*, DirectoryWatcher::DirectoryEvent&) {
      cout << "Event" << endl;
  }
};

.....

Controller listener;
dw.itemAdde += delegate (&listener, &Controller::onAdd);

And here I receive compilation error. What do I do wrong and what and how must I do?

All required headers were included.

Poco library 1.45, Xubuntu 12.04, gcc 4.6.

Thanks.
skegg
 
Posts: 2
Joined: 25 Nov 2012, 21:32

Re: Using DirectoryWatcher

Postby alex » 26 Nov 2012, 05:52

skegg wrote:how must I do?

Code: Select all
class Controller {
  public:
  void onAdd (const DirectoryWatcher::DirectoryEvent&) {
      cout << "Event" << endl;
  }
};

.....

Controller listener;
dw.itemAdded += delegate (&listener, &Controller::onAdd);

See also this complete example posted today.
alex
 
Posts: 1101
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Using DirectoryWatcher

Postby skegg » 27 Nov 2012, 18:50

Thanks. I have already found the error myself. But your code helped me to learn some features of Poco I had not known.
skegg
 
Posts: 2
Joined: 25 Nov 2012, 21:32


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron