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  wxString m_Value;
75  bool m_Visible;
76 
78  m_Visible( false )
79  {
80  }
81 
82  TEMPLATE_FIELDNAME( const wxString& aName ) :
83  m_Name( aName ),
84  m_Visible( false )
85  {
86  }
87 
89  {
90  m_Name = ref.m_Name;
91  m_Value = ref.m_Value;
92  m_Visible = ref.m_Visible;
93  }
94 
99  void Format( OUTPUTFORMATTER* out, int nestLevel ) const ;
100 
114  void Parse( TEMPLATE_FIELDNAMES_LEXER* aSpec );
115 
122  static const wxString GetDefaultFieldName( int aFieldNdx );
123 };
124 
125 typedef std::vector< TEMPLATE_FIELDNAME > TEMPLATE_FIELDNAMES;
126 
127 
129 {
130 private:
132 
133 public:
134 
139  void Format( OUTPUTFORMATTER* out, int nestLevel ) const ;
140 
145  void Parse( TEMPLATE_FIELDNAMES_LEXER* in );
146 
147 
159  int AddTemplateFieldName( const TEMPLATE_FIELDNAME& aFieldName );
160 
166  {
167  m_Fields.clear();
168  }
169 
175  {
176  return m_Fields;
177  }
178 
186  bool HasFieldName( const wxString& aName ) const;
187 };
188 
189 #endif // _TEMPLATE_FIELDNAME_H_
bool m_Visible
If first appearance of the field&#39;s editor has as visible.
wxString m_Value
The default value or empty.
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...
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()
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...