Close

Relief for ODA Team in Ukraine

Learn more
ODA PRC SDK
Audit of a .prc File

ODA PRC SDK audit functionality is not implemented yet. The audit public interface will be used for future implementation.

Auditing is a process of checking PRC contents for errors. If errors are found, error information is stored and can be retrieved for displaying or other purposes.

Audit of a .prc file can be implemented through the following steps:

  1. Load an ODA Platform module for .prc functionality support:
    
    ::odrxDynamicLinker()->loadApp(OdPrcModuleName, false);
              
  2. Create an instance of the OdPrcAuditInfoImpl class:
    
    OdPrcAuditInfoImplPtr auditInfo = OdPrcAuditInfoImpl::createObject();      
            
  3. Create a drawing database and read the .prc file's contents into it:
    
    OdPrcFilePtr pDatabase = svcs.createDatabase();
    pDatabase->readFile(prcName, auditInfo);
            

    The prcName parameter should contain the full path to the audited .prc file. The auditInfo parameter contains a pointer to an audit information class and notifies whether error checking should be performed while reading the .prc file's content.

  4. Print the results of error checking:
    
    if (auditInfo->errorsFound()) 
    {
      const OdStringArray& info = auditInfo->errorInfo(); odPrintConsoleString(L"\nAudit reported %d error(s):\n", info.size()); for(OdUInt32 f=0; f(info.size(); ++f)
      {
        odPrintConsoleString(L"%ls\n", info[f].c_str());
      }
    }
    else
    {
      odPrintConsoleString(L"\nAudit reported no errors.");
    }
            

To provide correct handling of possible errors, the auditing source code can use a try ... catch section:


try
{
  OdPrcAuditInfoImplPtr auditInfo = OdPrcAuditInfoImpl::createObject();
  
  OdString prcName(argv[1]);
  
  ...
  
}
catch(OdError& e)
{
  odPrintConsoleString(L"\n\nError: %ls", e.description().c_str());
  nRes = -1;
}
catch(...)
{
  odPrintConsoleString(L"\n\nUnexpected error.");
  nRes = -1;
  throw;
}
    

The OdPrcAudit sample application illustrates how to audit the PRC contents of a .pdf file.

See Also:

Work with PRC Entities
Export a .prc File to an .xml File
Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.