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 <wxstruct.h>
31 #include <macros.h>
33 
35 
36 
46  REFERENCE = 0,
50 
54 
63 };
64 
65 
73 {
74  wxString m_Name;
75  wxString m_Value;
76  bool m_Visible;
77 
79  m_Visible( false )
80  {
81  }
82 
83  TEMPLATE_FIELDNAME( const wxString& aName ) :
84  m_Name( aName ),
85  m_Visible( false )
86  {
87  }
88 
90  {
91  m_Name = ref.m_Name;
92  m_Value = ref.m_Value;
93  m_Visible = ref.m_Visible;
94  }
95 
100  void Format( OUTPUTFORMATTER* out, int nestLevel ) const throw( IO_ERROR );
101 
115  void Parse( TEMPLATE_FIELDNAMES_LEXER* aSpec ) throw( IO_ERROR );
116 
123  static const wxString GetDefaultFieldName( int aFieldNdx );
124 };
125 
126 typedef std::vector< TEMPLATE_FIELDNAME > TEMPLATE_FIELDNAMES;
127 
128 
130 {
131 private:
132  TEMPLATE_FIELDNAMES m_Fields;
133 
134 public:
135 
140  void Format( OUTPUTFORMATTER* out, int nestLevel ) const throw( IO_ERROR );
141 
146  void Parse( TEMPLATE_FIELDNAMES_LEXER* in ) throw( IO_ERROR );
147 
148 
160  int AddTemplateFieldName( const TEMPLATE_FIELDNAME& aFieldName );
161 
167  {
168  m_Fields.clear();
169  }
170 
175  const TEMPLATE_FIELDNAMES& GetTemplateFieldNames()
176  {
177  return m_Fields;
178  }
179 
187  bool HasFieldName( const wxString& aName ) const;
188 };
189 
190 #endif // _TEMPLATE_FIELDNAME_H_
bool m_Visible
If first appearance of the field's editor has as visible.
wxString m_Value
The default value or empty.
name of datasheet
Class TEMPLATE_FIELDNAMES_LEXER is an automatically generated class using the TokenList2DnsLexer.cmake technology, based on keywords provided by file: /home/kicad/workspace/kicad-doxygen/eeschema/template_fieldnames.keywords.
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
int AddTemplateFieldName(const TEMPLATE_FIELDNAME &aFieldName)
Function AddTemplateFieldName inserts or appends a wanted symbol field name into the fieldnames templ...
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
Base window classes and related definitions.
const TEMPLATE_FIELDNAMES & GetTemplateFieldNames()
Function GetTemplateFieldName returns a template fieldnames list for read only access.
TEMPLATE_FIELDNAMES m_Fields
void Format(OUTPUTFORMATTER *out, int nestLevel) const
Function Format serializes this object out as text into the given OUTPUTFORMATTER.
void DeleteAllTemplateFieldNames()
Function DeleteAllTemplateFieldNames deletes the entire contents.
void Parse(TEMPLATE_FIELDNAMES_LEXER *in)
Function Parse fills this object from information in the input stream handled by TEMPLATE_FIELDNAMES_...
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".
bool HasFieldName(const wxString &aName) const
Function HasFieldName checks for aName in the the template field name list.
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's field, field value, and default visibility...
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47