~s-cecilio/lomse/master

« back to all changes in this revision

Viewing changes to include/lomse_ldp_exporter.h

  • 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
//  
 
17
//
 
18
//  For any comment, suggestion or feature request, please contact the manager of
 
19
//  the project at cecilios@users.sourceforge.net
 
20
//
 
21
//-------------------------------------------------------------------------------------
 
22
 
 
23
#ifndef __LOMSE__LDP_EXPORTER_H__        //to avoid nested includes
 
24
#define __LOMSE__LDP_EXPORTER_H__
 
25
 
 
26
#include <sstream>
 
27
 
 
28
using namespace std;
 
29
 
 
30
namespace lomse
 
31
{
 
32
 
 
33
//forward declarations
 
34
class ImoObj;
 
35
class LdpGenerator;
 
36
struct rgba16;
 
37
 
 
38
 
 
39
// LdpExporter: Generates LDP source code for a basic model object
 
40
//----------------------------------------------------------------------------------
 
41
class LdpExporter
 
42
{
 
43
protected:
 
44
    int m_nIndent;
 
45
    bool m_fAddId;
 
46
 
 
47
public:
 
48
    LdpExporter();
 
49
    virtual ~LdpExporter();
 
50
 
 
51
    //settings
 
52
    void set_indent(int value) { m_nIndent = value; }
 
53
    void set_add_id(bool value) { m_fAddId = value; }
 
54
 
 
55
    //getters for settings
 
56
    inline int get_indent() { return m_nIndent; }
 
57
    inline bool get_add_id() { return m_fAddId; }
 
58
 
 
59
    //the main method
 
60
    std::string get_source(ImoObj* pImo);
 
61
 
 
62
    //static methods for ldp names to types conversion
 
63
    static std::string clef_type_to_ldp(int clefType);
 
64
    static std::string color_to_ldp(rgba16& color);
 
65
    static std::string float_to_string(float num);
 
66
 
 
67
protected:
 
68
    LdpGenerator* new_generator(ImoObj* pImo);
 
69
 
 
70
};
 
71
 
 
72
 
 
73
}   //namespace lomse
 
74
 
 
75
#endif    // __LOMSE__LDP_EXPORTER_H__
 
76