// base clone function
GError GAnimElement::BaseClone(const GElement& Source) {

	GError err;
	const GAnimElement& tmpElem = (const GAnimElement &)Source;

	DeleteProperties();
	err = CloneProperties(tmpElem);
	if (err == G_NO_ERROR)
		err = GElement::BaseClone(Source);
	return err;
}
GError GMultiProperty1D::Init(const GUInt32 SubPropertiesCount, const GClassID& SubPropertiesType,
							  const GKeyValue& DefaultValue, const GString& Labels) {

	if (SubPropertiesCount == 0)
		return G_INVALID_PARAMETER;

	// check if sub-properties type is supported
	if (Owner()) {
		GKernel *k = (GKernel *)Owner();
		if (!k->IsSupported(SubPropertiesType))
			return G_UNSUPPORTED_CLASSID;
	}

	// empty this property
	DeleteProperties();
	// extract labels
	GStringList extractedLabels = StrUtils::Split(Labels, ";", G_FALSE);

	GBool alreadyExists;
	GUInt32 index;
	GProperty *tmpProperty;

	// labels and SubPropertiesCount match, use specified names
	if (extractedLabels.size() == SubPropertiesCount) {
		GStringList::const_iterator it = extractedLabels.begin();
		for (GUInt32 i = 0; i < SubPropertiesCount; ++i) {
			tmpProperty = AddProperty(*it, SubPropertiesType, DefaultValue, alreadyExists, index);
			if (!tmpProperty)
				return G_MEMORY_ERROR;
			it++;
		}
	}
	// default name schema, use natural numbers "0", "1", "2", ...
	else {
		for (GUInt32 i = 0; i < SubPropertiesCount; ++i) {
			tmpProperty = AddProperty(StrUtils::ToString(i), SubPropertiesType, DefaultValue, alreadyExists, index);
			if (!tmpProperty)
				return G_MEMORY_ERROR;
		}
	}
	gSubPropertiesType = SubPropertiesType;
	return G_NO_ERROR;
}
void GProperty::Clear() {

	RemoveKeys();
	DeleteProperties();
}
Beispiel #4
0
		void DOM::Clear()
		{
			DeleteChilds();
			DeleteProperties();
			DeleteArray();
		}