Back to index

texmacs  1.0.7.15
line_item.cpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : line_item.cpp
00004 * DESCRIPTION: Control routines for typesetting paragraphs
00005 * COPYRIGHT  : (C) 1999  Joris van der Hoeven
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00010 ******************************************************************************/
00011 
00012 #include "formatter.hpp"
00013 #include "Format/line_item.hpp"
00014 
00015 /*****************************************************************************/
00016 // Routines for the line item class
00017 /*****************************************************************************/
00018 
00019 line_item_rep::line_item_rep (int ty2, int ot2, box b2, int pen2):
00020   type (ty2), op_type (ot2), b (b2),
00021   spc (0), penalty (pen2), limits (false)
00022     { TM_DEBUG(line_item_count++); }
00023 line_item_rep::line_item_rep (int ty2, int ot2, box b2, int pen2, language l2):
00024   type (ty2), op_type (ot2), b (b2),
00025   spc (0), penalty (pen2), limits (false),
00026   lan (l2) { TM_DEBUG(line_item_count++); }
00027 line_item_rep::line_item_rep (int ty2, int ot2, box b2, int pen2, tree t2):
00028   type (ty2), op_type (ot2), b (b2),
00029   spc (0), penalty (pen2), limits (false), t (t2)
00030     { TM_DEBUG(line_item_count++); }
00031 line_item_rep::~line_item_rep () {
00032   TM_DEBUG(line_item_count--); }
00033 line_item::line_item (int type, int ot_type, box b, int penalty):
00034   rep (tm_new<line_item_rep> (type, ot_type, b, penalty)) {}
00035 line_item::line_item (int type, int ot_type, box b, int penalty, language lan):
00036   rep (tm_new<line_item_rep> (type, ot_type, b, penalty, lan)) {}
00037 line_item::line_item (int type, int ot_type, box b, int penalty, tree t):
00038   rep (tm_new<line_item_rep> (type, ot_type, b, penalty, t)) {}
00039 bool line_item::operator == (line_item item2) { return rep == item2.rep; }
00040 bool line_item::operator != (line_item item2) { return rep != item2.rep; }
00041 
00042 tm_ostream&
00043 operator << (tm_ostream& out, line_item item) {
00044   switch (item->type) {
00045   case OBSOLETE_ITEM: return out << "obsolete";
00046   case STD_ITEM: return out << "std";
00047   case MARKER_ITEM: return out << "marker";
00048   case STRING_ITEM: return out << item->b->get_leaf_string ();
00049   case LEFT_BRACKET_ITEM:
00050     return out << "left" << item->b->get_leaf_string ();
00051   case MIDDLE_BRACKET_ITEM:
00052     return out << "middle" << item->b->get_leaf_string ();
00053   case RIGHT_BRACKET_ITEM:
00054     return out << "right" << item->b->get_leaf_string ();
00055   case CONTROL_ITEM: return out << "control (" << item->t << ")";
00056   case FLOAT_ITEM:
00057     return out << "float (" << item->b->get_leaf_lazy () << ")";
00058   case LSUB_ITEM: return out << "lsub";
00059   case LSUP_ITEM: return out << "lsup";
00060   case RSUB_ITEM: return out << "rsub";
00061   case RSUP_ITEM: return out << "rsup";
00062   case GLUE_LEFT_ITEM: return out << "glue-left";
00063   case GLUE_RIGHT_ITEM: return out << "glue-right";
00064   case GLUE_BOTH_ITEM: return out << "glue-both";
00065   case GLUE_LSUBS_ITEM: return out << "glue-lsubs";
00066   case GLUE_RSUBS_ITEM: return out << "glue-rsubs";
00067   }
00068   return out << "unknown";
00069 }