sbsv2/raptor/test/smoke_suite/test_resources/tools2/pdrtran/src/RECORD.CPP
branchwip
changeset 317 adc615fe34e8
equal deleted inserted replaced
153:df63379a03bd 317:adc615fe34e8
       
     1 /*
       
     2 * Copyright (c) 1997-2009 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: 
       
    15 * Header RECORD.CPP
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include "RECORD.H"
       
    21 
       
    22 EXPORT_C Record::Record()
       
    23  :	iLabel(), iStreamId(0)
       
    24 	{
       
    25 	}
       
    26 
       
    27 void RecordList::ExternalizeIds(ostream& out)
       
    28 	{
       
    29 	int32 i;
       
    30 	int32 size = Size();
       
    31 	out.write((char*) &size, sizeof(size));
       
    32 	for (i = 0; i < size; i++)
       
    33 		{
       
    34 		::ExternalizeStreamOff(out, (*this)[i]->iStreamId);
       
    35 		}
       
    36 	}
       
    37 
       
    38 void RecordList::Externalize(ostream& out)
       
    39 	{
       
    40 	int32 size = Size();
       
    41 	out.write ((char*) &size, sizeof(size));
       
    42 	for (int i = 0; i < size; i++)
       
    43 		(*this)[i]->Externalize(out);
       
    44 	}
       
    45 
       
    46 void RecordList::ExternalizeComponents(ostream& out)
       
    47 	{
       
    48 	int32 size = Size();
       
    49 	for (int i = 0; i < size; i++)
       
    50 		(*this)[i]->ExternalizeComponents(out);
       
    51 	}
       
    52 
       
    53 EXPORT_C void RecordList::Add(Record* aRecord)
       
    54 	{
       
    55 	if (!LabelToRecord(aRecord->iLabel))
       
    56 		List<Record*>::Add(aRecord);
       
    57 	}
       
    58 
       
    59 EXPORT_C Record *RecordList::LabelToRecord(const String& aLabel)
       
    60 	{
       
    61 	int32 size = Size();
       
    62 	Record *record=NULL;
       
    63 	if (aLabel.Length())
       
    64 		for (int i = 0; i < size; i++)
       
    65 			if ((*this)[i]->iLabel == aLabel)
       
    66 				record = (*this)[i];
       
    67 	return record;
       
    68 	}
       
    69 
       
    70 EXPORT_C void RecordList::Destroy()
       
    71 	{
       
    72 	List<Record*>::Destroy();
       
    73 	}
       
    74 
       
    75 EXPORT_C RecordList::~RecordList()
       
    76 	{
       
    77 	}
       
    78 
       
    79 EXPORT_C Typeface::Typeface()
       
    80  :	iName(), iFlags(0)
       
    81 	{
       
    82 	}
       
    83 
       
    84 void Typeface::Externalize(ostream& out)
       
    85 	{
       
    86 	iName.Externalize(out);
       
    87 	out.put((char) iFlags);
       
    88 	}
       
    89 
       
    90 void Point::Externalize(ostream& out)
       
    91 	{
       
    92 	out.write((char*) &iX, sizeof(iX));
       
    93 	out.write((char*) &iY, sizeof(iY));
       
    94 	}