Loading...
Searching...
No Matches
query.h File Reference

A library to express information in a functional way that allows for easy auto-complete and shorter expressions. More...

#include <algorithm>
#include <cstddef>
#include <functional>
#include <iterator>
#include <map>
#include <numeric>
#include <optional>
#include <random>
#include <set>
#include <stdexcept>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <valarray>
#include <variant>
#include <vector>
#include "asserts.h"
#include "traits.h"
#include "transforms.h"
Include dependency graph for query.h:

Go to the source code of this file.

Classes

class  fcpp::Queryable< T >
 Core object used to query items and hold the sequence state. More...
class  fcpp::Merge< TrueT, FalseT >
 Merge result of both if and else block queries from Queryable<T>::branch method. More...
class  fcpp::WhenFalse< WhenTrueQueriedT, T >
 False / else block query of Queryable<T>::branch method. More...
class  fcpp::WhenTrue< T >
 True / if block query of Queryable<T>::branch method. More...

Macros

#define EXPR(...)
 Syntactic sugar for terse expressions using pass by value.
#define CR_EXPR(...)
 Syntactic sugar for terse expressions using pass by constant reference.

Functions

template<typename T>
Queryable< T > fcpp::query (std::vector< T > items)
 Queries the sequence of items using a vector.

Detailed Description

A library to express information in a functional way that allows for easy auto-complete and shorter expressions.

Author
Andrew Walsh (awals.nosp@m.h128.nosp@m.@gmai.nosp@m.l.co.nosp@m.m)
Version
0.2
Date
2026-10-21

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Macro Definition Documentation

◆ CR_EXPR

#define CR_EXPR ( ...)
Value:
__GET_MACRO__(__VA_ARGS__, __EXPR2__, __EXPR1__)(const auto &, __VA_ARGS__)

Syntactic sugar for terse expressions using pass by constant reference.

  • List of variable names passed in.
    Returns
    Produced value of the variables and operations evaluated.
    Examples: CR_EXPR(x, y, x + y) CR_EXPR(x, x + 10)

◆ EXPR

#define EXPR ( ...)
Value:
__GET_MACRO__(__VA_ARGS__, __EXPR2__, __EXPR1__)(auto, __VA_ARGS__)

Syntactic sugar for terse expressions using pass by value.

  • List of variable names passed in.
    Returns
    Produced value of the variables and operations evaluated.
    Examples: EXPR(x, y, x + y) EXPR(x, x + 10)

Function Documentation

◆ query()

template<typename T>
Queryable< T > fcpp::query ( std::vector< T > items)

Queries the sequence of items using a vector.

Template Parameters
TType of items to query over.
Parameters
itemsItems to query over.
Returns
Queryable<T>