Reading only layers names: how do I stop parsing?

I inherited a class from DL_CreationAdapter for extracting layer names from a dxf file. The problem is that the code is VERY slow, because the DL_CreationAdapter correctly reads all layers but then contnues to read the file until the end. Is there a method to stop parsing when layers’ data are all red?

No.

You could add add that functionality to DL_CreationInterface as follows:

dl_creationinterface.h:

// implement this in your creation interface implementation to return true to stop parsing
bool DL_CreationInterface::stop() = 0;

dl_creationadapter.h:

bool DL_CreationInterface::stop() {}

dl_dxf.cpp:

DL_Dxf::in(...) {
    ...
    while (readDxfGroups(fp, creationInterface, &errorCounter) && !creationInterface->stop()) {}
    ...
}