| 131 | } |
| 132 | |
| 133 | void KicadLibParser::writeComponent(Component *component) |
| 134 | { |
| 135 | // http://en.wikibooks.org/wiki/Kicad/file_formats#Description_of_a_component_2 |
| 136 | |
| 137 | // comments |
| 138 | _stream << "#" << '\n' << "# " << component->name() << '\n' << "#" << '\n'; |
| 139 | |
| 140 | // def |
| 141 | _stream << "DEF " << component->name() << " " << component->prefix() << " 0 20 "; |
| 142 | _stream << (component->showPadName() ? "Y " : "N "); |
| 143 | _stream << (component->showPinName() ? "Y " : "N "); |
| 144 | _stream << "1 F N" << '\n'; |
| 145 | |
| 146 | // F0 |
| 147 | _stream << "F0"; |
| 148 | writeLabel(component->refText()); |
| 149 | _stream << '\n'; |
| 150 | |
| 151 | // F1 |
| 152 | _stream << "F1"; |
| 153 | writeLabel(component->nameText()); |
| 154 | _stream << '\n'; |
| 155 | |
| 156 | // F2 |
| 157 | _stream << "F2"; |
| 158 | writeLabel(component->packageText()); |
| 159 | _stream << '\n'; |
| 160 | |
| 161 | // F3 |
| 162 | _stream << "F3"; |
| 163 | writeLabel(component->docText()); |
| 164 | _stream << '\n'; |
| 165 | |
| 166 | // footprints |
| 167 | if (!component->footPrints().isEmpty()) |
| 168 | { |
| 169 | _stream << "$FPLIST" << '\n'; |
| 170 | foreach (const QString &footPrint, component->footPrints()) |
| 171 | { |
| 172 | _stream << " " << footPrint << '\n'; |
| 173 | } |
| 174 | _stream << "$ENDFPLIST" << '\n'; |
| 175 | } |
| 176 | |
| 177 | // alias |
| 178 | if (!component->aliases().isEmpty()) |
| 179 | _stream << "ALIAS " << component->aliases().join(" ") << '\n'; |
| 180 | |
| 181 | _stream << "DRAW" << '\n'; |
| 182 | // draw |
| 183 | foreach (Draw *draw, component->draws()) |
| 184 | { |
| 185 | writeDraw(draw); |
| 186 | _stream << '\n'; |
| 187 | } |
| 188 | // pins |
| 189 | foreach (Pin *pin, component->pins()) |
| 190 | { |
nothing calls this directly
no test coverage detected