X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Ftex-stream.cc;h=a9d826c3c77b522e91793dc7e95037a67c551b9b;hb=95246e47228482fbd2a99ec2d7f5d52b35cb545a;hp=2c92ae7438e0d95a92dc5a06e4334e236f1282d6;hpb=04f01c7e890bd4f1b358378e5911fb7c117c3802;p=lilypond.git diff --git a/lily/tex-stream.cc b/lily/tex-stream.cc index 2c92ae7438..a9d826c3c7 100644 --- a/lily/tex-stream.cc +++ b/lily/tex-stream.cc @@ -9,7 +9,7 @@ make an abstract interface to output, operations: - move(x,y), put(symbol). + move (x,y), put (symbol). */ #include @@ -22,46 +22,49 @@ const int MAXLINELEN = 200; -Tex_stream::Tex_stream(String filename) +Tex_stream::Tex_stream (String filename) { - os = new ofstream(filename); - if (!*os) - error("can't open `" + filename+"\'"); - nest_level = 0; - line_len_i_ = 0; - outputting_comment=false; - header(); + os = new ofstream (filename); + if (!*os) + error ("can't open `" + filename+"\'"); + nest_level = 0; + line_len_i_ = 0; + outputting_comment=false; + header(); } void Tex_stream::header() { - *os << "% Creator: " << get_version_str() << "\n"; - *os << "% Automatically generated, at "; - time_t t(time(0)); - *os << ctime(&t)<<"\n"; + *os << "% Creator: " << get_version_str() << "\n"; + *os << "% Automatically generated, at "; + time_t t (time (0)); + *os << ctime (&t)<<"\n"; } Tex_stream::~Tex_stream() { - delete os; - assert(nest_level == 0); + delete os; + assert (nest_level == 0); } // print string. don't forget indent. Tex_stream & Tex_stream::operator<<(String s) { - - for (char const *cp = s; *cp; cp++) { - if (outputting_comment) { + + for (char const *cp = s; *cp; cp++) + { + if (outputting_comment) + { *os << *cp; - if (*cp == '\n') { + if (*cp == '\n') + { outputting_comment=false; - } + } continue; - } + } line_len_i_ ++; - switch(*cp) + switch (*cp) { case '%': outputting_comment = true; @@ -75,10 +78,11 @@ Tex_stream::operator<<(String s) nest_level--; *os << *cp; - if (nest_level < 0) { + if (nest_level < 0) + { delete os; // we want to see the remains. - assert(nest_level>=0); - } + assert (nest_level>=0); + } /* FALLTHROUGH */ case '\n': @@ -93,17 +97,17 @@ Tex_stream::operator<<(String s) default: *os << *cp; break; - } + } } - return *this; + return *this; } void Tex_stream::break_line() { - *os << "%\n"; - *os << String(' ', nest_level); - line_len_i_ = 0; + *os << "%\n"; + *os << String (' ', nest_level); + line_len_i_ = 0; } /* *************************************************************** */