File indexing completed on 2025-01-05 05:23:44

0001 /*
0002     This file is part of the Okteta Kasten Framework, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2012 Alex Richardson <alex.richardson@gmx.de>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef KASTEN_SCRIPTVALUECONVERTER_P_HPP
0010 #define KASTEN_SCRIPTVALUECONVERTER_P_HPP
0011 
0012 #include "../parsers/parserutils.hpp"
0013 
0014 #include <QScriptValue>
0015 #include <QScriptValueIterator>
0016 
0017 namespace ScriptValueConverter {
0018 
0019 DataInformation* toDataInformation(const QScriptValue& value, const ParserInfo& info);
0020 ArrayDataInformation* toArray(const QScriptValue& value, const ParserInfo& info);
0021 AbstractBitfieldDataInformation* toBitfield(const QScriptValue& value, const ParserInfo& info);
0022 PrimitiveDataInformation* toPrimitive(const QScriptValue& value, const ParserInfo& info);
0023 StructureDataInformation* toStruct(const QScriptValue& value, const ParserInfo& info);
0024 UnionDataInformation* toUnion(const QScriptValue& value, const ParserInfo& info);
0025 StringDataInformation* toString(const QScriptValue& value, const ParserInfo& info);
0026 PointerDataInformation* toPointer(const QScriptValue& value, const ParserInfo& info);
0027 EnumDataInformation* toEnum(const QScriptValue& value, bool isFlags, const ParserInfo& info);
0028 TaggedUnionDataInformation* toTaggedUnion(const QScriptValue& value, const ParserInfo& info);
0029 
0030 class ScriptValueChildrenParser : public ChildrenParser
0031 {
0032 public:
0033     ScriptValueChildrenParser(const ParserInfo& info, const QScriptValue& children);
0034     ~ScriptValueChildrenParser() override;
0035     DataInformation* next() override;
0036     bool hasNext() override;
0037     void setParent(DataInformation* newParent) override;
0038 
0039 private:
0040     QScriptValue mValue;
0041     QScriptValueIterator mIter;
0042     ParserInfo mInfo;
0043 };
0044 
0045 }
0046 
0047 #endif // KASTEN_SCRIPTVALUECONVERTER_P_HPP