Arbiter
Dependency manager library that supports decentralization
Namespaces | Classes | Typedefs | Functions | Variables
Arbiter Namespace Reference

Namespaces

 Exception
 
 Requirement
 

Classes

class  Base
 Base class for public-facing Arbiter types, such that they automatically get freeing, cloning, equality, and description functionality. More...
 
struct  IteratorRange
 Represents a pair of iterators bracketing the start and end of a range. More...
 
class  MultipassIterator
 Contains the state necessary to perform an algorithm over an iterator multiple times. More...
 
struct  None
 Sentinel value which can be used to create an empty Optional of any type. More...
 
struct  Optional
 Represents a value which may or may not exist. More...
 
class  PermutationIterator
 An iterator which generates every possible combination of the values of other iterators. More...
 
class  SharedUserValue
 Expresses shared ownership of an opaque user-provided value type, which was originally described in an ArbiterUserValue. More...
 

Typedefs

template<typename It >
using IteratorResultVector = std::vector< typename std::iterator_traits< It >::value_type >
 The result type of an iterator which yields dynamically-created vectors. More...
 

Functions

std::string copyAcquireCString (char *str)
 Returns a string which is a copy of str, which will then be freed. More...
 
std::unique_ptr< char[]> copyCString (const std::string &str)
 Returns a unique_ptr which wraps a NUL-terminated copy of the c_str() of the given string. More...
 
template<typename T >
size_t hashOf (const T &value)
 Hashes an arbitrary value that has an std::hash specialization. More...
 
template<typename Collection >
auto makeIteratorRange (Collection &collection)
 Creates an IteratorRange encompassing the entirety of the given collection. More...
 
template<typename Collection >
auto makeIteratorRange (const Collection &collection)
 Creates an IteratorRange encompassing the entirety of the given read-only collection. More...
 
template<typename T >
auto makeOptional (T &&value)
 Creates an Optional from a value, inferring its type. More...
 
template<typename Map , typename Key , typename Value = typename Map::mapped_type>
Optional< Value > maybeAt (const Map &map, const Key &key)
 Looks up a key in a map, returning the corresponding value if it exists. More...
 
template<typename T >
bool operator== (const Optional< T > &lhs, const Optional< T > &rhs)
 
template<typename Swappable >
void reset (Swappable &value)
 Resets a swappable value to its default constructor. More...
 
std::shared_ptr< void > shareUserContext (ArbiterUserContext context)
 Converts an ArbiterUserContext into a shared pointer, automatically invoking its destructor when the last shared pointer is destructed. More...
 
template<typename T >
std::string toString (const T &value)
 Converts an arbitrary value into a string, using operator<<. More...
 

Variables

std::unique_ptr< char[], decltype(&free)> acquireCString (char *str)
 Returns a unique_ptr which takes ownership of str. More...
 

Class Documentation

§ Arbiter::None

struct Arbiter::None

Sentinel value which can be used to create an empty Optional of any type.

Definition at line 18 of file Optional.h.

Typedef Documentation

§ IteratorResultVector

template<typename It >
using Arbiter::IteratorResultVector = typedef std::vector<typename std::iterator_traits<It>::value_type>

The result type of an iterator which yields dynamically-created vectors.

Definition at line 113 of file Iterator.h.

Function Documentation

§ copyAcquireCString()

std::string Arbiter::copyAcquireCString ( char *  str)

Returns a string which is a copy of str, which will then be freed.

§ copyCString()

std::unique_ptr<char[]> Arbiter::copyCString ( const std::string &  str)

Returns a unique_ptr which wraps a NUL-terminated copy of the c_str() of the given string.

§ hashOf()

template<typename T >
size_t Arbiter::hashOf ( const T &  value)

Hashes an arbitrary value that has an std::hash specialization.

This function is slightly more convenient than using std::hash directly, because of type inference.

Definition at line 19 of file Hash.h.

§ makeIteratorRange() [1/2]

template<typename Collection >
auto Arbiter::makeIteratorRange ( Collection &  collection)

Creates an IteratorRange encompassing the entirety of the given collection.

Definition at line 34 of file Iterator.h.

§ makeIteratorRange() [2/2]

template<typename Collection >
auto Arbiter::makeIteratorRange ( const Collection &  collection)

Creates an IteratorRange encompassing the entirety of the given read-only collection.

Definition at line 45 of file Iterator.h.

§ makeOptional()

template<typename T >
auto Arbiter::makeOptional ( T &&  value)

Creates an Optional from a value, inferring its type.

Definition at line 247 of file Optional.h.

§ maybeAt()

template<typename Map , typename Key , typename Value = typename Map::mapped_type>
Optional<Value> Arbiter::maybeAt ( const Map &  map,
const Key &  key 
)

Looks up a key in a map, returning the corresponding value if it exists.

Definition at line 18 of file Algorithm.h.

§ operator==()

template<typename T >
bool Arbiter::operator== ( const Optional< T > &  lhs,
const Optional< T > &  rhs 
)

Definition at line 234 of file Optional.h.

§ reset()

template<typename Swappable >
void Arbiter::reset ( Swappable &  value)

Resets a swappable value to its default constructor.

Definition at line 32 of file Algorithm.h.

§ shareUserContext()

std::shared_ptr<void> Arbiter::shareUserContext ( ArbiterUserContext  context)

Converts an ArbiterUserContext into a shared pointer, automatically invoking its destructor when the last shared pointer is destructed.

§ toString()

template<typename T >
std::string Arbiter::toString ( const T &  value)

Converts an arbitrary value into a string, using operator<<.

Definition at line 18 of file ToString.h.

Variable Documentation

§ acquireCString

std::unique_ptr<char[], decltype(&free)> Arbiter::acquireCString(char *str)

Returns a unique_ptr which takes ownership of str.

Definition at line 34 of file ToString.h.