KiCad PCB EDA Suite
Loading...
Searching...
No Matches
common.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) 2014-2020 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2007-2015 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
6 * Copyright (C) 2008 Wayne Stambaugh <[email protected]>
7 * Copyright (C) 1992-2023, 2024 KiCad Developers, see AUTHORS.txt for contributors.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
32#ifndef INCLUDE__COMMON_H_
33#define INCLUDE__COMMON_H_
34
35#include <kicommon.h>
36#include <functional>
37#include <memory>
38
39#include <wx/fileconf.h>
40#include <wx/string.h>
41#include <wx/process.h>
42
43class PROJECT;
44class SEARCH_STACK;
45class REPORTER;
46
59KICOMMON_API wxString SearchHelpFileFullPath( const wxString& aBaseName );
60
70KICOMMON_API bool EnsureFileDirectoryExists( wxFileName* aTargetFullFileName,
71 const wxString& aBaseFilename,
72 REPORTER* aReporter = nullptr );
73
77KICOMMON_API wxString EnsureFileExtension( const wxString& aFilename, const wxString& aExtension );
78
85KICOMMON_API const wxString ExpandEnvVarSubstitutions( const wxString& aString,
86 const PROJECT* aProject );
87
91#define FOR_ERC_DRC 1
92
93KICOMMON_API wxString ExpandTextVars( const wxString& aSource,
94 const std::function<bool( wxString* )>* aResolver,
95 int aFlags = 0 );
96
97KICOMMON_API wxString ExpandTextVars( const wxString& aSource, const PROJECT* aProject,
98 int aFlags = 0 );
99
103KICOMMON_API wxString GetTextVars( const wxString& aSource );
104
108KICOMMON_API bool IsTextVar( const wxString& aSource );
109
113KICOMMON_API const wxString ResolveUriByEnvVars( const wxString& aUri, const PROJECT* aProject );
114
115
116KICOMMON_API long long TimestampDir( const wxString& aDirPath, const wxString& aFilespec );
117
118
125
126
127#endif // INCLUDE__COMMON_H_
Container for project specific data.
Definition: project.h:64
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:72
Look for files in a number of paths.
Definition: search_stack.h:43
KICOMMON_API wxString ExpandTextVars(const wxString &aSource, const std::function< bool(wxString *)> *aResolver, int aFlags=0)
Definition: common.cpp:71
KICOMMON_API wxString EnsureFileExtension(const wxString &aFilename, const wxString &aExtension)
It's annoying to throw up nag dialogs when the extension isn't right.
Definition: common.cpp:422
KICOMMON_API long long TimestampDir(const wxString &aDirPath, const wxString &aFilespec)
A copy of ConvertFileTimeToWx() because wxWidgets left it as a static function private to src/common/...
Definition: common.cpp:597
KICOMMON_API const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
Definition: common.cpp:348
KICOMMON_API bool IsTextVar(const wxString &aSource)
Returns true if the string is a text var, e.g starts with ${.
Definition: common.cpp:133
KICOMMON_API wxString GetTextVars(const wxString &aSource)
Returns any variables unexpanded, e.g.
Definition: common.cpp:121
KICOMMON_API const wxString ResolveUriByEnvVars(const wxString &aUri, const PROJECT *aProject)
Replace any environment and/or text variables in URIs.
Definition: common.cpp:361
KICOMMON_API bool EnsureFileDirectoryExists(wxFileName *aTargetFullFileName, const wxString &aBaseFilename, REPORTER *aReporter=nullptr)
Make aTargetFullFileName absolute and create the path of this file if it doesn't yet exist.
Definition: common.cpp:369
KICOMMON_API wxString SearchHelpFileFullPath(const wxString &aBaseName)
Return the help file's full path.
KICOMMON_API bool WarnUserIfOperatingSystemUnsupported()
Checks if the operating system is explicitly unsupported and displays a disclaimer message box.
Definition: common.cpp:696
#define KICOMMON_API
Definition: kicommon.h:28