Reading only layers names: how do I stop parsing?

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

Moderator: andrew

Reading only layers names: how do I stop parsing?

Postby 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?
diego.gnesi
Registered Member
 
Posts: 1
Joined: Fri Apr 27, 2012 12:20 pm

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

Postby 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()) {}
    ...
}
User avatar
andrew
Site Admin
 
Posts: 2613
Joined: Fri Mar 30, 2007 6:07 am


Return to dxflib 'How Do I' Questions

Who is online

Users browsing this forum: No registered users and 2 guests