コード例 #1
0
ファイル: Inotify.cpp プロジェクト: erikzenker/Inotify
/**
 * @brief Blocking wait on new events of watched files/directories
 *        specified on the eventmask. FileSystemEvents
 *        will be returned one by one. Thus this
 *        function can be called in some while(true)
 *        loop.
 *
 * @return A new FileSystemEvent
 *
 */
boost::optional<FileSystemEvent> Inotify::getNextEvent()
{
    std::vector<FileSystemEvent> newEvents;

    while (mEventQueue.empty() && !mStopped) {
        auto length = readEventsIntoBuffer(mEventBuffer);
        readEventsFromBuffer(mEventBuffer.data(), length, newEvents);
        filterEvents(newEvents, mEventQueue);
    }

    if (mStopped) {
        return boost::none;
    }

    auto event = mEventQueue.front();
    mEventQueue.pop();
    return event;
}
コード例 #2
0
	bool EventBuffer::containsEvent(const EventNode& filterNode) const
	{
		std::vector<sf::Event> unused;
		return filterEvents(filterNode, unused);
	}