first reCommit
This commit is contained in:
66
items/xqitemfactory.h
Normal file
66
items/xqitemfactory.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* **************************************************************************
|
||||
|
||||
source::worx xtree
|
||||
Copyright © 2024-2025 c.holzheuer
|
||||
christoph.holzheuer@gmail.com
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef XQITEMFACTORY_H
|
||||
#define XQITEMFACTORY_H
|
||||
|
||||
#include <xqitem.h>
|
||||
#include <xqitemtype.h>
|
||||
#include <functional>
|
||||
|
||||
class XQModel;
|
||||
|
||||
// erzeugt items aus XQNodes
|
||||
|
||||
class XQItemFactory : public xsingleton<XQItemFactory>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
void initItemFactory(const QString& modelSheetFileName );
|
||||
|
||||
XQNodePtr findModelSheet( const QString& modelName ) const;
|
||||
|
||||
|
||||
XQItem* makeItem( const XQNodePtr& contentNode, const XQNodePtr& sheetEntry ) const;
|
||||
XQItem* makeHeaderItem(const XQNodePtr& typeSheetNode ) const;
|
||||
|
||||
virtual XQItemList createDataRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode );
|
||||
virtual XQItemList createEmptyRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode );
|
||||
virtual XQItemList createGenericRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode );
|
||||
|
||||
void setItemDataFromString( XQItem& item, const QString& roleKey, const QString& source ) const;
|
||||
|
||||
// __fix! unsinn!
|
||||
XQItemType* findItemType(const QString& key ) const;
|
||||
QVariant makeVariant(int dataRole, const QString &value ) const;
|
||||
|
||||
protected:
|
||||
|
||||
bool isValid();
|
||||
|
||||
// shortcuts
|
||||
using ItemConfigFunc = std::function<void( XQItem* item, const QString& attrValue, XQNodePtr contentNode, XQNodePtr sheetNode )>;
|
||||
using ItemConfigMap = QMap<QString,ItemConfigFunc>;
|
||||
|
||||
XQItemTypeMap s_ItemTypeCache;
|
||||
|
||||
// Beschreibung des XQModels
|
||||
XQNodePtr _modelSheet{};
|
||||
// Beschreibung der ItemTypes
|
||||
XQNodePtr _typesSheet{};
|
||||
|
||||
};
|
||||
|
||||
#endif // XQITEMFACTORY_H
|
Reference in New Issue
Block a user