bintools/rcomp/src/STRINGAR.CPP
changeset 0 044383f39525
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     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 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 "STRINGAR.H"
       
    20 
       
    21 // StringArray
       
    22 
       
    23 StringArray::StringArray()
       
    24 	{}
       
    25 	
       
    26 StringArray& StringArray::operator= ( const StringArray& Source)
       
    27 	{
       
    28 	return (StringArray&) Array::operator= ( Source);
       
    29 	}
       
    30 	
       
    31 void StringArray::Add( String * pNewItem)
       
    32 	{
       
    33 	Array::Add( pNewItem);
       
    34 	}
       
    35 
       
    36 // StringArrayIterator
       
    37 
       
    38 StringArrayIterator::StringArrayIterator(const StringArray& c):
       
    39 	ArrayIterator(c)
       
    40 	{}
       
    41 
       
    42 String* StringArrayIterator::operator() ()
       
    43 	{
       
    44 	return ( String *) ArrayIterator::operator() ();
       
    45 	}
       
    46 
       
    47 // ostream functions
       
    48 
       
    49 ostream& operator<< ( ostream & os, StringArray & s)
       
    50 	{
       
    51 	if (s.Size() == 0)
       
    52 		return ( os << "<none>");
       
    53 	StringArrayIterator next( s);
       
    54 	String * p;
       
    55 	// Ouput first string.
       
    56 	if ( ( p = next() ) != NULL)
       
    57 		os << *p;
       
    58 	// Output remaining strings with tab before each.
       
    59 	while ( ( p = next() ) != NULL)
       
    60 		os << "\t" << * p;
       
    61 	return os;
       
    62 	}
       
    63