KiCad PCB EDA Suite
altium_parser.cpp File Reference
#include "altium_parser.h"
#include <compoundfilereader.h>
#include <ki_exception.h>
#include <sstream>
#include <utf.h>
#include <wx/translation.h>
#include <wx/wx.h>

Go to the source code of this file.

Functions

const CFB::COMPOUND_FILE_ENTRY * FindStream (const CFB::CompoundFileReader &aReader, const char *aStreamName)
 

Function Documentation

◆ FindStream()

const CFB::COMPOUND_FILE_ENTRY* FindStream ( const CFB::CompoundFileReader &  aReader,
const char *  aStreamName 
)

Definition at line 34 of file altium_parser.cpp.

36 {
37  const CFB::COMPOUND_FILE_ENTRY* ret = nullptr;
38  aReader.EnumFiles( aReader.GetRootEntry(), -1,
39  [&]( const CFB::COMPOUND_FILE_ENTRY* aEntry, const CFB::utf16string& aU16dir,
40  int level ) -> void {
41  if( aReader.IsStream( aEntry ) )
42  {
43  std::string name = UTF16ToUTF8( aEntry->name );
44  if( aU16dir.length() > 0 )
45  {
46  std::string dir = UTF16ToUTF8( aU16dir.c_str() );
47  if( strncmp( aStreamName, dir.c_str(), dir.length() ) == 0
48  && aStreamName[dir.length()] == '\\'
49  && strcmp( aStreamName + dir.length() + 1, name.c_str() ) == 0 )
50  {
51  ret = aEntry;
52  }
53  }
54  else
55  {
56  if( strcmp( aStreamName, name.c_str() ) == 0 )
57  {
58  ret = aEntry;
59  }
60  }
61  }
62  } );
63  return ret;
64 }
const char * name
Definition: DXF_plotter.cpp:60

References name.

Referenced by SCH_ALTIUM_PLUGIN::Parse(), ALTIUM_PCB::Parse(), and ALTIUM_PCB::ParseModelsData().