Exemple #1
0
Substyle::~Substyle()
{
	if (IsNotSet())
		return;
	if (IsCurrency())
		delete AsCurrency();
	else if (IsDate())
		delete AsDate();
	else if (IsDuration())
		delete AsDuration();
	else if (IsPercent())
		delete AsPercent();
}
Exemple #2
0
void
Value::DeleteData()
{
	if (!Ok())
		return;
	if (IsDouble() || IsPercentage())
		delete AsDouble();
	else if (IsString())
		delete AsString();
	else if (IsDate())
		delete AsDate();
	else if (IsDuration())
		delete AsDuration();
	data_ = nullptr;
	type_ = ods::Type::NotSet;
}
Exemple #3
0
QString
Value::toString() const
{
	if (!Ok())
		return "";
	
	if (IsDouble() || IsPercentage())
		return QString::number(*AsDouble());
	if (IsString())
		return *AsString();
	if (IsDate())
		return AsDate()->toString(Qt::ISODate);
	if (IsCurrency())
		mtl_qline("Currency not supported yet");
	if (IsDuration())
		return AsDuration()->ToString();
	
	return "";
}
Exemple #4
0
void
Value::CopyTo(ods::Value &v)
{
	v.type_set(type_);
	if (NoValue())
		return;
	if (IsDouble())
		v.SetDouble(*AsDouble());
	else if (IsString())
		v.SetString(*AsString());
	else if (IsCurrency())
		v.SetCurrency(*AsCurrency());
	else if (IsPercentage())
		v.SetPercentage(*AsPercentage());
	else if (IsDate())
		v.SetDate(*AsDate());
	else if (IsDuration())
		v.SetDuration(*AsDuration());
	else
		mtl_warn("Not implemented");
}