]> git.donarmstrong.com Git - lilypond.git/blobdiff - src/request.cc
release: 0.0.28
[lilypond.git] / src / request.cc
index c6ff787c668fd172a72e925c39e89b59d2cf1436..0a5c8dc3d842fdd9661cddf86e8e53f5226d648e 100644 (file)
 
 #include "inputcommand.hh"
 
-#define VIRTUALCONS(T,R) R *T::clone() const { return  new T(*this); } struct T
-#define RCONS(T) VIRTUALCONS(T, Request)
-
-RCONS(Rest_req);
-RCONS(Barcheck_req);
-RCONS(Text_req);
-RCONS(Rhythmic_req);
-RCONS(Lyric_req);
-RCONS(Mark_req);
-RCONS(Stem_req);
-RCONS(Script_req);
-RCONS(Note_req);
-RCONS(Melodic_req);
-RCONS(Span_req);
-RCONS(Slur_req);
-RCONS(Beam_req);
-RCONS(Staff_command_req);
-
 void
-Stem_req::print() const
+Stem_req::do_print() const
+{
+    Rhythmic_req::do_print();
+    mtor << "dir : " << dir_i_;
+}
+
+Stem_req::Stem_req(int s, int d)
+    : Rhythmic_req(s,d)
 {
-    mtor << "Stem\n";
+    dir_i_ = 0;
 }
+
 /****************/
 void
-Barcheck_req::print() const    
+Barcheck_req::do_print() const    
 {
 #ifndef NPRINT
-    mtor << "Barcheck\n";
+
 #endif
 }
+
 /****************/
+
 void
-Request::print() const    
+Request::print() const
+
+{
+    mtor << name() << " {";
+    do_print();
+    mtor << "}\n";
+}
+     
+
+void
+Request::do_print() const    
 {
 #ifndef NPRINT
-    mtor << "Req{ unknown }\n";
 #endif
 }
 
 void
-Span_req::print() const    
+Span_req::do_print() const    
 {
 #ifndef NPRINT
-    mtor << "Span_req {" << spantype << "}\n";
+    mtor  << spantype ;
 #endif
 }
 
 Request::Request()
 {
     elt_l_ = 0;
+    defined_ch_c_l_m = 0;
 }
-Request::Request(Request const&)
+Request::Request(Request const&src)
 {
     elt_l_ = 0;
+    defined_ch_c_l_m = src.defined_ch_c_l_m;
+}
+/****************/
+Spacing_req::Spacing_req()
+{
+    next = 0;
+    distance = 0;
+    strength = 0;
+}
+void
+Spacing_req::do_print()const
+{
+    mtor << "next " << next << "dist " << distance << "strength\n";
+}
+void
+Blank_req::do_print()const
+{
+    Spacing_req::do_print();
 }
 /****************/
 Melodic_req::Melodic_req()
 {
-    name = 0;
+    notename = 0;
     octave = 0;
     accidental = 0;
     forceacc = false;
 }
 
 void
-Melodic_req::print() const
+Melodic_req::do_print() const
 {
-    mtor << "note: " << name << " oct: "<< octave;
+    mtor << "notename: " << notename << " oct: "<< octave;
 }
 
 int
 Melodic_req::height() const
 {
-    return  name + octave*7;
+    return  notename + octave*7;
 }
 
 /****************/
+int
+Rhythmic_req::compare(const Rhythmic_req &r1, const Rhythmic_req &r2)
+{
+    return r1.duration() - r2.duration();
+}
+Rhythmic_req::Rhythmic_req(int b, int d)
+{
+    plet_factor = 1;
+    balltype = b;
+    dots = d;
+}
+
 Rhythmic_req::Rhythmic_req()
 {
     plet_factor = 1;
@@ -92,9 +124,9 @@ Rhythmic_req::Rhythmic_req()
 }
 
 void
-Rhythmic_req::print() const
+Rhythmic_req::do_print() const
 {
-    mtor << "rhythmic: " << balltype ;
+    mtor << "ball: " << balltype ;
     int d =dots;
     while (d--)
        mtor << '.';
@@ -117,63 +149,104 @@ Lyric_req::Lyric_req(Text_def* def_p)
 }
 
 void
