cmmanager/cppluginutils/src/cpipv4filter.cpp
branchRCL_3
changeset 58 83ca720e2b9a
parent 57 05bc53fe583b
child 62 bb1f80fb7db2
equal deleted inserted replaced
57:05bc53fe583b 58:83ca720e2b9a
     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 * IPv4 input filter implementation.
       
    16 *
       
    17 */
       
    18 
       
    19 // System includes
       
    20 #include <HbInputFilter>
       
    21 
       
    22 // User includes
       
    23 #include "cpipv4filter.h"
       
    24 
       
    25 /*!
       
    26     \class CpIpv4Filter
       
    27     \brief IPv4 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 CpIpv4Filter* CpIpv4Filter::instance()
       
    42 {
       
    43     static CpIpv4Filter myInstance;
       
    44     return &myInstance;
       
    45 }
       
    46 
       
    47 /*!
       
    48     Constructor.
       
    49 */
       
    50 CpIpv4Filter::CpIpv4Filter()
       
    51 {
       
    52 }
       
    53 
       
    54 /*!
       
    55     Destructor.
       
    56 */
       
    57 CpIpv4Filter::~CpIpv4Filter()
       
    58 {
       
    59 }
       
    60 
       
    61 /*!
       
    62     Returns true if given character is valid for an IPv4 address.
       
    63 */
       
    64 bool CpIpv4Filter::filter(QChar aChar)
       
    65 {
       
    66     if (aChar >= '0' && aChar <= '9') {
       
    67         return true;
       
    68     }
       
    69     if (aChar == '.') {
       
    70         return true;
       
    71     }
       
    72 
       
    73     return false;
       
    74 }