0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00
construct/include/ircd/js/for_each.h
2018-02-05 21:24:34 -08:00

45 lines
1.4 KiB
C++

// 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_JS_FOR_EACH_H
namespace ircd {
namespace js {
enum class iter
{
none = 0,
enumerate = JSITER_ENUMERATE,
for_each = JSITER_FOREACH,
key_val = JSITER_KEYVALUE,
own_only = JSITER_OWNONLY,
hidden = JSITER_HIDDEN,
symbols = JSITER_SYMBOLS,
symbols_only = JSITER_SYMBOLSONLY,
};
// Key iteration (as id type)
using each_id = std::function<void (const id &)>;
void for_each(object::handle, const iter &flags, const each_id &);
void for_each(object::handle, const each_id &);
// Key iteration (as value)
using each_key = std::function<void (const value &)>;
void for_each(object::handle, const each_key &);
void for_each(object::handle, const iter &flags, const each_key &);
// Key/Value iteration (as value => value)
using each_key_val = std::function<void (const value &, const value &)>;
void for_each(object::handle, const each_key_val &);
void for_each(object::handle, const iter &flags, const each_key_val &);
} // namespace js
} // namespace ircd