Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CoMISo
Base
Commits
06f91cdd
Commit
06f91cdd
authored
Mar 16, 2020
by
Martin Marinov
Browse files
Remove struct and class from the Boost-generated type_name string
parent
cfcdeaf6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Journal/JournalCppDefs.cc
View file @
06f91cdd
...
...
@@ -24,13 +24,26 @@ namespace Cpp
{
#ifdef JOURNAL_USE_BOOST
template
<
size_t
n
>
void
erase_start_substring
(
String
&
_str
,
const
char
(
&
_substr
)[
n
])
{
if
(
_str
.
rfind
(
_substr
,
0
)
==
0
)
// is _substr at the start?
_str
.
erase
(
0
,
n
-
1
);
}
void
filter_type_name
(
String
&
_type_name
)
{
erase_start_substring
(
_type_name
,
"struct "
);
erase_start_substring
(
_type_name
,
"class "
);
#ifdef _MSC_VER
// on MSVC, pointer types contain __ptr64 which is MSVC only, so filter it out
const
char
PTR64_STR
[]
=
" __ptr64"
;
const
auto
pos
=
_type_name
.
find
(
PTR64_STR
);
if
(
pos
!=
String
::
npos
)
_type_name
.
erase
(
pos
,
sizeof
(
PTR64_STR
)
-
1
);
#endif // _MSC_VER
}
#endif
...
...
Journal/JournalCppDefs.hh
View file @
06f91cdd
...
...
@@ -34,10 +34,7 @@ void filter_type_name(String& _type_name);
template
<
class
T
>
String
type_name
()
{
auto
str
=
boost
::
core
::
demangled_name
(
BOOST_CORE_TYPEID
(
T
));
#ifdef _MSC_VER
// on MSVC, pointer types contain __ptr64 which is MSVC only, so filter it out
filter_type_name
(
str
);
#endif // _MSC_VER
filter_type_name
(
str
);
// apply some filtering to fix & simplify type names
return
str
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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