Class Part

Class Documentation

class URI::Template::Part

URI-template part.

This class represent type-safe union for template part instances. The part can hold either Literal or Expression instance.

Public Functions

template<typename ...Args, typename = std::enable_if_t<!std::is_same<detail::typelist<Part>, detail::typelist<std::decay_t<Args>...>>::value>>
inline Part(Args&&... args)

Parametrized constructor.

Creates a template part. Type of the part deduced from args.

Template Parameters

...Args – Types of args.

Parameters

[in] ...args – Arguments to pass to the part constructor.

Part(const Part&) = default

Copy constructor.

Part &operator=(const Part&) = default

Copy assignment.

Part(Part&&) noexcept = default

Move constructor.

Part &operator=(Part&&) noexcept = default

Move assignment.

~Part() = default

Destructor.

template<class T>
inline T &Get()

Get specific representation.

Template Parameters

T – Type of the representation to get. Either:

Throws

std::bad_variant_access – if type mismatch.

Returns

A reference of T to stored instance.

template<class T>
inline const T &Get() const

Get specific representation.

Template Parameters

T – Type of the representation to get. Either Literal or Expression.

Throws

std::bad_variant_access – if type mismatch.

Returns

A const reference of T to stored instance.

inline PartType Type() const

Get type of the part.

inline std::string String() const noexcept

Get the part string.

inline bool operator==(const Part &rhs) const

Compares two parts.

inline bool operator!=(const Part &rhs) const

Compares two parts.