DirectPrint/DirectPrintApp/src/directprintbearerdata.cpp
branchRCL_3
changeset 12 613a5ff70823
child 15 2275db202402
equal deleted inserted replaced
8:3f1fec088555 12:613a5ff70823
       
     1 /*
       
     2 * Copyright (c) 2010 Kanrikogaku Kenkyusho, Ltd.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "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 * Kanrikogaku Kenkyusho, Ltd. - Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <s32strm.h>
       
    20 
       
    21 #include "directprintbearerdata.h"
       
    22 
       
    23 EXPORT_C void TDirectPrintBearerData::InternalizeL(RReadStream& aStream)
       
    24 	{
       
    25 	iPrinterId = aStream.ReadInt32L();
       
    26 	iBearerId = aStream.ReadInt32L();
       
    27 	TInt length = aStream.ReadInt32L();
       
    28 	if(length > 0)
       
    29 		{
       
    30 		aStream.ReadL(iBearerName, length);
       
    31 		}
       
    32 	length = aStream.ReadInt32L();
       
    33 	if(length > 0)
       
    34 		{
       
    35 		aStream.ReadL(iAccessPoint, length);
       
    36 		}
       
    37 	length = aStream.ReadInt32L();
       
    38 	if(length > 0)
       
    39 		{
       
    40 		aStream.ReadL(iHostName, length);
       
    41 		}
       
    42 	iHostIp.SetAddress(aStream.ReadInt32L());
       
    43 	iPort = aStream.ReadInt32L();
       
    44 	length = aStream.ReadInt32L();
       
    45 	if(length > 0)
       
    46 		{
       
    47 		aStream.ReadL(iUserName, length);
       
    48 		}
       
    49 	length = aStream.ReadInt32L();
       
    50 	if(length > 0)
       
    51 		{
       
    52 		aStream.ReadL(iQueName, length);
       
    53 		}
       
    54 	}
       
    55 
       
    56 EXPORT_C void TDirectPrintBearerData::ExternalizeL(RWriteStream& aStream) const
       
    57 	{
       
    58 	aStream.WriteInt32L(iPrinterId);
       
    59 	aStream.WriteInt32L(iBearerId);
       
    60 	aStream.WriteInt32L(iBearerName.Length());
       
    61 	if (iBearerName.Length() > 0)
       
    62 		{
       
    63 		aStream.WriteL(iBearerName);
       
    64 		}
       
    65 	aStream.WriteInt32L(iAccessPoint.Length());
       
    66 	if (iAccessPoint.Length() > 0)
       
    67 		{
       
    68 		aStream.WriteL(iAccessPoint);
       
    69 		}
       
    70 	aStream.WriteInt32L(iHostName.Length());
       
    71 	if (iHostName.Length() > 0)
       
    72 		{
       
    73 		aStream.WriteL(iHostName);
       
    74 		}
       
    75 	aStream.WriteInt32L(iHostIp.Address());
       
    76 	aStream.WriteInt32L(iPort);
       
    77 	aStream.WriteInt32L(iUserName.Length());
       
    78 	if (iUserName.Length() > 0)
       
    79 		{
       
    80 		aStream.WriteL(iUserName);
       
    81 		}
       
    82 	aStream.WriteInt32L(iQueName.Length());
       
    83 	if (iQueName.Length() > 0)
       
    84 		{
       
    85 		aStream.WriteL(iQueName);
       
    86 		}
       
    87 	}
       
    88 
       
    89 EXPORT_C TDirectPrintBearerData& TDirectPrintBearerData::operator=(const TDirectPrintBearerData& aData)
       
    90 	{
       
    91 	iPrinterId = aData.iPrinterId;
       
    92 	iBearerId = aData.iBearerId;
       
    93 	iBearerName.Copy(aData.iBearerName);
       
    94 	iAccessPoint.Copy(aData.iAccessPoint);
       
    95 	iHostName.Copy(aData.iHostName);
       
    96 	//iHostIp.SetAddress(aData.iHostIp.Address());
       
    97 	iHostIp = aData.iHostIp;
       
    98 	iPort = aData.iPort;
       
    99 	iUserName.Copy(aData.iUserName);
       
   100 	iQueName.Copy(aData.iQueName);
       
   101 	return *this;
       
   102 	}
       
   103