Systematic use of tm_ostream class instead of ostream (removing dependency on std)
[texmacs.git] / src / src / Typeset / Format / line_item.cpp
blobd7c97b9e14035f820385e2cfe822af39e0ae21ed
2 /******************************************************************************
3 * MODULE : line_item.cpp
4 * DESCRIPTION: Control routines for typesetting paragraphs
5 * COPYRIGHT : (C) 1999 Joris van der Hoeven
6 *******************************************************************************
7 * This software falls under the GNU general public license version 3 or later.
8 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
9 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
10 ******************************************************************************/
12 #include "formatter.hpp"
13 #include "Format/line_item.hpp"
15 /*****************************************************************************/
16 // Routines for the line item class
17 /*****************************************************************************/
19 line_item_rep::line_item_rep (int type2, box b2, int pen2):
20 type (type2), b (b2), spc (0), penalty (pen2), limits (false)
21 { TM_DEBUG(line_item_count++); }
22 line_item_rep::line_item_rep (int type2, box b2, int pen2, language lan2):
23 type (type2), b (b2), spc (0), penalty (pen2), limits (false),
24 lan (lan2) { TM_DEBUG(line_item_count++); }
25 line_item_rep::line_item_rep (int type2, box b2,
26 int pen2, tree t2):
27 type (type2), b (b2), spc (0), penalty (pen2), limits (false),
28 t (t2) { TM_DEBUG(line_item_count++); }
29 line_item_rep::~line_item_rep () {
30 TM_DEBUG(line_item_count--); }
31 line_item::line_item (int type, box b, int penalty):
32 rep (tm_new<line_item_rep> (type, b, penalty)) {}
33 line_item::line_item (int type, box b, int penalty, language lan):
34 rep (tm_new<line_item_rep> (type, b, penalty, lan)) {}
35 line_item::line_item (int type, box b, int penalty, tree t):
36 rep (tm_new<line_item_rep> (type, b, penalty, t)) {}
37 bool line_item::operator == (line_item item2) { return rep==item2.rep; }
38 bool line_item::operator != (line_item item2) { return rep!=item2.rep; }
40 tm_ostream&
41 operator << (tm_ostream& out, line_item item) {
42 switch (item->type) {
43 case OBSOLETE_ITEM: return out << "obsolete";
44 case CONTROL_ITEM: return out << "control (" << item->t << ")";
45 case STD_ITEM: return out << "std";
46 case STRING_ITEM: return out << item->b->get_leaf_string ();
47 case LEFT_BRACKET_ITEM:
48 return out << "left" << item->b->get_leaf_string ();
49 case MIDDLE_BRACKET_ITEM:
50 return out << "middle" << item->b->get_leaf_string ();
51 case RIGHT_BRACKET_ITEM:
52 return out << "right" << item->b->get_leaf_string ();
53 case FLOAT_ITEM:
54 return out << "float (" << item->b->get_leaf_lazy () << ")";
55 case LSUB_ITEM: return out << "lsub";
56 case LSUP_ITEM: return out << "lsup";
57 case RSUB_ITEM: return out << "rsub";
58 case RSUP_ITEM: return out << "rsup";
59 case GLUE_LEFT_ITEM: return out << "glue-left";
60 case GLUE_RIGHT_ITEM: return out << "glue-right";
61 case GLUE_BOTH_ITEM: return out << "glue-both";
62 case GLUE_LSUBS_ITEM: return out << "glue-lsubs";
63 case GLUE_RSUBS_ITEM: return out << "glue-rsubs";
65 return out << "unknown";