DirectPrint/DirectPrintApp/inc/directprintpropertydata.h
changeset 19 2275db202402
parent 11 613a5ff70823
equal deleted inserted replaced
2:acc370d7f2f6 19:2275db202402
       
     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 * {Description of the file}
       
    16 *
       
    17 */
       
    18 
       
    19 // Protection against nested includes
       
    20 #ifndef __DIRECTPRINTPROPERTYDATA_H__
       
    21 #define __DIRECTPRINTPROPERTYDATA_H__
       
    22 
       
    23 // System includes
       
    24 #include <e32base.h>
       
    25 #include <e32cmn.h>
       
    26 
       
    27 // User includes
       
    28 #include "DirectPrintDef.h"
       
    29 
       
    30 // Class declaration
       
    31 /**
       
    32  *  Printer property data class
       
    33  *  more_complete_description
       
    34  */
       
    35 class TDirectPrintPropertyData
       
    36 	{
       
    37 public:
       
    38 	/**
       
    39 	 * Internalize operation.
       
    40 	 *
       
    41 	 * @param aStream ReadStream.
       
    42 	 */
       
    43 	inline void InternalizeL(RReadStream& aStream);
       
    44 
       
    45 	/**
       
    46 	 * Externalize operation.
       
    47 	 *
       
    48 	 * @param aStream WriteStream.
       
    49 	 */
       
    50 	inline void ExternalizeL(RWriteStream& aStream)const;
       
    51 
       
    52 	/**
       
    53 	 * Substitution operator.
       
    54 	 *
       
    55 	 * @param aData Printer property data.
       
    56 	 * @return Printer property data.
       
    57 	 */
       
    58 	inline TDirectPrintPropertyData& operator=(const TDirectPrintPropertyData& aData);
       
    59 
       
    60 public:
       
    61 	/** The ID of printer data. */
       
    62 	TInt iPrinterId;
       
    63 	/** The ID of application. */
       
    64 	TInt iApplicationId;
       
    65 	/** The ID of item type. */
       
    66 	TInt iItemType;
       
    67 	/** The ID of item. */
       
    68 	TInt iItemId;
       
    69 	/** Name of item. */
       
    70 	TBuf<KDirectPrintNameLength> iItemName;
       
    71 	/** Numerical value. */
       
    72 	TInt iItemValue;
       
    73 	/** Text value. */
       
    74 	TBuf<KDirectPrintNameLength> iItemTextValue;
       
    75 	};
       
    76 
       
    77 typedef RArray<TDirectPrintPropertyData> RDPPropertyDataArray;
       
    78 
       
    79 
       
    80 
       
    81 inline void TDirectPrintPropertyData::InternalizeL(RReadStream& aStream)
       
    82 	{
       
    83 	iItemType = aStream.ReadInt32L();
       
    84 	iItemId = aStream.ReadInt32L();
       
    85 	TInt length = aStream.ReadInt32L();
       
    86 	if(length > 0)
       
    87 		{
       
    88 		aStream.ReadL(iItemName, length);
       
    89 		}
       
    90 	iItemValue = aStream.ReadInt32L();
       
    91 	length = aStream.ReadInt32L();
       
    92 	if(length > 0)
       
    93 		{
       
    94 		aStream.ReadL(iItemTextValue, length);
       
    95 		}
       
    96 	}
       
    97 
       
    98 inline void TDirectPrintPropertyData::ExternalizeL(RWriteStream& aStream) const
       
    99 	{
       
   100 	aStream.WriteInt32L(iItemType);
       
   101 	aStream.WriteInt32L(iItemId);
       
   102 	aStream.WriteInt32L(iItemName.Length());
       
   103 	if (iItemName.Length() > 0)
       
   104 		{
       
   105 		aStream.WriteL(iItemName);
       
   106 		}
       
   107 	aStream.WriteInt32L(iItemValue);
       
   108 	aStream.WriteInt32L(iItemTextValue.Length());
       
   109 	if (iItemTextValue.Length() > 0)
       
   110 		{
       
   111 		aStream.WriteL(iItemTextValue);
       
   112 		}
       
   113 	}
       
   114 
       
   115 inline TDirectPrintPropertyData& TDirectPrintPropertyData::operator=(const TDirectPrintPropertyData& aData)
       
   116 	{
       
   117 	iPrinterId = aData.iPrinterId;
       
   118 	iApplicationId = aData.iApplicationId;
       
   119 	iItemType = aData.iItemType;
       
   120 	iItemId = aData.iItemId;
       
   121 	iItemName.Copy(aData.iItemName);
       
   122 	iItemValue = aData.iItemValue;
       
   123 	iItemTextValue.Copy(aData.iItemTextValue);
       
   124 	return *this;
       
   125 	}
       
   126 
       
   127 #endif // __DIRECTPRINTPROPERTYDATA_H__