bintools/rcomp/src/QUALIFAR.CPP
changeset 0 044383f39525
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 /*
       
     2 * Copyright (c) 2005-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 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 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "qualifar.h"
       
    20 
       
    21 QualifiedString::QualifiedString(const String& aEntry, const String * aFileName, int aLineNumber)
       
    22 	:iEntry(aEntry),
       
    23 	iFileName((*aFileName)),
       
    24 	iLineNumber(aLineNumber)
       
    25 	{
       
    26 	}
       
    27 
       
    28 QualifiedString::~QualifiedString()
       
    29 	{
       
    30 	}
       
    31 
       
    32 String QualifiedString::GetEntry()
       
    33 	{
       
    34 	return iEntry;
       
    35 	}
       
    36 
       
    37 String QualifiedString::GetFileName()
       
    38 	{
       
    39 	return iFileName;
       
    40 	}
       
    41 
       
    42 int QualifiedString::GetLineNumber()
       
    43 	{
       
    44 	return iLineNumber;
       
    45 	}
       
    46 
       
    47 
       
    48 QualifiedStringArray::QualifiedStringArray()
       
    49 	{
       
    50 	}
       
    51 
       
    52 void QualifiedStringArray::Add(QualifiedString * pNewItem)
       
    53 	{
       
    54 	Array::Add(pNewItem);
       
    55 	}
       
    56 
       
    57 QualifiedStringArrayIterator::QualifiedStringArrayIterator(const QualifiedStringArray & c)
       
    58 	:ArrayIterator(c)
       
    59 	{}
       
    60 
       
    61 QualifiedString* QualifiedStringArrayIterator::operator() ()
       
    62 	{
       
    63 	return (QualifiedString *) ArrayIterator::operator() ();
       
    64 	}
       
    65 
       
    66 ostream& operator<< ( ostream & aOs, QualifiedStringArray & aQualifiedStringArray)
       
    67 	{
       
    68 	if(aQualifiedStringArray.Size() == 0)
       
    69 		{
       
    70 		return ( aOs << "<none>");
       
    71 		}
       
    72 	QualifiedStringArrayIterator next(aQualifiedStringArray);
       
    73 	QualifiedString * pQualifiedString;
       
    74 	//Output first QualifiedString
       
    75 	if( ( pQualifiedString = next() ) != NULL)
       
    76 		{
       
    77 		aOs << (* pQualifiedString).GetEntry();
       
    78 		aOs << ":";
       
    79 		aOs << (* pQualifiedString).GetFileName();
       
    80 		aOs << ":";
       
    81 		aOs << (* pQualifiedString).GetLineNumber();
       
    82 		}
       
    83 	// Output remaining with newline before each
       
    84 	while( ( pQualifiedString = next() ) != NULL)
       
    85 		{
       
    86 		aOs << "\n";
       
    87 		aOs << (* pQualifiedString).GetEntry();
       
    88 		aOs << ":";
       
    89 		aOs << (* pQualifiedString).GetFileName();
       
    90 		aOs << ":";
       
    91 		aOs << (* pQualifiedString).GetLineNumber();
       
    92 		}
       
    93 	return aOs;
       
    94 	}
       
    95 
       
    96