Context.inl
Go to the documentation of this file.
1 namespace iv
2 {
3 
4 template< class T, class ... TT >
5 void Context::WriteItemsToStream( multiline_ostream & mss, T const & first, TT const & ... rest ) const
6 {
7  // first
8  mss.multiline_begin();
9  mss << StringIO_Write( first, this );
10  mss.multiline_end();
11 
12  // rest
13  this->WriteItemsToStream( mss, rest ... );
14 }
15 
16 template< class ... TT >
17 void Context::WriteItemsToStream( multiline_ostream & mss, Endl, TT const & ... rest ) const
18 {
19  // endl
20  mss << std::endl;
21 
22  // rest
23  this->WriteItemsToStream( mss, rest ... );
24 }
25 
26 template< class ... TT >
27 void Context::WriteItemsToStream( multiline_ostream & mss, Begin, TT const & ... rest ) const
28 {
29  // begin
30  mss.multiline_begin();
31 
32  // rest
33  this->WriteItemsToStream( mss, rest ... );
34 }
35 
36 template< class ... TT >
37 void Context::WriteItemsToStream( multiline_ostream & mss, End, TT const & ... rest ) const
38 {
39  // end
40  mss.multiline_end();
41 
42  // rest
43  this->WriteItemsToStream( mss, rest ... );
44 }
45 
46 template< class ... Items >
47 void Context::log( SrcInfo const & info, LogId id, Items const & ... items ) const
48 {
49  if( !this->log_enabled( id ) )
50  return;
51 
52  this->mss.clear();
53  this->ss.str( "" );
54  this->ss.clear();
55 
56  this->WriteItemsToStream( this->mss, items ... );
57 
58  this->log_process( info, id, this->ss.str() );
59 
60  this->mss.clear();
61  this->ss.str( "" );
62  this->ss.clear();
63 }
64 
65 template< class ... Items >
66 void Context::warning( SrcInfo const & info, Items const & ... items ) const
67 {
68  this->log( info, ::iv::Defs::Log::Warning, items ... );
69 }
70 
71 }