lilypond-0.0.77.jcn1
[lilypond.git] / src / lily-stream.cc
blob4b7948142424473c27c879b86a3cdf70b3eddd6e
1 //
2 // lily-stream.cc
3 //
4 // source file of the LilyPond music typesetter
5 //
6 // (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
8 // should i be named Mudela_stream?
10 #include <fstream.h>
11 #include <time.h>
13 #include "proto.hh"
14 #include "plist.hh"
15 #include "string.hh"
17 #include "moment.hh"
18 #include "source-file.hh"
19 #include "source.hh"
20 #include "midi-main.hh" // *tors
22 #include "duration.hh"
23 #include "midi-event.hh"
24 #include "lily-stream.hh"
26 Lily_stream::Lily_stream( String filename_str )
28 filename_str_ = filename_str;
29 os_p_ = 0;
30 open();
31 header();
34 Lily_stream::~Lily_stream()
36 delete os_p_;
39 Lily_stream&
40 Lily_stream::operator <<( String str )
42 *os_p_ << str;
43 return *this;
46 Lily_stream&
47 Lily_stream::operator <<( Midi_event& midi_event_r )
49 midi_event_r.output_mudela( *this );
50 return *this;
53 void
54 Lily_stream::header()
56 *os_p_ << "% Creator: " << version_str() << "\n";
57 *os_p_ << "% Automatically generated, at ";
58 time_t t( time( 0 ) );
59 *os_p_ << ctime( &t );
60 *os_p_ << "% from input file: ";
61 // *os_p_ << midi_parser_l_g->
62 *os_p_ << "\n\n";
65 void
66 Lily_stream::open()
68 os_p_ = new ofstream( filename_str_ );
69 if ( !*os_p_ )
70 error ( "can't open `" + filename_str_ + "\'", 0 );