Repository navigation
Expand file tree
/
Copy pathItemRect.cpp
More file actions
42 lines (38 loc) · 1.71 KB
/
Copy pathItemRect.cpp
File metadata and controls
42 lines (38 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//-----------------------------------------------------------------------------
// This file is part of the the QParser2 project. You can find the complete
// project here: https://github.com/robdunn4/QSpice/
//-----------------------------------------------------------------------------
#include "ItemRect.h"
#include "StrUtil.h"
bool ItemRect::parseItem(const std::string &argStr) {
StrList strList = StrUtil::tokenize(argStr);
// we expect ten or eleven subStrings
if (strList.size() < 10 || strList.size() > 11) return false;
try {
pt1 = ArgPoint(strList[0]);
pt2 = ArgPoint(strList[1]);
rotate = ArgRot(strList[2]);
lineWidth = ArgLineWidth(strList[3]);
lineType = ArgLineType(strList[4]);
lineColor = ArgColor(strList[5]);
fillColor = ArgColor(strList[6]);
lookupNdx = ArgLookupNdx(strList[7]);
isHierarchicalBlock = ArgInt(strList[8]);
pinNdx = ArgPinNdx(strList[9]);
if (strList.size() == 11) imageData = ArgImage(strList[10]);
} catch (...) {
return false;
}
return true;
}
std::string ItemRect::toString() const {
std::string str = std::string(getTypeStr()) + " " + pt1.toString() + " " +
pt2.toString() + " " + rotate.toString() + " " +
lineWidth.toString() + " " + lineType.toString() + " " +
lineColor.toString() + " " + fillColor.toString() + " " +
lookupNdx.toString() + " " +
isHierarchicalBlock.toString() + " " + pinNdx.toString();
// if image data present...
if (imageData.getValue().length()) str += " " + imageData.toString();
return str;
}