-Lyric_req::print() const
-{
-    mtor << "lyric: ";
-    Rhythmic_req::print();
-    Text_req::print();
+Lyric_req::do_print() const
+{    
+    Rhythmic_req::do_print();
+    Text_req::do_print();
 }
 /****************/
 void
-Note_req::print() const
+Note_req::do_print() const
 {
-    Melodic_req::print();
-    Rhythmic_req::print();
+    Melodic_req::do_print();
+    Rhythmic_req::do_print();
 }
 /****************/
 void
-Rest_req::print() const
+Rest_req::do_print() const
 {
-    mtor << "rest, " ;
-    Rhythmic_req::print();
+        Rhythmic_req::do_print();
 }
+
 /****************/
 Beam_req::Beam_req()
 {
     nplet = 0;
 }
+
+void Beam_req::do_print()const{}
+/****************/
+void Slur_req::do_print()const{}
 /****************/
+int
+Span_req:: compare(const Span_req &r1, const Span_req &r2)
+{
+     return r1.spantype - r2.spantype;
+}
+
 Span_req::Span_req()
 {
     spantype = NOSPAN;
 }
 /****************/
+void
+Group_feature_req::do_print() const
+{
+    mtor << "stemdir " << stemdir_i_;
+}
+Group_feature_req::Group_feature_req()
+{
+    stemdir_i_ = 0;
+}
+void
+Group_change_req::do_print()const
+{
+    mtor << "id : " << newgroup_str_;
+}
+void
+Terminate_voice_req::do_print()const
+{
+}
+/****************/
 Script_req::Script_req(int d , Script_def*def)
 {
-    dir = d;
-    scriptdef = def;
+    dir_i_ = d;
+    scriptdef_p_ = def;
+}
+
+int
+Script_req::compare(const Script_req &d1, const Script_req &d2)
+{
+    return d1.dir_i_ == d2.dir_i_ &&
+       d1.scriptdef_p_->compare(*d2.scriptdef_p_);
 }
 
 Script_req::Script_req(Script_req const &s)
 {
-    dir = s.dir;
-    scriptdef = new Script_def(*s.scriptdef);
+    dir_i_ = s.dir_i_;
+    scriptdef_p_ = new Script_def(*s.scriptdef_p_);
 }
 
 void
-Script_req::print() const
+Script_req::do_print() const
 {
-    mtor << " dir " << dir ;
-    scriptdef->print();
+    mtor << " dir " << dir_i_ ;
+    scriptdef_p_->print();
 }
 
 
 Script_req::~Script_req()
 {
-    delete scriptdef;
+    delete scriptdef_p_;
 }
 /****************/
-
+int
+Text_req:: compare(const Text_req &r1, const Text_req &r2)
+{
+    bool b1 = (r1.dir_i_ == r2.dir_i_);
+    bool b2 = (r1.tdef_p_ ->compare(*r2.tdef_p_));
+    return b1 && b2;
+}
 Text_req::~Text_req()
 {
     delete tdef_p_;
@@ -193,7 +266,7 @@ Text_req::Text_req(int dir_i, Text_def* tdef_p)
 }
 
 void
-Text_req::print() const
+Text_req::do_print() const
 {
     mtor << " dir " << dir_i_ ;
     tdef_p_->print();
@@ -209,10 +282,10 @@ Mark_req::Mark_req(String s)
 }
 
 void
-Mark_req::print()const
+Mark_req::do_print()const
 {
 #ifndef NDEBUG
-    mtor<< "Mark `" << mark_str_ << "\'\n";
+    mtor<< " `" << mark_str_ << "\'\n";
 #endif
 }
 /****************/
@@ -229,9 +302,8 @@ Staff_command_req::Staff_command_req(Staff_command_req const&src)
     com_p_ = new Input_command(*src.com_p_);
 }
 void
-Staff_command_req::print()const
+Staff_command_req::do_print()const
 {
-    mtor << "Command request: " ;
     com_p_->print();
 }