Mercurial > repo
view interps/rail/src/Binding.cpp @ 12518:2d8fe55c6e65 draft default tip
<int-e> learn The password of the month is release incident pilot.
author | HackEso <hackeso@esolangs.org> |
---|---|
date | Sun, 03 Nov 2024 00:31:02 +0000 |
parents | 859f9b4339e6 |
children |
line wrap: on
line source
// Binding.cpp #include "lib.h" #include "Var.h" #include "Binding.h" using namespace std; Binding::Binding() : data(NULL) { } Binding::Binding(Var * newData) { data = newData; if (!null()) { data->acquire(); } } Binding::~Binding() { if (!null()) { data->release(); } } Binding::Binding(Binding const & right) { data = right.data; if (!null()) { data->acquire(); } } Binding & Binding::operator=(Binding const & right) { Binding temp(right); swap(data, temp.data); return *this; } Var * Binding::operator->(void) { return data; } Var const * Binding::operator->(void) const { return data; } Var & Binding::operator*(void) { return *data; } Var const & Binding::operator*(void) const { return*data; } bool Binding::null(void) { return data == NULL; }