MCPcopy Create free account
hub / github.com/LibrePCB/LibrePCB / toString

Method toString

libs/librepcb/core/export/gerberattribute.cpp:91–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89 ******************************************************************************/
90
91QString GerberAttribute::toString() const noexcept {
92 QString s = "T";
93 bool strictAscii = true; // For maximum compatibility with crappy readers!
94 switch (mType) {
95 case Type::File: {
96 s += "F";
97 break;
98 }
99 case Type::Aperture: {
100 s += "A";
101 break;
102 }
103 case Type::Object: {
104 s += "O";
105 // ASCII is not sufficient for component values like μ or Ω, thus we
106 // allow unicode for such attributes. Note that such attributes should
107 // appear in Gerber X3 assembly files anyway (not in PCB data files),
108 // so only modern 8X3) readers will need to handle unicode.
109 strictAscii = false;
110 break;
111 }
112 case Type::Delete: {
113 s += "D";
114 break;
115 }
116 default: {
117 return QString();
118 }
119 }
120 s += mKey;
121 foreach (const QString& value, mValues) {
122 s += "," + escapeValue(value, strictAscii);
123 }
124 return s;
125}
126
127/*******************************************************************************
128 * Static Methods

Callers 3

generateCsvMethod · 0.45
D356NetlistGeneratorMethod · 0.45
fileCreationDateMethod · 0.45

Calls 1

QStringClass · 0.85

Tested by

no test coverage detected