/
friendlyperch
/
QGrid
Обзор
Документация
Войти
/
friendlyperch
/
QGrid
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
dev-ver1
src/common/NullableBase.cpp
37 строк
792 B
okuntsev
move from github
13 янв 2026, 09:46
13 янв 2026, 09:46
fbdac0d
Код
Авторство
О чём код?
#include "NullableBase.h" NullableBase::NullableBase(QObject *parent) : QObject(parent), isNull(true), value(QVariant()) { } NullableBase::NullableBase(const NullableBase &value) : NullableBase(nullptr) { isNull = !value.hasValue(); this->value = value.getVariant(); } bool NullableBase::hasValue() const { return !isNull; } QVariant NullableBase::getVariant() const { return value; } void NullableBase::setVariant(const QVariant &value){ this->value = value; if(this->value.isValid()) isNull = false; } NullableBase &NullableBase::operator=(const NullableBase &nullableBase) { isNull = !nullableBase.hasValue(); if(isNull) { value = QVariant(); } else { value = nullableBase.getVariant(); } return *this; }