landmarksui/engine/src/CLmkFieldData.cpp
branchRCL_3
changeset 18 870918037e16
parent 0 522cd55cc3d7
equal deleted inserted replaced
17:1fc85118c3ae 18:870918037e16
       
     1 /*
       
     2 * Copyright (c) 2002 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:    LandmarksUi Content File -
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 // INCLUDE FILES
       
    26 #include "CLmkFieldData.h"
       
    27 #include <lmkerrors.h>
       
    28 
       
    29 
       
    30 #if defined(_DEBUG)
       
    31 // CONSTANTS
       
    32 /// Unnamed namespace for local definitions
       
    33 namespace {
       
    34 
       
    35 _LIT( KPanicMsg, "CLmkFieldData");
       
    36 
       
    37 void Panic( TPanicCode aReason )
       
    38     {
       
    39     User::Panic( KPanicMsg, aReason );
       
    40     }
       
    41 }  // namespace
       
    42 #endif
       
    43 // ============================ MEMBER FUNCTIONS ==============================
       
    44 // ----------------------------------------------------------------------------
       
    45 // CLmkFieldData::CLmkFieldData
       
    46 // C++ default constructor can NOT contain any code, that
       
    47 // might leave.
       
    48 // ----------------------------------------------------------------------------
       
    49 //
       
    50 CLmkFieldData::CLmkFieldData() : iTitleField( EFalse )
       
    51     {
       
    52     }
       
    53 
       
    54 // ----------------------------------------------------------------------------
       
    55 // CLmkFieldData::ConstructL
       
    56 // Symbian 2nd phase constructor can leave.
       
    57 // ----------------------------------------------------------------------------
       
    58 //
       
    59 void CLmkFieldData::ConstructL( HBufC* aLabel )
       
    60     {
       
    61     SetLabel( aLabel );
       
    62     iTextData = HBufC::NewL(0);
       
    63     iUniqueFieldIdentity = reinterpret_cast<TInt>(this);
       
    64     }
       
    65 
       
    66 // ----------------------------------------------------------------------------
       
    67 // CLmkFieldData::NewL
       
    68 // Two-phased constructor.
       
    69 // ----------------------------------------------------------------------------
       
    70 //
       
    71 CLmkFieldData* CLmkFieldData::NewL( HBufC* aLabel )
       
    72     {
       
    73     CLmkFieldData* self = new ( ELeave ) CLmkFieldData;
       
    74     CleanupStack::PushL( self );
       
    75     self->ConstructL( aLabel );
       
    76     CleanupStack::Pop();
       
    77     return self;
       
    78     }
       
    79 
       
    80 // ----------------------------------------------------------------------------
       
    81 // CLmkFieldData::~CLmkFieldData
       
    82 // ----------------------------------------------------------------------------
       
    83 //
       
    84 CLmkFieldData::~CLmkFieldData()
       
    85     {
       
    86     delete iTextData;
       
    87     delete iIconPath;
       
    88     iCategories.Close();
       
    89     }
       
    90 
       
    91 // ----------------------------------------------------------------------------
       
    92 // CLmkFieldData::SetLabel
       
    93 // ----------------------------------------------------------------------------
       
    94 //
       
    95 void CLmkFieldData::SetLabel( HBufC* aLabel )
       
    96     {
       
    97     __ASSERT_DEBUG( aLabel, Panic( KLmkPanicNullMember ) );
       
    98     iLabel = aLabel;
       
    99     }
       
   100 
       
   101 // ----------------------------------------------------------------------------
       
   102 // CLmkFieldData::Label
       
   103 // ----------------------------------------------------------------------------
       
   104 //
       
   105 const HBufC& CLmkFieldData::Label() const
       
   106     {
       
   107     return *iLabel;
       
   108     }
       
   109 
       
   110 // ----------------------------------------------------------------------------
       
   111 // CLmkFieldData::SetEditorType
       
   112 // ----------------------------------------------------------------------------
       
   113 //
       
   114 void CLmkFieldData::SetEditorType( const TUint16 aType )
       
   115     {
       
   116     iEditorType = aType;
       
   117     }
       
   118 
       
   119 // ----------------------------------------------------------------------------
       
   120 // CLmkFieldData::EditorType
       
   121 // ----------------------------------------------------------------------------
       
   122 //
       
   123 TUint16 CLmkFieldData::EditorType() const
       
   124     {
       
   125     return iEditorType;
       
   126     }
       
   127 
       
   128 // ----------------------------------------------------------------------------
       
   129 // CLmkFieldData::SetText
       
   130 // ----------------------------------------------------------------------------
       
   131 //
       
   132 void CLmkFieldData::SetTextL( const TPtrC aText )
       
   133     {
       
   134     delete iTextData;
       
   135     iTextData = NULL;
       
   136     iTextData = aText.AllocL();
       
   137     }
       
   138 
       
   139 // ----------------------------------------------------------------------------
       
   140 // CLmkFieldData::SetText
       
   141 // ----------------------------------------------------------------------------
       
   142 //
       
   143 void CLmkFieldData::SetText( HBufC* aText )
       
   144     {
       
   145     if ( aText )
       
   146         {
       
   147         delete iTextData;
       
   148         iTextData = aText;
       
   149         }
       
   150     }
       
   151 
       
   152 // ----------------------------------------------------------------------------
       
   153 // CLmkFieldData::TextData
       
   154 // ----------------------------------------------------------------------------
       
   155 //
       
   156 const HBufC& CLmkFieldData::TextData() const
       
   157     {
       
   158     return *iTextData;
       
   159     }
       
   160 
       
   161 // ----------------------------------------------------------------------------
       
   162 // CLmkFieldData::SetInt
       
   163 // ----------------------------------------------------------------------------
       
   164 //
       
   165 void CLmkFieldData::SetInt( const TInt aTInt )
       
   166     {
       
   167     iIntData = aTInt;
       
   168     }
       
   169 
       
   170 // ----------------------------------------------------------------------------
       
   171 // CLmkFieldData::IntegerData
       
   172 // ----------------------------------------------------------------------------
       
   173 //
       
   174 TInt CLmkFieldData::IntegerData() const
       
   175     {
       
   176     return iIntData;
       
   177     }
       
   178 
       
   179 // ----------------------------------------------------------------------------
       
   180 // CLmkFieldData::SetTReal
       
   181 // ----------------------------------------------------------------------------
       
   182 //
       
   183 void CLmkFieldData::SetTReal( const TReal32 aTReal )
       
   184     {
       
   185     iTRealData32 = aTReal;
       
   186     }
       
   187 
       
   188 // ----------------------------------------------------------------------------
       
   189 // CLmkFieldData::FloatData
       
   190 // ----------------------------------------------------------------------------
       
   191 //
       
   192 TReal32 CLmkFieldData::FloatData() const
       
   193     {
       
   194     return iTRealData32;
       
   195     }
       
   196 
       
   197 // ----------------------------------------------------------------------------
       
   198 // CLmkFieldData::SetTReal
       
   199 // ----------------------------------------------------------------------------
       
   200 //
       
   201 void CLmkFieldData::SetTReal( const TReal64 aTReal )
       
   202     {
       
   203     iTRealData64 = aTReal;
       
   204     }
       
   205 
       
   206 // ----------------------------------------------------------------------------
       
   207 // CLmkFieldData::DoubleData
       
   208 // ----------------------------------------------------------------------------
       
   209 //
       
   210 TReal64 CLmkFieldData::DoubleData() const
       
   211     {
       
   212     return iTRealData64;
       
   213     }
       
   214 
       
   215 // ----------------------------------------------------------------------------
       
   216 // CLmkFieldData::Categories
       
   217 // ----------------------------------------------------------------------------
       
   218 //
       
   219 RArray<TPosLmItemId>& CLmkFieldData::Categories()
       
   220     {
       
   221     return iCategories;
       
   222     }
       
   223 
       
   224 // ----------------------------------------------------------------------------
       
   225 // CLmkFieldData::UniqueFieldIdentity
       
   226 // ----------------------------------------------------------------------------
       
   227 //
       
   228 TInt CLmkFieldData::UniqueFieldIdentity() const
       
   229     {
       
   230     return iUniqueFieldIdentity;
       
   231     }
       
   232 
       
   233 // ----------------------------------------------------------------------------
       
   234 // CLmkFieldData::SetFieldType
       
   235 // ----------------------------------------------------------------------------
       
   236 //
       
   237 void CLmkFieldData::SetFieldType( const TUint16 aFieldType )
       
   238     {
       
   239     iFieldType = aFieldType;
       
   240     }
       
   241 
       
   242 // ----------------------------------------------------------------------------
       
   243 // CLmkFieldData::FieldType
       
   244 // ----------------------------------------------------------------------------
       
   245 //
       
   246 TUint16 CLmkFieldData::FieldType() const
       
   247     {
       
   248     return iFieldType;
       
   249     }
       
   250 
       
   251 // ----------------------------------------------------------------------------
       
   252 // CLmkFieldData::SetPositionFieldId
       
   253 // ----------------------------------------------------------------------------
       
   254 //
       
   255 void CLmkFieldData::SetPositionFieldId( const TUint16 aPositionFieldId )
       
   256     {
       
   257     iPositionFieldId = aPositionFieldId;
       
   258     }
       
   259 
       
   260 // ----------------------------------------------------------------------------
       
   261 // CLmkFieldData::PositionFieldId
       
   262 // ----------------------------------------------------------------------------
       
   263 //
       
   264 TUint16 CLmkFieldData::PositionFieldId() const
       
   265     {
       
   266     return iPositionFieldId;
       
   267     }
       
   268 
       
   269 // ----------------------------------------------------------------------------
       
   270 // CLmkFieldData::SetFieldLength
       
   271 // ----------------------------------------------------------------------------
       
   272 //
       
   273 void CLmkFieldData::SetFieldLength( const TInt aLength )
       
   274     {
       
   275     iFieldLength = aLength;
       
   276     }
       
   277 
       
   278 // ----------------------------------------------------------------------------
       
   279 // CLmkFieldData::FieldLength
       
   280 // ----------------------------------------------------------------------------
       
   281 //
       
   282 TInt CLmkFieldData::FieldLength() const
       
   283     {
       
   284     return iFieldLength;
       
   285     }
       
   286 
       
   287 // ----------------------------------------------------------------------------
       
   288 // CLmkFieldData::SetTitleField
       
   289 // ----------------------------------------------------------------------------
       
   290 //
       
   291 void CLmkFieldData::SetTitleField( const TBool aTitleField )
       
   292     {
       
   293     iTitleField = aTitleField;
       
   294     }
       
   295 
       
   296 // ----------------------------------------------------------------------------
       
   297 // CLmkFieldData::IsTitleField
       
   298 // ----------------------------------------------------------------------------
       
   299 //
       
   300 TBool CLmkFieldData::IsTitleField() const
       
   301     {
       
   302     return iTitleField;
       
   303     }
       
   304 
       
   305 // ----------------------------------------------------------------------------
       
   306 // CLmkFieldData::SetIconId
       
   307 // ----------------------------------------------------------------------------
       
   308 //
       
   309 void CLmkFieldData::SetIconId( const TInt aIconId )
       
   310     {
       
   311     iIconId = aIconId;
       
   312     }
       
   313 
       
   314 // ----------------------------------------------------------------------------
       
   315 // CLmkFieldData::IconId
       
   316 // ----------------------------------------------------------------------------
       
   317 //
       
   318 TInt CLmkFieldData::IconId() const
       
   319     {
       
   320     return iIconId;
       
   321     }
       
   322 
       
   323 // ----------------------------------------------------------------------------
       
   324 // CLmkFieldData::SetIconPathL
       
   325 // ----------------------------------------------------------------------------
       
   326 //
       
   327 void CLmkFieldData::SetIconPathL( const TDesC& aIconPath )
       
   328     {
       
   329     if ( aIconPath.Length() > 0 )
       
   330         {
       
   331         delete iIconPath;
       
   332         iIconPath = NULL;
       
   333         iIconPath = aIconPath.AllocL();
       
   334         }
       
   335     }
       
   336 
       
   337 // ----------------------------------------------------------------------------
       
   338 // CLmkFieldData::IconPath
       
   339 // ----------------------------------------------------------------------------
       
   340 //
       
   341 HBufC* CLmkFieldData::IconPath()
       
   342     {
       
   343     return iIconPath;
       
   344     }
       
   345 //  End of File