KiCad PCB EDA Suite
template_fieldnames.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
5  * Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 
26 #ifndef _TEMPLATE_FIELDNAME_H_
27 #define _TEMPLATE_FIELDNAME_H_
28 
29 #include <richio.h>
30 #include <macros.h>
31 #include <template_fieldnames_lexer.h>
32 
33 class TEMPLATE_FIELDNAMES_LEXER;
34 
35 
45  REFERENCE = 0,
49 
53 
62 };
63 
64 
72 {
73  wxString m_Name;
74  bool m_Visible;
75  bool m_URL;
76 
78  m_Visible( false ),
79  m_URL( false )
80  {
81  }
82 
83  TEMPLATE_FIELDNAME( const wxString& aName ) :
84  m_Name( aName ),
85  m_Visible( false ),
86  m_URL( false )
87  {
88  }
89 
91  {
92  m_Name = ref.m_Name;
93  m_Visible = ref.m_Visible;
94  m_URL = ref.m_URL;
95  }
96 
101  void Format( OUTPUTFORMATTER* out, int nestLevel ) const ;
102 
116  void Parse( TEMPLATE_FIELDNAMES_LEXER* aSpec );
117 
124  static const wxString GetDefaultFieldName( int aFieldNdx );
125 };
126 
127 typedef std::vector< TEMPLATE_FIELDNAME > TEMPLATE_FIELDNAMES;
128 
129 
131 {
132 private:
134 
135 public:
136 
141  void Format( OUTPUTFORMATTER* out, int nestLevel ) const ;
142 
147  void Parse( TEMPLATE_FIELDNAMES_LEXER* in );
148 
149 
161  int AddTemplateFieldName( const TEMPLATE_FIELDNAME& aFieldName );
162 
168  {
169  m_Fields.clear();
170  }
171 
177  {
178  return m_Fields;
179  }
180 
188  const TEMPLATE_FIELDNAME* GetFieldName( const wxString& aName ) const;
189 };
190 
191 #endif // _TEMPLATE_FIELDNAME_H_
bool m_Visible
If first appearance of the field&#39;s editor has as visible.
name of datasheet
The first 4 are mandatory, and must be instantiated in SCH_COMPONENT and LIB_PART constructors...
void Parse(TEMPLATE_FIELDNAMES_LEXER *aSpec)
Function Parse fills this object from information in the input stream aSpec, which is a TEMPLATE_FIEL...
bool m_URL
If field should have a browse button.
Class OUTPUTFORMATTER is an important interface (abstract class) used to output 8 bit text in a conve...
Definition: richio.h:327
static const wxString GetDefaultFieldName(int aFieldNdx)
Function GetDefaultFieldName returns a default symbol field name for field aFieldNdx for all componen...
Field Name Module PCB, i.e. "16DIP300".
Field Reference of part, i.e. "IC21".
This file contains miscellaneous commonly used macros and functions.
wxString m_Name
The field name.
std::vector< TEMPLATE_FIELDNAME > TEMPLATE_FIELDNAMES
const TEMPLATE_FIELDNAMES & GetTemplateFieldNames() const
Function GetTemplateFieldName returns a template fieldnames list for read only access.
TEMPLATE_FIELDNAMES m_Fields
void DeleteAllTemplateFieldNames()
Function DeleteAllTemplateFieldNames deletes the entire contents.
NumFieldType
Enum NumFieldType is the set of all field indices assuming an array like sequence that a SCH_COMPONEN...
Field Value of part, i.e. "3.3K".
TEMPLATE_FIELDNAME(const wxString &aName)
TEMPLATE_FIELDNAME(const TEMPLATE_FIELDNAME &ref)
void Format(OUTPUTFORMATTER *out, int nestLevel) const
Function Format serializes this object out as text into the given OUTPUTFORMATTER.
Struct TEMPLATE_FIELDNAME holds a name of a component&#39;s field, field value, and default visibility...