cmmanager/cppluginutils/src/cpipv6filter.cpp
changeset 27 489cf6208544
equal deleted inserted replaced
23:7ec726f93df1 27:489cf6208544
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * IPv6 input filter implementation.
       
    16 *
       
    17 */
       
    18 
       
    19 // System includes
       
    20 #include <HbInputFilter>
       
    21 
       
    22 // User includes
       
    23 #include "cpipv6filter.h"
       
    24 
       
    25 /*!
       
    26     \class CpIpv6Filter
       
    27     \brief IPv6 input filter implementation.
       
    28 */
       
    29 
       
    30 // External function prototypes
       
    31 
       
    32 // Local constants
       
    33 
       
    34 // ======== LOCAL FUNCTIONS ========
       
    35 
       
    36 // ======== MEMBER FUNCTIONS ========
       
    37 
       
    38 /*!
       
    39     Returns static instance of the class.
       
    40 */
       
    41 CpIpv6Filter* CpIpv6Filter::instance()
       
    42 {
       
    43     static CpIpv6Filter myInstance;
       
    44     return &myInstance;
       
    45 }
       
    46 
       
    47 /*!
       
    48     Constructor.
       
    49 */
       
    50 CpIpv6Filter::CpIpv6Filter()
       
    51 {
       
    52 }
       
    53 
       
    54 /*!
       
    55     Destructor.
       
    56 */
       
    57 CpIpv6Filter::~CpIpv6Filter()
       
    58 {
       
    59 }
       
    60 
       
    61 /*!
       
    62     Returns true if given character is valid for an IPv6 address.
       
    63 */
       
    64 bool CpIpv6Filter::filter(QChar aChar)
       
    65 {
       
    66     if ((aChar >= 'a' && aChar <= 'f')
       
    67         || (aChar >= 'A' && aChar <= 'F')
       
    68         || (aChar >= '0' && aChar <= '9')) {
       
    69         return true;
       
    70     }
       
    71     if (aChar == ':' || aChar == '.') {
       
    72         return true;
       
    73     }
       
    74 
       
    75     return false;
       
    76 }