DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
Tools.h
1
/* -*- mode: c++ -*- */
9
/*
10
* \@copyright This File is part of the Board library which is
11
* licensed under the terms of the GNU Lesser General Public Licence.
12
* See the LICENCE file for further details.
13
*/
14
#ifndef _BOARD_TOOLS_H_
15
#define _BOARD_TOOLS_H_
16
17
#include <iostream>
18
#include <ctime>
19
#include <cstring>
20
21
#define SHOW( V ) std::cerr << " " #V " = " << ( V ) << std::endl
22
23
namespace
LibBoard
{
24
29
class
MessageStream
{
30
public
:
31
32
inline
MessageStream
( std::ostream & out,
const
char
* prefix );
33
34
template
<
typename
T>
35
inline
MessageStream
operator<<
(
const
T & v );
36
37
private
:
38
std::ostream &
_out
;
39
const
char
*
_prefix
;
40
};
41
42
extern
MessageStream
error
;
43
extern
MessageStream
warning
;
44
extern
MessageStream
notice
;
45
46
MessageStream::MessageStream
( std::ostream & out,
const
char
* prefix )
47
:
_out
( out ),
48
_prefix
( prefix )
49
{
50
}
51
52
template
<
typename
T>
53
MessageStream
MessageStream::operator<<
(
const
T & v )
54
{
55
if
(
_prefix
)
56
_out
<<
_prefix
<< v;
57
else
58
_out
<< v;
59
return
MessageStream
(
_out
, 0 );
60
}
61
62
63
#if defined( _MSC_VER )
64
#define secured_sprintf sprintf_s
65
#else
66
#define secured_sprintf snprintf
67
#endif
// defined( _MSC_VER )
68
69
inline
void
secured_strncpy
(
char
* dst,
const
char
* src,
size_t
count );
70
inline
void
secured_ctime
(
char
* str,
const
time_t * t,
size_t
count );
71
72
}
73
74
#include "Tools.ih"
75
76
#endif
/* _SHAPE_H_ */
LibBoard::MessageStream
Definition
Tools.h:29
LibBoard::MessageStream::_out
std::ostream & _out
Definition
Tools.h:38
LibBoard::MessageStream::MessageStream
MessageStream(std::ostream &out, const char *prefix)
Definition
Tools.h:46
LibBoard::MessageStream::_prefix
const char * _prefix
Definition
Tools.h:39
LibBoard::MessageStream::operator<<
MessageStream operator<<(const T &v)
Definition
Tools.h:53
LibBoard
Definition
Board.cpp:86
LibBoard::warning
MessageStream warning
LibBoard::secured_ctime
void secured_ctime(char *str, const time_t *t, size_t count)
LibBoard::error
MessageStream error
LibBoard::notice
MessageStream notice
LibBoard::secured_strncpy
void secured_strncpy(char *dst, const char *src, size_t count)
src
Board
Tools.h
Generated on
for DGtal by
1.18.0