src/NPRStation.cpp
author tahirm@symbian.org
Fri, 24 Jul 2009 08:46:02 +0100
changeset 0 0049171ecffb
permissions -rw-r--r--
initial release
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
     1
/*
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
     2
 ============================================================================
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
     3
 Name	: NPRStation.h
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
     4
 Author	: Symsource
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
     5
 
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
     6
 Copyright (c) 2009 Symbian Foundation Ltd
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
     7
 This component and the accompanying materials are made available
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
     8
 under the terms of the License "Eclipse Public License v1.0"
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
     9
 which accompanies this distribution, and is available
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    10
 at the URL "http://www.eclipse.org/legal/epl-v10.html".
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    11
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    12
 Initial Contributors:
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    13
 - Symsource
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    14
 
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    15
 Contributors:
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    16
 - Symsource
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    17
 
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    18
 Description : Class to wrap all the Station fields 
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    19
 ============================================================================
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    20
 */
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    21
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    22
#include "NPRStation.h"
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    23
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    24
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    25
CNPRStation* CNPRStation::NewLC()
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    26
	{
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    27
	CNPRStation* self = new (ELeave) CNPRStation();
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    28
	CleanupStack::PushL(self);
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    29
	self->ConstructL();
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    30
	return self;
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    31
	}
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    32
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    33
CNPRStation* CNPRStation::NewL()
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    34
	{
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    35
	CNPRStation* self = CNPRStation::NewLC();
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    36
	CleanupStack::Pop(); // self;
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    37
	return self;
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    38
	}
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    39
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    40
CNPRStation::~CNPRStation()
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    41
	{
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    42
	iName.Close();
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    43
	iFrequency.Close();
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    44
	iMarketCity.Close();
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    45
	}
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    46
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    47
void CNPRStation::ConstructL()
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    48
	{
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    49
	}
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    50
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    51
void CNPRStation::SetNameL(const TDesC8& aName)
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    52
	{
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    53
	HBufC* temp = HBufC::NewLC(aName.Length());
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    54
	// copy from 8 to 16 bit descriptor. 
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    55
	temp->Des().Copy(aName);
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    56
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    57
	if(iName.MaxLength() < temp->Length())
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    58
		{
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    59
		iName.ReAlloc(temp->Length());
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    60
		}
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    61
	iName.Copy(temp->Des());
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    62
	CleanupStack::PopAndDestroy();
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    63
	}
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    64
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    65
void CNPRStation::SetFrequencyL(const TDesC8& aFrequency)
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    66
	{
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    67
	HBufC* temp = HBufC::NewLC(aFrequency.Length());
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    68
	// copy from 8 to 16 bit descriptor. 
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    69
	temp->Des().Copy(aFrequency);
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    70
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    71
	if(iFrequency.MaxLength() < temp->Length())
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    72
		{
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    73
		iFrequency.ReAlloc(temp->Length());
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    74
		}
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    75
	iFrequency.Copy(temp->Des());
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    76
	CleanupStack::PopAndDestroy();
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    77
	}
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    78
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    79
void CNPRStation::SetMarketCityL(const TDesC8& aMarketCity)
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    80
	{
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    81
	HBufC* temp = HBufC::NewLC(aMarketCity.Length());
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    82
	// copy from 8 to 16 bit descriptor. 
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    83
	temp->Des().Copy(aMarketCity);
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    84
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    85
	if(iMarketCity.MaxLength() < temp->Length())
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    86
		{
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    87
		iMarketCity.ReAlloc(temp->Length());
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    88
		}
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    89
	iMarketCity.Copy(temp->Des());
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    90
	CleanupStack::PopAndDestroy();
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    91
	}
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    92
0049171ecffb initial release
tahirm@symbian.org
parents:
diff changeset
    93