accesssec_plat/eap_qt_configuration_api/inc/eapqtvalidator.h
branchRCL_3
changeset 18 bad0cc58d154
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accesssec_plat/eap_qt_configuration_api/inc/eapqtvalidator.h	Tue Aug 31 15:16:37 2010 +0300
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: 
+ *   EAP QT configuration validator interface
+ *
+ */
+
+/*
+ * %version: 6 %
+ */
+
+#ifndef EAPQTVALIDATOR_H
+#define EAPQTVALIDATOR_H
+
+// System includes
+#include <qglobal.h>
+
+// User includes
+
+// Forward declarations
+class QVariant;
+class HbLineEdit;
+
+// External data types
+
+// Constants
+
+// Class declaration
+
+/*
+ * Eap Qt Validator interface. This interface provides a method to configure
+ * the editor to use required constraints, hints, editor classes and so one
+ * depending on the EAP type and the configuration identifier.
+ * See updateEditor() method for further details.
+ * 
+ * validate() method checks that the content and format are valid for
+ * given configuration parameter.
+ * 
+ * An instance of a validator is created with
+ * EapQtConfigInterface::validatorEap() method.
+ */
+
+class EapQtValidator
+{
+
+public:
+
+    // Data types
+
+    /*
+     * Validation status. Can be extended.
+     */
+    enum Status {
+        /// Ok
+        StatusOk = 0,
+        /// Content is invalid
+        StatusInvalid,
+        /// The length is not valid
+        StatusInvalidLength,
+        /// Invalid characters detected
+        StatusInvalidCharacters,
+        /// Input is too short
+        StatusTooShort, 
+        /// Input is too long
+        StatusTooLong,  
+    };
+
+    EapQtValidator() {};
+    virtual ~EapQtValidator() {};
+
+    /*!
+     * Validates the given input \a value.
+     *
+     * @param value Value to be validated
+     * 
+     * @return Status code.
+     */
+    virtual Status validate(const QVariant &value) = 0;
+   
+    /*!
+     * Sets required configurations to the line edit.
+     * 
+     * Configurations depend on given EAP type and the configuration
+     * identifire which was used to instantiate the validator.
+     * 
+     * @param edit LineEdit to be updated.
+     */
+    virtual void updateEditor(HbLineEdit* const edit) = 0;
+    
+private:
+
+    Q_DISABLE_COPY(EapQtValidator)
+};
+
+#endif