forked from JulesStringer/GerberParser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Layer.cpp
43 lines (41 loc) · 1 KB
/
Layer.cpp
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
#include "Layer.h"
#include <regex>
CLayer::CLayer()
: m_nColourIndex(0)
, m_bInclude(true)
{
}
CLayer::~CLayer()
{
}
CLayer::CLayer(const char* pszName, unsigned char nColourIndex, const char* pszRegex)
: m_strName(pszName)
, m_nColourIndex(nColourIndex)
, m_strRegex(pszRegex)
, m_bInclude(true)
{
}
unsigned char CLayer::ColourIndex()
{
return m_nColourIndex;
}
const char* CLayer::Name()
{
return m_strName.c_str();
}
bool CLayer::CommentMatch(const char* psz)
{
// This function can be overridden to return true to set this as the current layer
// when a comment matching a predetermined pattern is recognised.
std::string strComment(psz);
std::regex regex(m_strRegex.c_str());
return regex_match(strComment.begin(), strComment.end(), regex);
// For FreePCB try the following
// Outline ::= "-+ *Draw board outline";
// Parts :: = "-+ *Draw Parts";
}
bool CLayer::Include() { return m_bInclude; }
void CLayer::SetInclude(bool bInclude)
{
m_bInclude = bInclude;
}