class CCL::StringUtils::IndexedNameBuilder

Overview

Helper for appending a running number to a name (e.g. More…

#include <stringbuilder.h>

class IndexedNameBuilder
{
public:
    // construction

    IndexedNameBuilder (
        StringRef requestedName,
        StringRef originalName,
        int startNumber = 2,
        StringRef separator = " "
    );

    // methods

    void nextName (String& name);
};

Detailed Documentation

Helper for appending a running number to a name (e.g.

to avoid duplicate names). Tries to extract an existing number from requestedName as starting point.

A trailing number in the optional originalName is treated as part of an immutable stem. The appended numbers are put in brackets instead in this case.

The separator is the string between stem name and number (or opening bracket).

Methods

void nextName (String& name)

increases number