KiCad PCB EDA Suite
GBR_DATA_FIELD Class Reference

This class handle a Gerber data field. More...

#include <gbr_netlist_metadata.h>

Public Member Functions

 GBR_DATA_FIELD ()
 
void clear ()
 
void Clear ()
 
const wxString & GetValue ()
 
void SetField (const wxString &aField, bool aUseUTF8, bool aEscapeString)
 
bool IsEmpty ()
 
std::string GetGerberString ()
 

Private Attributes

wxString m_field
 the unicade text to print in Gbr file (after escape and quoting) More...
 
bool m_useUTF8
 true to use UTF8, false to escape non ascii7 chars More...
 
bool m_escapeString
 true to quote the field in gbr file More...
 

Detailed Description

This class handle a Gerber data field.

this is a unicode string with some chars converted in escaped Hexa sequence when creating the file Chars always escaped because they are separator in Gerber files: * , \ % non ascii 7 chars can be converted to UTF8 or escaped.

Definition at line 95 of file gbr_netlist_metadata.h.

Constructor & Destructor Documentation

◆ GBR_DATA_FIELD()

GBR_DATA_FIELD::GBR_DATA_FIELD ( )
inline

Definition at line 98 of file gbr_netlist_metadata.h.

98  : m_useUTF8( false ), m_escapeString( false )
99  {}
bool m_useUTF8
true to use UTF8, false to escape non ascii7 chars
bool m_escapeString
true to quote the field in gbr file

Member Function Documentation

◆ clear()

void GBR_DATA_FIELD::clear ( )
inline

Definition at line 101 of file gbr_netlist_metadata.h.

102  {
103  m_field.clear();
104  m_useUTF8 = false;
105  m_escapeString = false;
106  }
bool m_useUTF8
true to use UTF8, false to escape non ascii7 chars
wxString m_field
the unicade text to print in Gbr file (after escape and quoting)
bool m_escapeString
true to quote the field in gbr file

References m_escapeString, m_field, and m_useUTF8.

Referenced by Clear(), and GBR_NETLIST_METADATA::ClearAttribute().

◆ Clear()

void GBR_DATA_FIELD::Clear ( )
inline

Definition at line 108 of file gbr_netlist_metadata.h.

108 { clear(); }

References clear().

Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand().

◆ GetGerberString()

std::string GBR_DATA_FIELD::GetGerberString ( )

Definition at line 484 of file gbr_metadata.cpp.

485 {
486  wxString converted;
487 
488  if( !m_field.IsEmpty() )
490 
491  // Convert the char string to std::string. Be carefull when converting awxString to
492  // a std::string: using static_cast<const char*> is mandatory
493  std::string txt = static_cast<const char*>( converted.utf8_str() );
494 
495  return txt;
496 }
bool m_useUTF8
true to use UTF8, false to escape non ascii7 chars
wxString m_field
the unicade text to print in Gbr file (after escape and quoting)
bool m_escapeString
true to quote the field in gbr file
wxString ConvertNotAllowedCharsInGerber(const wxString &aString, bool aAllowUtf8Chars, bool aQuoteString)
Similar to FormatStringToGerber.

References ConvertNotAllowedCharsInGerber(), m_escapeString, m_field, and m_useUTF8.

Referenced by FormatNetAttribute().

◆ GetValue()

const wxString& GBR_DATA_FIELD::GetValue ( )
inline

Definition at line 110 of file gbr_netlist_metadata.h.

110 { return m_field; }
wxString m_field
the unicade text to print in Gbr file (after escape and quoting)

References m_field.

Referenced by GERBER_DRAW_ITEM::GetMsgPanelInfo().

◆ IsEmpty()

bool GBR_DATA_FIELD::IsEmpty ( )
inline

Definition at line 119 of file gbr_netlist_metadata.h.

119 { return m_field.IsEmpty(); }
wxString m_field
the unicade text to print in Gbr file (after escape and quoting)

References m_field.

Referenced by FormatNetAttribute(), and GERBER_DRAW_ITEM::GetMsgPanelInfo().

◆ SetField()

void GBR_DATA_FIELD::SetField ( const wxString &  aField,
bool  aUseUTF8,
bool  aEscapeString 
)
inline

Definition at line 112 of file gbr_netlist_metadata.h.

113  {
114  m_field = aField;
115  m_useUTF8 = aUseUTF8;
116  m_escapeString = aEscapeString;
117  }
bool m_useUTF8
true to use UTF8, false to escape non ascii7 chars
wxString m_field
the unicade text to print in Gbr file (after escape and quoting)
bool m_escapeString
true to quote the field in gbr file

References m_escapeString, m_field, and m_useUTF8.

Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand(), GBR_METADATA::SetPadName(), and GBR_METADATA::SetPadPinFunction().

Member Data Documentation

◆ m_escapeString

bool GBR_DATA_FIELD::m_escapeString
private

true to quote the field in gbr file

Definition at line 128 of file gbr_netlist_metadata.h.

Referenced by clear(), GetGerberString(), and SetField().

◆ m_field

wxString GBR_DATA_FIELD::m_field
private

the unicade text to print in Gbr file (after escape and quoting)

Definition at line 125 of file gbr_netlist_metadata.h.

Referenced by clear(), GetGerberString(), GetValue(), IsEmpty(), and SetField().

◆ m_useUTF8

bool GBR_DATA_FIELD::m_useUTF8
private

true to use UTF8, false to escape non ascii7 chars

Definition at line 127 of file gbr_netlist_metadata.h.

Referenced by clear(), GetGerberString(), and SetField().


The documentation for this class was generated from the following files: