#ifndef _NSRTOOLSH_ //-*-c++-*-
#define _NSRTOOLSH_

//----------------------------------------------------------------------
//  nsrTools.h
//   Miscellaneous tools for making life simpler
//
//      Unpublished Confidential Information of Hewlett-Packard
//      Company. Do not disclose.  Copyright (c) Hewlett-Packard
//      Company 1995. All rights reserved
// 
// The contents of this software are proprietary and confidential to
// the Hewlett- Packard Company, and are limited in distribution to
// those with a direct need to know.  Individuals having access to
// this software are responsible for maintaining the confidentiality
// of the content and for keeping the software secure when not in use.
// Transfer to any party is strictly forbidden other than as expressly
// permitted in writing by Hewlett-Packard Company.  Unauthorized
// transfer to or possession by any unauthorized party may be a
// criminal offense.
//
//                  RESTRICTED RIGHTS LEGEND
//
//      Use,  duplication,  or disclosure by the U. S. Government is
//      subject to restrictions as set forth in subparagraph (c) (1)
//      (ii) in the Rights in Technical Data and Computer Software
//      clause in DFARS 252.227-7013 or any other successor clause.
//
//                      HEWLETT-PACKARD COMPANY
//                      3000 Hanover St.
//                      Palo Alto, CA  94304 U.S.A.
//
//      Rights for non-DOD U.S. Government Departments and Agencies
//      are as set forth in FAR 52.227-19 (c) (1,2) or any other
//      successor clause.
//
//  CLASSES:
//   None.
//  
//----------------------------------------------------------------------
// $Source: /projects/HMS/nsr/udfCore/sys/nsrTools.h,v $
// $Revision: 1.9 $     $Author: hmgr $
// $State: Exp $        $Locker:  $
// $Date: 96/05/21 15:09:46 $
//

//----------------------------------------------------------------------
//  METHOD:  space(n)                           --JLK
//    Returns a String of n spaces
//
//  ARGS:
//    n                     IN      number of spaces 
//
//  RETURNS:
//    String of n spaces.  Returns empty string for n <= 0.  
//    Returns max of 160 spaces for n >= 160.
// 
//  PRE-CONDS:
//    0 <= n < 160.  
// 
//  ERRORS:
//    none      
// 
//  NOTES:
//    This function used to be global within NSR, but the compiler
//    wasn't accepting that.  So now it is defined as a private method
//    in each object with a print() method.  space() is usually called
//    by print() methods.
//  
//    Static method that lives in class NSR.  Public method.
//    Call by NSR::space() if not in NSR, or even if in NSR (for the
//    heck of it).
//----------------------------------------------------------------------

static const String & 
space( int numSpaces ) {
    const int MAX_SPACES = 160;  // Max number of spaces returned

    // 'spaces' is 160 spaces.  that is, it's a string of MAX_SPACES length.
    static CONST_CHAR_PTR spaces = "                                                                                                                                                                " ;  // <---- 160 spaces

    static String returnString; 
    returnString = spaces;
    if (numSpaces < 0)
        numSpaces = 0;
    else if (numSpaces > MAX_SPACES)
        numSpaces = MAX_SPACES;
    returnString.remove( numSpaces );  
    return returnString;
} // space()

#endif // _NSRTOOLSH_

