summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiddhant Ranade2014-07-06 11:17:02 +0530
committerSiddhant Ranade2014-07-06 11:17:02 +0530
commit11d816292ade5dea7b877e6289fa0437a809b5ac (patch)
tree410ba5b074697184f3f45265fee554f67149cb84
parent5b5154198492947f40420aa58cd6a782b17dc382 (diff)
downloadPspice-Kicad-Converter-11d816292ade5dea7b877e6289fa0437a809b5ac.tar.gz
Pspice-Kicad-Converter-11d816292ade5dea7b877e6289fa0437a809b5ac.tar.bz2
Pspice-Kicad-Converter-11d816292ade5dea7b877e6289fa0437a809b5ac.zip
Reference is read from library now.
-rw-r--r--lib/component.cpp16
-rw-r--r--lib/component.h4
2 files changed, 15 insertions, 5 deletions
diff --git a/lib/component.cpp b/lib/component.cpp
index de3346e..16eb6ca 100644
--- a/lib/component.cpp
+++ b/lib/component.cpp
@@ -71,7 +71,7 @@ void Pin::print(ostream& out, int shiftx, int shifty){
//print function of class component to print all the components to output's cache lib file
void Component::print(ostream& out){
out<<"#\n# "<<type<<"\n#\nDEF "<<type<<" "<<type<<" 0 30 Y Y 1 F N"<<endl; //upto DEF line printed
- out<<"F0 \""<<type<<"\" 0 0 30 H V L CNN"<<endl; //F0 line
+ out<<"F0 \""<<ref<<"\" 0 0 30 H V L CNN"<<endl; //F0 line
out<<"F1 \""<<type<<"\" 0 60 30 H V L CNN"<<endl; //F1 line
out<<"DRAW"<<endl;
des.print(out); //calling print funcition of design to print design of components
@@ -96,8 +96,18 @@ Component::Component(istream& in, string t){
in.seekg(g);
string line=skipTo(in, "*symbol "+t);
}
-
- //cout<<waste<<endl; ///DEBUG
+ skipTo(in, "@attributes");
+ while(line[0]=='a'){
+ Attribute attr(line); // creating attributes by calling its constructor
+ if(attr.name=="PKGREF") {
+ ref=attr.value; //assigning attributes of PKGREF to the component
+ //cout<<"**"<<attr.value<<endl; ///DEBUG
+ }
+ g=in.tellg();
+ getline(in, line);
+ ///cerr<<"***"<<line<<endl; ///DEBUG
+ }
+ in.seekg(g);
//to get to the starting point of the pins of the type required
skipTo(in, "@pins");
makePins(in); //calling makepins function to create pins
diff --git a/lib/component.h b/lib/component.h
index fa302c5..2c93a92 100644
--- a/lib/component.h
+++ b/lib/component.h
@@ -15,7 +15,7 @@ See LICENSE.txt
class Pin{
public:
int x, y, length; //position of pin and lentgh of the pin
- string n, etype; //n is the pin number and etype is the electrical type
+ string n, etype; //n is the pin number and etype is the electrical type
string orient; //to store the orientation of pin
Pin(istream& in); //Pin constructor to set the values
void print(ostream&, int, int); //to print in output cache lib file
@@ -23,7 +23,7 @@ class Pin{
class Component{
public:
- string type; //annotation;
+ string type, ref; //annotation;
vector<Pin> pins;
Design des; //create object of design class to access its method
Component(); //default constructor of Component class