##// END OF EJS Templates
Separate the initialization of the properties of the graph of the update of the units of the graph....
Separate the initialization of the properties of the graph of the update of the units of the graph. The initialization of the properties is carried out when adding a variable in the graph, the update of the units is carried out when loading the data of this variable

File last commit:

r1080:d45cab418d5a
r1337:3acf26407503
Show More
DataSourceItemBuilder.h
45 lines | 1.4 KiB | text/x-c | CLexer
/ core / tests / DataSource / DataSourceItemBuilder.h
#ifndef SCIQLOP_DATASOURCEITEMBUILDER_H
#define SCIQLOP_DATASOURCEITEMBUILDER_H
#include <DataSource/DataSourceItem.h>
#include <memory>
#include <stack>
/**
* @brief The DataSourceItemBuilder class aims to facilitate the creation of a DataSourceItem for unit tests
* @sa DataSourceItem
*/
class DataSourceItemBuilder {
public:
/// Inits root item
DataSourceItemBuilder & root(const QString &name);
DataSourceItemBuilder & root(QVariantHash data);
/// Adds node into the current item
DataSourceItemBuilder & node(const QString &name);
DataSourceItemBuilder & node(QVariantHash data);
/// Adds product into the current item
DataSourceItemBuilder & product(const QString &name);
DataSourceItemBuilder & product(QVariantHash data);
/// Adds component into the current item
DataSourceItemBuilder & component(const QString &name);
DataSourceItemBuilder & component(QVariantHash data);
/// Closes the build of the current item
DataSourceItemBuilder& end();
/// Creates the DataSourceItem
std::shared_ptr<DataSourceItem> build();
private:
DataSourceItemBuilder& append(DataSourceItemType type, const QString &name);
DataSourceItemBuilder& append(DataSourceItemType type, QVariantHash data);
std::shared_ptr<DataSourceItem> m_Root{nullptr};
std::stack<DataSourceItem*> m_Items;
};
#endif // SCIQLOP_DATASOURCEITEMBUILDER_H