Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Base
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CoMISo
Base
Commits
1d6aa957
Commit
1d6aa957
authored
Mar 23, 2016
by
Max Lyon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove some c++11 features. intermediate commit.
parent
7d9f65ec
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
14 deletions
+54
-14
Debug/DebOut.hh
Debug/DebOut.hh
+20
-1
Debug/DebStream.cc
Debug/DebStream.cc
+21
-7
Utils/IOutputStream.hh
Utils/IOutputStream.hh
+13
-6
No files found.
Debug/DebOut.hh
View file @
1d6aa957
...
...
@@ -28,8 +28,12 @@
#include "Base/Utils/OStringStream.hh"
#include <string>
#include <sstream>
#include <vector>
#if (_MSC_VER >= 1900 || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__))
#include <array>
#endif
namespace
Debug
{
...
...
@@ -83,7 +87,7 @@ public:
public:
//! Constructor.
Stream
(
const
char
*
_flnm
=
nullptr
,
//!< [in] Filename if file based.
const
char
*
_flnm
=
NULL
,
//!< [in] Filename if file based.
const
uint
_flags
=
APPEND
//!< [in] bit-field type identifier
);
~
Stream
();
...
...
@@ -147,8 +151,23 @@ extern void error(const std::string& _err, const ::Base::CodeLink& _lnk);
// ostream streamer to DEB_out a class as text without exploiting any
// numeric processing or custom Stream streamers then use this macro thus
// DEB_out(1, "my_class is " << DEB_os_str(my_c) )
#if (_MSC_VER >= 1900 || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__))
#define DEB_os_str(AA) \
dynamic_cast<std::ostringstream &&>((std::ostringstream() << AA )).str()
#else
namespace
Debug
{
template
<
typename
T
>
std
::
string
toString
(
const
T
&
t
)
{
std
::
ostringstream
ss
;
ss
<<
t
;
return
ss
.
str
();
}
}
// namespace Debug
#define DEB_os_str(AA) \
Debug::toString(AA)
#endif
#endif // DEB_ON
...
...
Debug/DebStream.cc
View file @
1d6aa957
...
...
@@ -26,6 +26,10 @@
#define sprintf_s snprintf
#endif
#ifndef nullptr
#define nullptr NULL
#endif
namespace
{
// TODO: make this use std::string; check for html extension; case insensitive
...
...
@@ -85,7 +89,15 @@ void add_to_string(const Enter* _deb, std::string& _str,
if
(
!
_with_counts
)
_str
.
append
(
"*"
);
else
{
#if (_MSC_VER >= 1900 || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__))
_str
.
append
(
std
::
to_string
(
_deb
->
nmbr_
));
#else
std
::
stringstream
ss
;
ss
<<
_deb
->
nmbr_
;
_str
.
append
(
ss
.
str
());
#endif
}
_str
.
append
(
"]"
);
}
...
...
@@ -112,7 +124,7 @@ public:
const
Enter
*
call
(
int
_up
=
0
)
const
{
auto
num
=
calls_
.
size
();
int
num
=
calls_
.
size
();
if
(
_up
<
num
)
return
calls_
[
num
-
1
-
_up
];
else
...
...
@@ -228,8 +240,8 @@ public:
char
prev_char
()
const
{
if
(
!
current_
.
empty
())
return
current_
.
back
();
if
(
!
output_
.
empty
())
return
output_
.
back
();
if
(
!
current_
.
empty
())
return
*
current_
.
rbegin
();
if
(
!
output_
.
empty
())
return
*
output_
.
rbegin
();
return
'\0'
;
}
...
...
@@ -596,8 +608,9 @@ public:
int
permission
(
const
char
*
const
_flnm
)
{
int
lev
=
lev_
;
for
(
const
auto
&
fltrs
:
level_selc_map_
)
for
(
std
::
map
<
int
,
FilterLevelSelector
>::
const_iterator
fltrs_it
=
level_selc_map_
.
begin
();
fltrs_it
!=
level_selc_map_
.
end
();
++
fltrs_it
)
{
const
std
::
pair
<
int
,
FilterLevelSelector
>&
fltrs
=
*
fltrs_it
;
if
(
fltrs
.
second
.
select_file
(
_flnm
)
||
fltrs
.
second
.
select_function
(
call_stack_
.
call
()
->
fnct_
))
{
// continue this iteration until the maximum allowed level if found
...
...
@@ -615,7 +628,7 @@ public:
void
read_debug_config
()
{
const
auto
flnm
=
const
std
::
string
flnm
=
System
::
Environment
::
variable
(
"REFORM_DEB_CONFIG"
,
"reform_deb.cfg"
);
std
::
ifstream
deb_stream
(
flnm
.
c_str
());
...
...
@@ -664,7 +677,7 @@ private:
{
std
::
string
flnm
(
_flnm
);
const
std
::
string
root_dir
(
"ReForm"
);
auto
pos
=
flnm
.
rfind
(
root_dir
);
size_t
pos
=
flnm
.
rfind
(
root_dir
);
if
(
pos
!=
std
::
string
::
npos
)
flnm
=
flnm
.
substr
(
pos
+
root_dir
.
size
());
return
search
(
flnm
,
file_selct_strngs_
);
...
...
@@ -679,8 +692,9 @@ private:
static
bool
search
(
const
std
::
string
&
_flnm
,
const
std
::
list
<
std
::
string
>&
_sel_strings
)
{
for
(
const
auto
&
sel
:
_sel_strings
)
for
(
std
::
list
<
std
::
string
>::
const_iterator
sel_it
=
_sel_strings
.
begin
();
sel_it
!=
_sel_strings
.
end
();
++
sel_it
)
{
const
std
::
string
&
sel
=
*
sel_it
;
if
(
_flnm
.
find
(
sel
)
!=
std
::
string
::
npos
)
return
true
;
}
...
...
Utils/IOutputStream.hh
View file @
1d6aa957
...
...
@@ -5,7 +5,9 @@
#include <string>
#include <vector>
#if (_MSC_VER >= 1900 || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__))
#include <array>
#endif
namespace
boost
{
namespace
filesystem
{
...
...
@@ -75,12 +77,16 @@ template< typename ElementT>
IOutputStream
&
operator
<<
(
IOutputStream
&
_ds
,
const
std
::
vector
<
ElementT
>&
_vec
)
{
_ds
<<
"[ "
;
for
(
const
auto
el
:
_vec
)
for
(
typename
std
::
vector
<
ElementT
>::
const_iterator
el_it
=
_vec
.
begin
();
el_it
!=
_vec
.
end
();
++
el_it
)
{
const
ElementT
el
=
*
el_it
;
_ds
<<
el
<<
" "
;
}
_ds
<<
"]"
;
return
_ds
;
}
#if (_MSC_VER >= 1900 || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__))
// IStream operator for std::array<>
template
<
typename
ElementT
,
size_t
_el_nmbr
>
IOutputStream
&
operator
<<
(
IOutputStream
&
_ds
,
...
...
@@ -92,14 +98,15 @@ IOutputStream& operator<<(IOutputStream& _ds,
_ds
<<
"]"
;
return
_ds
;
}
#endif
// IStream operator for fixed size arrays
template
<
typename
ElementT
,
size_t
_el_nmbr
>
IOutputStream
&
operator
<<
(
IOutputStream
&
_ds
,
const
ElementT
(
&
_arr
)[
_el_nmbr
])
{
_ds
<<
"[ "
;
for
(
const
auto
el
:
_arr
)
_ds
<<
el
<<
" "
;
for
(
size_t
i
=
0
;
i
<
_el_nmbr
;
++
i
)
_ds
<<
_arr
[
i
]
<<
" "
;
_ds
<<
"]"
;
return
_ds
;
}
...
...
@@ -124,9 +131,9 @@ public:
#else
OutputStreamAdaptT
()
{}
//TODO: get rid of move constructor, cannot submit C++11 code in Base for now
OutputStreamAdaptT
(
OutputStreamAdaptT
&&
_oth
)
:
strm_
(
std
::
move
(
_oth
.
strm_
))
{}
//
//TODO: get rid of move constructor, cannot submit C++11 code in Base for now
//
OutputStreamAdaptT(OutputStreamAdaptT&& _oth) : strm_(std::move(_oth.strm_))
//
{}
template
<
typename
ArgT
>
OutputStreamAdaptT
(
const
ArgT
&
_arg
)
:
strm_
(
_arg
)
{}
...
...
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