Reading only layers names: how do I stop parsing?

Use this forum to ask questions about how to do things in dxflib.

Moderator: andrew

Post Reply
diego.gnesi
Registered Member
Posts: 1
Joined: Fri Apr 27, 2012 12:20 pm

Reading only layers names: how do I stop parsing?

Post by diego.gnesi » Thu May 17, 2012 1:03 pm

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?

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

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

Post by andrew » Mon May 21, 2012 4:12 pm

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()) {}
    ...
}

Post Reply

Return to “dxflib 'How Do I' Questions”