Changeset 790d835


Ignore:
Timestamp:
Nov 7, 2023, 3:38:01 PM (14 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
c6b4432
Parents:
934fa0f
Message:

Made UniqueName? use other tools we have, removed the unused default and did some general clean-up.

Location:
src/Common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Common/UniqueName.cc

    r934fa0f r790d835  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // UniqueName.cc --
     7// UniqueName.cc -- Create a unique variants of a base name with a counter.
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jun  8 14:47:49 2015
    13 // Update Count     : 3
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Tue Nov  7 15:04:00 2023
     13// Update Count     : 4
    1414//
    1515
    16 #include <string>
    17 #include <sstream>
     16#include "UniqueName.h"
    1817
    19 #include "UniqueName.h"
     18#include "Common/ToString.hpp"
    2019
    2120UniqueName::UniqueName( const std::string &base ) : base( base ), count( 0 ) {
     
    2322
    2423std::string UniqueName::newName( const std::string &additional ) {
    25         std::ostringstream os;
    26         os << base << additional << count++;
    27         return os.str();
     24        return toString( base, additional, count++ );
    2825}
    2926
  • src/Common/UniqueName.h

    r934fa0f r790d835  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // UniqueName.h --
     7// UniqueName.h -- Create a unique variants of a base name with a counter.
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 21 22:18:45 2017
    13 // Update Count     : 2
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Tue Nov  7 15:00:00 2023
     13// Update Count     : 3
    1414//
    1515
     
    1919
    2020class UniqueName {
    21   public:
    22         UniqueName( const std::string &base = "" );
     21public:
     22        UniqueName( const std::string &base );
    2323        std::string newName( const std::string &additional = "" );
    24   private:
     24private:
    2525        std::string base;
    2626        int count;
Note: See TracChangeset for help on using the changeset viewer.