KiCad PCB EDA Suite
kicad_string.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) 2004 KiCad Developers, see change_log.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, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
30 #ifndef KICAD_STRING_H_
31 #define KICAD_STRING_H_
32 
33 #include "config.h"
34 
35 #include <wx/string.h>
36 #include <wx/filename.h>
37 
38 
52 int ReadDelimitedText( char* aDest, const char* aSource, int aDestSize );
53 
63 int ReadDelimitedText( wxString* aDest, const char* aSource );
64 
74 std::string EscapedUTF8( const wxString& aString );
75 
79 wxString EscapedHTML( const wxString& aString );
80 
86 char* GetLine( FILE* aFile, char* Line, int* LineNum = NULL, int SizeLine = 255 );
87 
93 char* StrPurge( char* text );
94 
99 wxString DateAndTime();
100 
118 int StrNumCmp( const wxString& aString1, const wxString& aString2, int aLength = INT_MAX,
119  bool aIgnoreCase = false );
120 
126 bool WildCompareString( const wxString& pattern,
127  const wxString& string_to_tst,
128  bool case_sensitive = true );
129 
138 int RefDesStringCompare( const wxString& lhs, const wxString& rhs );
139 
148 int SplitString( wxString strToSplit,
149  wxString* strBeginning,
150  wxString* strDigits,
151  wxString* strEnd );
152 
157 wxString GetIllegalFileNameWxChars();
158 
174 bool ReplaceIllegalFileNameChars( std::string* aName, int aReplaceChar = 0 );
175 
176 #ifndef HAVE_STRTOKR
177 // common/strtok_r.c optionally:
178 extern "C" char* strtok_r( char* str, const char* delim, char** nextp );
179 #endif
180 
181 #endif // KICAD_STRING_H_
wxString GetIllegalFileNameWxChars()
Function GetIllegalFileNameWxChars.
Definition: string.cpp:477
wxString DateAndTime()
Function DateAndTime.
Definition: string.cpp:229
std::string EscapedUTF8(const wxString &aString)
Function EscapedUTF8 returns an 8 bit UTF8 string given aString in unicode form.
Definition: string.cpp:137
bool ReplaceIllegalFileNameChars(std::string *aName, int aReplaceChar=0)
Function ReplaceIllegalFileNameChars checks aName for illegal file name characters.
Definition: string.cpp:483
wxString EscapedHTML(const wxString &aString)
Return a new wxString escaped for embedding in HTML.
Definition: string.cpp:170
int SplitString(wxString strToSplit, wxString *strBeginning, wxString *strDigits, wxString *strEnd)
Function SplitString breaks a string into three parts.
Definition: string.cpp:418
bool WildCompareString(const wxString &pattern, const wxString &string_to_tst, bool case_sensitive=true)
Function WildCompareString compares a string against wild card (* and ?) pattern using the usual rule...
Definition: string.cpp:305
char * strtok_r(char *str, const char *delim, char **nextp)
char * GetLine(FILE *aFile, char *Line, int *LineNum=NULL, int SizeLine=255)
Function GetLine reads one line line from aFile.
Definition: string.cpp:213
int RefDesStringCompare(const wxString &lhs, const wxString &rhs)
Function RefDesStringCompare acts just like the strcmp function but treats numbers within the string ...
Definition: string.cpp:365
int ReadDelimitedText(char *aDest, const char *aSource, int aDestSize)
Function ReadDelimitedText copies bytes from aSource delimited string segment to aDest buffer...
Definition: string.cpp:88
int StrNumCmp(const wxString &aString1, const wxString &aString2, int aLength=INT_MAX, bool aIgnoreCase=false)
Function StrLenNumCmp is a routine compatible with qsort() to sort by alphabetical order...
Definition: string.cpp:238
char * StrPurge(char *text)
Function StrPurge removes leading and training spaces, tabs and end of line chars in text return a po...
Definition: string.cpp:194