~s-cecilio/lomse/master

« back to all changes in this revision

Viewing changes to src/internal_model/lomse_basic_model.cpp

  • Committer: cecilios
  • Date: 2010-10-10 13:35:19 UTC
  • Revision ID: git-v1:2b333198c3033525d15763b84eaf79dac9fdab80
Preparing to use CMake. Updating with new code and missing files. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//--------------------------------------------------------------------------------------
 
2
//  This file is part of the Lomse library.
 
3
//  Copyright (c) 2010 Lomse project
 
4
//
 
5
//  Lomse is free software; you can redistribute it and/or modify it under the
 
6
//  terms of the GNU General Public License as published by the Free Software Foundation,
 
7
//  either version 3 of the License, or (at your option) any later version.
 
8
//
 
9
//  Lomse is distributed in the hope that it will be useful, but WITHOUT ANY
 
10
//  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 
11
//  PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 
12
//
 
13
//  You should have received a copy of the GNU General Public License along
 
14
//  with Lomse; if not, see <http://www.gnu.org/licenses/>.
 
15
//  
 
16
//  For any comment, suggestion or feature request, please contact the manager of
 
17
//  the project at cecilios@users.sourceforge.net
 
18
//
 
19
//-------------------------------------------------------------------------------------
 
20
 
 
21
#include "lomse_basic_model.h"
 
22
 
 
23
#include "lomse_internal_model.h"
 
24
 
 
25
 
 
26
namespace lomse
 
27
{
 
28
 
 
29
 
 
30
//-------------------------------------------------------------------------------------
 
31
// InternalModel implementation
 
32
//-------------------------------------------------------------------------------------
 
33
 
 
34
InternalModel::InternalModel()
 
35
    : m_pRoot(NULL)
 
36
{
 
37
}
 
38
 
 
39
InternalModel::~InternalModel()
 
40
{
 
41
    if (m_pRoot)
 
42
        delete m_pRoot;
 
43
    delete_beams();
 
44
    delete_tuplets();
 
45
}
 
46
 
 
47
void InternalModel::delete_beams()
 
48
{
 
49
    std::list<ImoBeam*>::iterator it;
 
50
    for (it = m_beams.begin(); it != m_beams.end(); ++it)
 
51
        delete *it;
 
52
    m_beams.clear();
 
53
}
 
54
 
 
55
void InternalModel::delete_tuplets()
 
56
{
 
57
    std::list<ImoTuplet*>::iterator it;
 
58
    for (it = m_tuplets.begin(); it != m_tuplets.end(); ++it)
 
59
        delete *it;
 
60
    m_tuplets.clear();
 
61
}
 
62
 
 
63
 
 
64
}  //namespace lomse