Beispiel #1
0
/**
 * @author Rafal 'Vogel' Malinowski
 * @short Store string list to storagePoint XML node.
 *
 * Store string list to storagePoint XML node. Each item is stored to subnode
 * with name given by methos @link<storageItemNodeName> storageItemNodeName @endlink.
 */
void StorableStringList::store()
{
	if (!isValidStorage())
		return;

	auto stringListStorage = StringListStorage(storage().get(), storageItemNodeName());
	stringListStorage.store(content());
}
Beispiel #2
0
/**
 * @author Rafal 'Vogel' Malinowski
 * @short Load string list from storagePoint XML node.
 *
 * Load string list from storagePoint XML node. Each item is loaded from subnode
 * with name given by methos @link<storageItemNodeName> storageItemNodeName @endlink.
 * If storagePoint is invalid no data is loaded (and no data is removed from this
 * string list).
 */
void StorableStringList::load()
{
	if (!isValidStorage())
		return;

	StorableObject::load();

	auto stringListStorage = StringListStorage(storage().get(), storageItemNodeName());
	StringList = stringListStorage.load();
}
/**
 * @author Rafal 'Vogel' Malinowski
 * @short Store string list to storagePoint XML node.
 *
 * Store string list to storagePoint XML node. Each item is stored to subnode
 * with name given by methos @link<storageItemNodeName> storageItemNodeName @endlink.
 */
void StorableStringList::store()
{
	if (!isValidStorage())
		return;

	XmlConfigFile *storageFile = storage()->storage();
	QDomElement point = storage()->point();

	storageFile->removeChildren(point);

	foreach (const QString &value, content())
		storageFile->appendTextNode(point, storageItemNodeName(), value);
}
/**
 * @author Rafal 'Vogel' Malinowski
 * @short Load string list from storagePoint XML node.
 *
 * Load string list from storagePoint XML node. Each item is loaded from subnode
 * with name given by methos @link<storageItemNodeName> storageItemNodeName @endlink.
 * If storagePoint is invalid no data is loaded (and no data is removed from this
 * string list).
 */
void StorableStringList::load()
{
	if (!isValidStorage())
		return;

	StorableObject::load();

	StringList.clear();

	XmlConfigFile *storageFile = storage()->storage();
	QDomElement point = storage()->point();

	QList<QDomElement> elements = storageFile->getNodes(point, storageItemNodeName());
	foreach (const QDomElement &element, elements)
		StringList.append(element.text());
}