Repository navigation
Expand file tree
/
Copy pathItemText.cpp
More file actions
45 lines (38 loc) · 1.51 KB
/
Copy pathItemText.cpp
File metadata and controls
45 lines (38 loc) · 1.51 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
43
44
45
//-----------------------------------------------------------------------------
// This file is part of the the QParser2 project. You can find the complete
// project here: https://github.com/robdunn4/QSpice/
//-----------------------------------------------------------------------------
#include "ItemText.h"
#include "StrUtil.h"
#include <iostream>
bool ItemText::parseItem(const std::string &argStr) {
StrList strList = StrUtil::tokenize(argStr);
if (strList.size() != 8) return false;
try {
pt1 = ArgPoint(strList[0]);
fontSize = ArgFontSize(strList[1]);
rotateAlign = ArgRotAlign(strList[2]);
textFlags = ArgTextFlags(strList[3]);
textColor = ArgColor(strList[4]);
lookupNdx = ArgLookupNdx(strList[5]);
pinNdx = ArgPinNdx(strList[6]);
text = ArgString(strList[7]);
} catch (...) {
return false;
}
// debugging/reverse-engineering... expecting only bits 0-1 used in p4
// TODO: Revisit...
if (textFlags & ~0x03) return false;
// reverse-engineering...
if (pinNdx.getValue() != -1) {
std::cout << "*** Parameter p7 has undecoded value (lookup index?): "
<< toString() << std::endl;
}
return true;
}
std::string ItemText::toString() const {
return std::string(getTypeStr()) + " " + pt1.toString() + " " +
fontSize.toString() + " " + rotateAlign.toString() + " " +
textFlags.toString() + " " + textColor.toString() + " " +
lookupNdx.toString() + " " + pinNdx.toString() + " " + text.toString();
}