Warning, file /utilities/okteta/kasten/gui/liboktetawidgets/addressvalidator.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 This file is part of the Okteta Kasten module, made within the KDE community. 0003 0004 SPDX-FileCopyrightText: 2009 Friedrich W. H. Kossebau <kossebau@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #ifndef KASTEN_ADDRESSVALIDATOR_HPP 0010 #define KASTEN_ADDRESSVALIDATOR_HPP 0011 0012 // Okteta core 0013 #include <Okteta/OktetaCore> 0014 #include <Okteta/Address> 0015 // Qt 0016 #include <QValidator> 0017 0018 namespace Okteta { 0019 0020 class ValueCodec; 0021 0022 class AddressValidator : public QValidator 0023 { 0024 Q_OBJECT 0025 0026 public: 0027 // matching Okteta::ValueCoding 0028 enum Coding 0029 { 0030 InvalidCoding = -1, 0031 HexadecimalCoding = 0, 0032 DecimalCoding = 1, 0033 ExpressionCoding = 2 0034 }; 0035 // XXX shouldn't this better be in address.h? Sometime later maybe 0036 enum AddressType 0037 { 0038 InvalidAddressType = -1, 0039 AbsoluteAddress = 0, 0040 RelativeForwards, 0041 RelativeBackwards 0042 }; 0043 0044 public: 0045 explicit AddressValidator(QObject* parent, Coding codecId = HexadecimalCoding); 0046 ~AddressValidator() override; 0047 0048 public: // QValidator API 0049 QValidator::State validate(QString& input, int& pos) const override; 0050 0051 public: 0052 AddressType addressType() const; 0053 /** Sets one of the value codecs or any char codec */ 0054 void setCodec(Coding codecId); 0055 0056 public: 0057 Address toAddress(const QString& string, AddressType* type = nullptr) const; 0058 QString toString(Address address, AddressType addressType) const; 0059 0060 private: 0061 Coding mCodecId; 0062 ValueCodec* mValueCodec; 0063 0064 static const QRegExp expressionRegex; 0065 }; 0066 0067 } 0068 0069 #endif