Page 1 of 1

Reading only layers names: how do I stop parsing?

Posted: Thu May 17, 2012 1:03 pm
by diego.gnesi
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?

Re: Reading only layers names: how do I stop parsing?

Posted: Mon May 21, 2012 4:12 pm
by andrew
No.

You could add add that functionality to DL_CreationInterface as follows:

dl_creationinterface.h:

Code: Select all

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

Code: Select all

bool DL_CreationInterface::stop() {}
dl_dxf.cpp:

Code: Select all

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