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 <functional>
#include <iterator>
#include <map>
#include <optional>
#include <random>
#include <set>
#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::WhenTrue< T >
 True / if block query of Queryable<T>::branch method. More...
 
class  fcpp::WhenFalse< WhenTrueQueriedT, T >
 False / else block query of Queryable<T>::branch method. More...
 
class  fcpp::Merge< TrueT, FalseT >
 Merge result of both if and else block queries from Queryable<T>::branch method. More...
 
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(...)   __GET_MACRO__(__VA_ARGS__, __EXPR2__, __EXPR1__)(auto, __VA_ARGS__)
 Syntactic sugar for terse expressions using pass by value. More...
 
#define CR_EXPR(...)   __GET_MACRO__(__VA_ARGS__, __EXPR2__, __EXPR1__)(const auto &, __VA_ARGS__)
 Syntactic sugar for terse expressions using pass by constant reference. More...
 

Functions

template<typename T >
Queryable< T > fcpp::query (std::vector< T > items)
 Queries the sequence of items using a vector. More...
 
template<typename T >
bool fcpp::operator== (const Queryable< T > &lhs, const std::vector< T > &rhs)
 
template<typename T >
bool fcpp::operator== (const Queryable< T > &lhs, const Queryable< T > &rhs)
 

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.1
Date
2021-08-20

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 (   ...)    __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 (   ...)    __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

◆ operator==() [1/2]

template<typename T >
bool fcpp::operator== ( const Queryable< T > &  lhs,
const Queryable< T > &  rhs 
)
Parameters
lhsLeft operand Queryable<T> to compare.
rhsRight operand Queryable<T> to compare.
Returns
true if both sides are equal.
false if both side are not equal.

◆ operator==() [2/2]

template<typename T >
bool fcpp::operator== ( const Queryable< T > &  lhs,
const std::vector< T > &  rhs 
)
Remarks
Based off of internal items_ stored inside Queryable<T>.
Parameters
lhsLeft operand Queryable<T> to compare.
rhsRight operand std::vector<T> to compare.
Returns
true if both sides are equal.
false if both side are not equal.

◆ 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>