qcpix/src/cpixdocumentfield.cpp
author hgs
Fri, 15 Oct 2010 12:09:28 +0530
changeset 24 65456528cac2
parent 13 fcb2a58c181b
permissions -rw-r--r--
201041
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description: 
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
24
hgs
parents: 13
diff changeset
    17
#include <QRegExp>
13
hgs
parents:
diff changeset
    18
#include <cpixdocumentfield.h>
hgs
parents:
diff changeset
    19
#include "cpixdocumentfieldprivate.h"
hgs
parents:
diff changeset
    20
24
hgs
parents: 13
diff changeset
    21
#define SEPERATOR_EXP "\\s+"
13
hgs
parents:
diff changeset
    22
/**
hgs
parents:
diff changeset
    23
 * Note: Code in this file should never throw OR leak symbian exceptions.
hgs
parents:
diff changeset
    24
 * Convert all leaves to C++ exceptions.
hgs
parents:
diff changeset
    25
 */
hgs
parents:
diff changeset
    26
hgs
parents:
diff changeset
    27
CpixDocumentField::CpixDocumentField( const QString aName, const QString aValue, const int aConfig )
hgs
parents:
diff changeset
    28
    :iPvtImpl( new CpixDocumentFieldPrivate(aName,aValue,aConfig) )
hgs
parents:
diff changeset
    29
    {
hgs
parents:
diff changeset
    30
    }
hgs
parents:
diff changeset
    31
hgs
parents:
diff changeset
    32
CpixDocumentField* CpixDocumentField::newInstance( const QString aName, const QString aValue, const int aConfig )
hgs
parents:
diff changeset
    33
    {
hgs
parents:
diff changeset
    34
    CpixDocumentField* field = NULL;
hgs
parents:
diff changeset
    35
    try{
hgs
parents:
diff changeset
    36
        field = new CpixDocumentField( aName, aValue, aConfig );
hgs
parents:
diff changeset
    37
    }
hgs
parents:
diff changeset
    38
    catch(...){
hgs
parents:
diff changeset
    39
        delete field;
hgs
parents:
diff changeset
    40
        return NULL;
hgs
parents:
diff changeset
    41
    }
hgs
parents:
diff changeset
    42
    return field;
hgs
parents:
diff changeset
    43
    }
hgs
parents:
diff changeset
    44
hgs
parents:
diff changeset
    45
CpixDocumentField::~CpixDocumentField()
hgs
parents:
diff changeset
    46
    {
hgs
parents:
diff changeset
    47
    delete iPvtImpl;
hgs
parents:
diff changeset
    48
    }
hgs
parents:
diff changeset
    49
hgs
parents:
diff changeset
    50
QString CpixDocumentField::name() const
hgs
parents:
diff changeset
    51
    {
hgs
parents:
diff changeset
    52
    return iPvtImpl->iName;
hgs
parents:
diff changeset
    53
    }
hgs
parents:
diff changeset
    54
hgs
parents:
diff changeset
    55
QString CpixDocumentField::value() const
hgs
parents:
diff changeset
    56
    {
hgs
parents:
diff changeset
    57
    return iPvtImpl->iValue;
hgs
parents:
diff changeset
    58
    }
hgs
parents:
diff changeset
    59
hgs
parents:
diff changeset
    60
int CpixDocumentField::config() const
hgs
parents:
diff changeset
    61
    {
hgs
parents:
diff changeset
    62
    return iPvtImpl->iConfig;
hgs
parents:
diff changeset
    63
    }
hgs
parents:
diff changeset
    64
    
hgs
parents:
diff changeset
    65
void CpixDocumentField::setName(const QString aName)
hgs
parents:
diff changeset
    66
    {
hgs
parents:
diff changeset
    67
    iPvtImpl->iName = aName;
hgs
parents:
diff changeset
    68
    }
hgs
parents:
diff changeset
    69
hgs
parents:
diff changeset
    70
void CpixDocumentField::setValue(const QString aValue)
hgs
parents:
diff changeset
    71
    {
hgs
parents:
diff changeset
    72
    iPvtImpl->iValue = aValue;
hgs
parents:
diff changeset
    73
    }
hgs
parents:
diff changeset
    74
hgs
parents:
diff changeset
    75
void CpixDocumentField::setConfig(const int aConfig)
hgs
parents:
diff changeset
    76
    {
hgs
parents:
diff changeset
    77
    iPvtImpl->iConfig = aConfig;
hgs
parents:
diff changeset
    78
    }
hgs
parents:
diff changeset
    79
24
hgs
parents: 13
diff changeset
    80
QStringList CpixDocumentField::values() const
hgs
parents: 13
diff changeset
    81
    {
hgs
parents: 13
diff changeset
    82
      QString str = iPvtImpl->iValue;
hgs
parents: 13
diff changeset
    83
      return  str.split(QRegExp(SEPERATOR_EXP));
hgs
parents: 13
diff changeset
    84
    }
hgs
parents: 13
diff changeset
    85
13
hgs
parents:
diff changeset
    86
//End of File