0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-04 21:08:57 +01:00
construct/include/ircd/m/events.h

39 lines
1.3 KiB
C
Raw Normal View History

// Matrix Construct
//
// Copyright (C) Matrix Construct Developers, Authors & Contributors
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice is present in all copies. The
// full license for this software is available in the LICENSE file.
#pragma once
#define HAVE_IRCD_M_EVENTS_H
namespace ircd::m::events
{
struct range;
using closure_bool = std::function<bool (const event::idx &, const event &)>;
bool for_each(const range &, const closure_bool &);
bool for_each(const range &, const event_filter &, const closure_bool &);
}
/// Range to start (inclusive) and stop (exclusive). If start is greater than
/// stop a reverse iteration will occur. -1 (or unsigned max value) can be used
/// to start or stop at the end. 0 can be used to start or stop at the beginning.
///
struct ircd::m::events::range
:std::pair<event::idx, event::idx>
{
2019-01-10 02:57:13 +01:00
const event::fetch::opts *fopts {nullptr};
range(const event::idx &start,
const event::idx &stop = -1,
const event::fetch::opts *const &fopts = nullptr)
:std::pair<event::idx, event::idx>{start, stop}
2019-01-10 02:57:13 +01:00
,fopts{fopts}
{}
};