KiCad PCB EDA Suite
Loading...
Searching...
No Matches
column_formatter.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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include <wx/string.h>
23
24#include <reporter.h>
25#include <units_provider.h>
26
27
29{
30public:
31 enum class BOOL_FORMAT
32 {
35 };
36
37 virtual ~COLUMN_FORMATTER() = default;
38
39 COLUMN_FORMATTER( UNITS_PROVIDER& aUnitsProvider, bool aIncludeUnits, BOOL_FORMAT aBoolFormat,
40 REPORTER& aReporter ) :
41 m_unitsProvider( aUnitsProvider ),
42 m_includeUnits( aIncludeUnits ),
43 m_boolFormat( aBoolFormat ),
44 m_reporter( aReporter )
45 {
46 }
47
48protected:
49 wxString stringFromBool( bool aValue ) const;
50
51 bool boolFromString( const wxString& aValue, REPORTER& aReporter ) const;
52
57};
58
59
63bool MatchTranslationOrNative( const wxString& aStr, const wxString& aNativeLabel, bool aCaseSensitive );
COLUMN_FORMATTER(UNITS_PROVIDER &aUnitsProvider, bool aIncludeUnits, BOOL_FORMAT aBoolFormat, REPORTER &aReporter)
BOOL_FORMAT m_boolFormat
wxString stringFromBool(bool aValue) const
bool boolFromString(const wxString &aValue, REPORTER &aReporter) const
virtual ~COLUMN_FORMATTER()=default
UNITS_PROVIDER & m_unitsProvider
A pure virtual class used to derive REPORTER objects from.
Definition reporter.h:73
bool MatchTranslationOrNative(const wxString &aStr, const wxString &aNativeLabel, bool aCaseSensitive)
Return true if the given string matches either the translated or native version of the given label.