JSON Voorhees
Killer JSON for C++
Loading...
Searching...
No Matches
functional.hpp
Go to the documentation of this file.
1/** \file jsonv/functional.hpp
2 * A collection of function objects a la `<functional>`.
3 *
4 * Copyright (c) 2015 by Travis Gockel. All rights reserved.
5 *
6 * This program is free software: you can redistribute it and/or modify it under the terms of the Apache License
7 * as published by the Apache Software Foundation, either version 2 of the License, or (at your option) any later
8 * version.
9 *
10 * \author Travis Gockel (travis@gockelhut.com)
11**/
12#pragma once
13
14#include <jsonv/config.hpp>
15
16#include <functional>
17
18namespace jsonv
19{
20
21class value;
22
23/** \addtogroup Algorithm
24 * \{
25**/
26
27/** Compares a \c value to another using the standard-issue \c value::compare function. **/
29{
32 using result_type = int;
33
35 int operator()(const value& a, const value& b) const;
36};
37
38/** Compares two values, ignoring the case for any \c value with \c kind::string. This does \e not ignore case for the
39 * keys of objects.
40**/
42{
45 using result_type = int;
46
48 int operator()(const value& a, const value& b) const;
49};
50
51template <typename FCompare, typename FResult>
53 private FCompare,
54 private FResult
55{
58 using result_type = bool;
59
61 bool operator()(const value& a, const value& b) const
62 {
63 return FResult::operator()(FCompare::operator()(a, b), 0);
64 }
65};
66
79
80/** \} **/
81
82}
An adapter for enumeration types.
Represents a single JSON value, which can be any one of a potential kind, each behaving slightly diff...
Definition value.hpp:113
Copyright (c) 2014-2020 by Travis Gockel.
#define JSONV_NODISCARD
Warn if the caller discards the result of this function.
Definition config.hpp:121
Compares two values, ignoring the case for any value with kind::string.
Compares a value to another using the standard-issue value::compare function.