Skip to content
Snippets Groups Projects

procedural aql

Merged Jan Trávníček requested to merge merge-jt into master
2 files
+ 14
21
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -114,30 +114,33 @@ public:
template < class Type >
class ValueHolder : public ValueHolderImpl < Type > {
public:
ValueHolder ( const std::shared_ptr < abstraction::OperationAbstraction > & ref, Type && value, bool temporary ) : ValueHolderImpl < Type > ( ref, ParamQualifiers::paramQualifiers < Type > ( ), temporary ) {
ValueHolder ( Type && value, bool temporary ) : ValueHolderImpl < Type > ( temporary ) {
if ( this->isLvalueRef ( ) && this->isTemporary ( ) )
throw std::domain_error ( "Lvalue references cannot be temporaries." );
this->setData ( std::forward < Type > ( value ) );
}
std::shared_ptr < abstraction::Value > clone ( const std::shared_ptr < abstraction::OperationAbstraction > & lifeReference, ParamQualifiers::ParamQualifierSet paramQualifierSet, bool isTemporary, bool move ) override {
if ( ( paramQualifierSet && ParamQualifiers::ParamQualifierSet::LREF || paramQualifierSet && ParamQualifiers::ParamQualifierSet::RREF ) && this->isTemporary ( ) && ! this->isRef ( ) && lifeReference == nullptr )
throw std::domain_error ( "Taking reference to a temporary" );
std::shared_ptr < abstraction::Value > clone ( ParamQualifiers::ParamQualifierSet paramQualifierSet, bool isTemporary ) override {
/* if ( ( paramQualifierSet && ParamQualifiers::ParamQualifierSet::LREF || paramQualifierSet && ParamQualifiers::ParamQualifierSet::RREF ) && this->isTemporary ( ) && ! this->isRef ( ) && this->getTemporaryReferences ( ) == 0 )
throw std::domain_error ( "Taking reference to a temporary" );*/
if ( ( paramQualifierSet && ParamQualifiers::ParamQualifierSet::CONST ) && ( paramQualifierSet && ParamQualifiers::ParamQualifierSet::LREF ) )
return std::make_shared < abstraction::ValueHolder < const std::decay_t < Type > & > > ( lifeReference, retrieveValue < const std::decay_t < Type > & > ( this->getProxyAbstraction ( ), move ), isTemporary );
return std::make_shared < abstraction::ValueHolder < const std::decay_t < Type > & > > ( retrieveValue < const std::decay_t < Type > & > ( this->shared_from_this ( ) ), isTemporary );
else if ( ( paramQualifierSet && ParamQualifiers::ParamQualifierSet::CONST ) && ( paramQualifierSet && ParamQualifiers::ParamQualifierSet::RREF ) )
return std::make_shared < abstraction::ValueHolder < const std::decay_t < Type > && > > ( lifeReference, retrieveValue < const std::decay_t < Type > && > ( this->getProxyAbstraction ( ), move ), isTemporary );
return std::make_shared < abstraction::ValueHolder < const std::decay_t < Type > && > > ( retrieveValue < const std::decay_t < Type > && > ( this->shared_from_this ( ) ), isTemporary );
else if ( paramQualifierSet && ParamQualifiers::ParamQualifierSet::LREF )
return std::make_shared < abstraction::ValueHolder < std::decay_t < Type > & > > ( lifeReference, retrieveValue < std::decay_t < Type > & > ( this->getProxyAbstraction ( ), move ), isTemporary );
return std::make_shared < abstraction::ValueHolder < std::decay_t < Type > & > > ( retrieveValue < std::decay_t < Type > & > ( this->shared_from_this ( ) ), isTemporary );
else if ( paramQualifierSet && ParamQualifiers::ParamQualifierSet::RREF )
return std::make_shared < abstraction::ValueHolder < std::decay_t < Type > && > > ( lifeReference, retrieveValue < std::decay_t < Type > && > ( this->getProxyAbstraction ( ), move ), isTemporary );
return std::make_shared < abstraction::ValueHolder < std::decay_t < Type > && > > ( retrieveValue < std::decay_t < Type > && > ( this->shared_from_this ( ) ), isTemporary );
else if constexpr ( std::is_abstract_v < std::decay_t < Type > > )
throw std::domain_error ( "Cannot declare value of abstract class." );
else if constexpr ( ! std::is_assignable_v < std::decay_t < Type > &, std::decay_t < Type > > )
throw std::domain_error ( "Cannot assign value." );
else if ( paramQualifierSet && ParamQualifiers::ParamQualifierSet::CONST )
return std::make_shared < abstraction::ValueHolder < const std::decay_t < Type > > > ( lifeReference, retrieveValue < const std::decay_t < Type > > ( this->getProxyAbstraction ( ), move ), isTemporary );
return std::make_shared < abstraction::ValueHolder < const std::decay_t < Type > > > ( retrieveValue < const std::decay_t < Type > > ( this->shared_from_this ( ) ), isTemporary );
else
return std::make_shared < abstraction::ValueHolder < std::decay_t < Type > > > ( lifeReference, retrieveValue < std::decay_t < Type > > ( this->getProxyAbstraction ( ), move ), isTemporary );
return std::make_shared < abstraction::ValueHolder < std::decay_t < Type > > > ( retrieveValue < std::decay_t < Type > > ( this->shared_from_this ( ) ), isTemporary );
}
abstraction::ParamQualifiers::ParamQualifierSet getTypeQualifiers ( ) const override {
Loading