Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
1ae44d09
Commit
1ae44d09
authored
Feb 02, 2011
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
work around 8 bit wxString B.S.
parent
6a26a7f9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
19 deletions
+26
-19
richio.cpp
common/richio.cpp
+12
-1
xnode.cpp
common/xnode.cpp
+4
-4
template_fieldnames.cpp
eeschema/template_fieldnames.cpp
+2
-2
richio.h
include/richio.h
+3
-7
sch_lib_table.cpp
new/sch_lib_table.cpp
+4
-4
pcb_plot_params.cpp
pcbnew/pcb_plot_params.cpp
+1
-1
No files found.
common/richio.cpp
View file @
1ae44d09
...
...
@@ -280,7 +280,7 @@ int OUTPUTFORMATTER::Print( int nestLevel, const char* fmt, ... ) throw( IO_ERRO
}
std
::
string
OUTPUTFORMATTER
::
Quote
d
(
const
std
::
string
&
aWrapee
)
throw
(
IO_ERROR
)
std
::
string
OUTPUTFORMATTER
::
Quote
s
(
const
std
::
string
&
aWrapee
)
throw
(
IO_ERROR
)
{
static
const
char
quoteThese
[]
=
"
\t
()
\n\r
"
;
...
...
@@ -329,6 +329,17 @@ std::string OUTPUTFORMATTER::Quoted( const std::string& aWrapee ) throw( IO_ERRO
}
std
::
string
OUTPUTFORMATTER
::
Quotew
(
const
wxString
&
aWrapee
)
throw
(
IO_ERROR
)
{
// s-expressions atoms are always encoded as UTF-8.
// The non-virutal function calls the virtual workhorse function, and if
// a different quoting or escaping strategy is desired from the standard,
// a derived class can overload Quotes() above, but
// should never be a reason to overload this Quotew() here.
return
Quotes
(
(
const
char
*
)
aWrapee
.
utf8_str
()
);
}
//-----<STRING_FORMATTER>----------------------------------------------------
void
STRING_FORMATTER
::
write
(
const
char
*
aOutBuf
,
int
aCount
)
throw
(
IO_ERROR
)
...
...
common/xnode.cpp
View file @
1ae44d09
...
...
@@ -34,7 +34,7 @@ void XNODE::Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IO_ERROR )
switch
(
GetType
()
)
{
case
wxXML_ELEMENT_NODE
:
out
->
Print
(
nestLevel
,
"(%s"
,
out
->
Quote
d
(
GetName
()
).
c_str
()
);
out
->
Print
(
nestLevel
,
"(%s"
,
out
->
Quote
w
(
GetName
()
).
c_str
()
);
FormatContents
(
out
,
nestLevel
);
if
(
GetNext
()
)
out
->
Print
(
0
,
")
\n
"
);
...
...
@@ -55,8 +55,8 @@ void XNODE::FormatContents( OUTPUTFORMATTER* out, int nestLevel ) throw( IO_ERRO
{
out
->
Print
(
0
,
" (%s %s)"
,
// attr names should never need quoting, no spaces, we designed the file.
out
->
Quote
d
(
attr
->
GetName
()
).
c_str
(),
out
->
Quote
d
(
attr
->
GetValue
()
).
c_str
()
out
->
Quote
w
(
attr
->
GetName
()
).
c_str
(),
out
->
Quote
w
(
attr
->
GetValue
()
).
c_str
()
);
}
...
...
@@ -82,7 +82,7 @@ void XNODE::FormatContents( OUTPUTFORMATTER* out, int nestLevel ) throw( IO_ERRO
break
;
case
wxXML_TEXT_NODE
:
out
->
Print
(
0
,
" %s"
,
out
->
Quote
d
(
GetContent
()
).
c_str
()
);
out
->
Print
(
0
,
" %s"
,
out
->
Quote
w
(
GetContent
()
).
c_str
()
);
break
;
default
:
...
...
eeschema/template_fieldnames.cpp
View file @
1ae44d09
...
...
@@ -32,10 +32,10 @@ wxString TEMPLATE_FIELDNAME::GetDefaultFieldName( int aFieldNdx )
void
TEMPLATE_FIELDNAME
::
Format
(
OUTPUTFORMATTER
*
out
,
int
nestLevel
)
const
throw
(
IO_ERROR
)
{
out
->
Print
(
nestLevel
,
"(field (name %s)"
,
out
->
Quote
d
(
m_Name
).
c_str
()
);
out
->
Print
(
nestLevel
,
"(field (name %s)"
,
out
->
Quote
w
(
m_Name
).
c_str
()
);
if
(
!
m_Value
.
IsEmpty
()
)
out
->
Print
(
0
,
"(value %s)"
,
out
->
Quote
d
(
m_Value
).
c_str
()
);
out
->
Print
(
0
,
"(value %s)"
,
out
->
Quote
w
(
m_Value
).
c_str
()
);
if
(
m_Visible
)
out
->
Print
(
0
,
" visible"
);
...
...
include/richio.h
View file @
1ae44d09
...
...
@@ -486,7 +486,7 @@ public:
}
/**
* Function Quote
d
* Function Quote
s
* checks \a aWrapee input string for a need to be quoted
* (e.g. contains a ')' character or a space), and for \" double quotes
* within the string that need to be escaped such that the DSNLEXER
...
...
@@ -500,13 +500,9 @@ public:
*
* @throw IO_ERROR, if there is any kind of problem with the input string.
*/
virtual
std
::
string
Quote
d
(
const
std
::
string
&
aWrapee
)
throw
(
IO_ERROR
);
virtual
std
::
string
Quote
s
(
const
std
::
string
&
aWrapee
)
throw
(
IO_ERROR
);
std
::
string
Quoted
(
const
wxString
&
aWrapee
)
throw
(
IO_ERROR
)
{
// s-expressions atoms are always encoded as UTF-8
return
Quoted
(
(
const
char
*
)
aWrapee
.
utf8_str
()
);
}
std
::
string
Quotew
(
const
wxString
&
aWrapee
)
throw
(
IO_ERROR
);
//-----</interface functions>-----------------------------------------
};
...
...
new/sch_lib_table.cpp
View file @
1ae44d09
...
...
@@ -157,10 +157,10 @@ void LIB_TABLE::ROW::Format( OUTPUTFORMATTER* out, int nestLevel ) const
throw
(
IO_ERROR
)
{
out
->
Print
(
nestLevel
,
"(lib (logical %s)(type %s)(full_uri %s)(options %s))
\n
"
,
out
->
Quote
d
(
logicalName
).
c_str
(),
out
->
Quote
d
(
libType
).
c_str
(),
out
->
Quote
d
(
fullURI
).
c_str
(),
out
->
Quote
d
(
options
).
c_str
()
out
->
Quote
s
(
logicalName
).
c_str
(),
out
->
Quote
s
(
libType
).
c_str
(),
out
->
Quote
s
(
fullURI
).
c_str
(),
out
->
Quote
s
(
options
).
c_str
()
);
}
...
...
pcbnew/pcb_plot_params.cpp
View file @
1ae44d09
...
...
@@ -134,7 +134,7 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter,
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %d)
\n
"
,
GetTokenName
(
T_scaleselection
),
scaleSelection
);
aFormatter
->
Print
(
aNestLevel
+
1
,
"(%s %s)
\n
"
,
GetTokenName
(
T_outputdirectory
),
aFormatter
->
Quote
d
(
CONV_TO_UTF8
(
outputDirectory
)
).
c_str
()
);
aFormatter
->
Quote
w
(
outputDirectory
).
c_str
()
);
aFormatter
->
Print
(
0
,
")
\n
"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment