ImagingTools Core SDK
CBinaryDataProviderComp.h
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ImtCore-Commercial
2#pragma once
3
4
5// Qt includes
6#include <QtCore/QString>
7#include <QtCore/QDir>
8
9// ACF includes
10#include <ilog/TLoggerCompWrap.h>
11#include <ifile/IFileNameParam.h>
12#include <ifile/IRelativeFilePath.h>
13
14// ImtCore includes
15#include <imtrest/IBinaryDataProvider.h>
16
17
18namespace imtrest
19{
20
21
25class CBinaryDataProviderComp: public IBinaryDataProvider, public ilog::CLoggerComponentBase
26{
27public:
28 typedef ilog::CLoggerComponentBase BaseClass;
29
30 I_BEGIN_COMPONENT(CBinaryDataProviderComp);
31 I_REGISTER_INTERFACE(IBinaryDataProvider);
32 I_ASSIGN(m_homeDirPathAttrPtr, "HomePath", "Home path", false, "HomePath");
33 I_ASSIGN(m_pathsProblemsAutoSolveAttrPtr, "AutoSolvePathsProblems", "If 'true' servelt'll automatically solve paths problems", true, true);
34 I_ASSIGN(m_fileTemplatePathCompPtr, "FileTemplateHomePath", "FileTemplate based Home path\n Note: type is ignored only value matters \n Warning: overwrites HomePath!", false, "FileTemplatePath");
35 I_END_COMPONENT
36
37 // reimplemented (IBinaryDataProvider)
38 virtual bool GetData(
39 QByteArray& data,
40 const QByteArray& dataId,
41 qint64 readFromPosition = 0,
42 qint64 readMaxLength = -1) const override;
43
44protected:
45 I_REF (ifile::IRelativeFilePath, m_homeDirPathAttrPtr);
46 I_ATTR (bool, m_pathsProblemsAutoSolveAttrPtr);
47 I_REF(ifile::IFileNameParam, m_fileTemplatePathCompPtr);
48};
49
50
51} // namespace imtrest
52
53
The IBinaryDataProvider class provides file from disc, resources or memory.