GPL + CeCILL Header change
[scilab.git] / scilab / modules / ast / includes / ast / expHistory.hxx
1 /*
2  *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  *  Copyright (C) 2014 - Scilab Enterpprises - Cedric Delamarre
4  *
5  * Copyright (C) 2012 - 2016 - Scilab Enterprises
6  *
7  * This file is hereby licensed under the terms of the GNU GPL v2.0,
8  * pursuant to article 5.3.4 of the CeCILL v.2.1.
9  * This file was originally licensed under the terms of the CeCILL v2.1,
10  * and continues to be available under such terms.
11  * For more information, see the COPYING file which you should have received
12  * along with this program.
13  * === LICENSE_END ===
14  *
15  */
16
17 #ifndef __EXPHISTORY_HXX__
18 #define __EXPHISTORY_HXX__
19
20 #include <list>
21 #include <vector>
22 #include "types.hxx"
23 #include "ast.hxx"
24 #include "simplevar.hxx"
25
26 class ExpHistory
27 {
28 public :
29     ExpHistory();
30     ExpHistory(ExpHistory*, ast::SimpleVar*);
31     ExpHistory(ExpHistory*, types::typed_list*);
32     ExpHistory(ExpHistory*, ast::SimpleVar*, types::typed_list*, int, bool, types::InternalType*);
33
34     ~ExpHistory();
35
36     // expression "a"
37     void                    setExp(ast::SimpleVar*);
38     ast::SimpleVar*         getExp();
39     std::wstring            getExpAsString();
40
41     // arguments x of a(x)
42     void                    setArgs(types::typed_list*);
43     types::typed_list*      getArgs();
44     int                     getSizeFromArgs();
45     int                     getArgsDims();
46     int*                    getArgsDimsArray();
47     void                    computeArgs();
48     bool                    needResize();
49     void                    setArgsOwner(bool);
50     void                    setExpOwner(bool);
51
52     // current InternalType a
53     bool                    setCurrent(types::InternalType*);
54     types::InternalType*    getCurrent();
55     void                    setDeleteCurrent(bool bDelete); // false by default
56
57     // parent of me
58     ExpHistory*             getParent();
59
60     // use to know if we have to reinsert current in there parent and where
61     void                    setReinsertion(bool bForce = false);
62     void                    resetReinsertion();
63     bool                    reinsertMe();
64     int                     getWhereReinsert();
65     void                    setWhereReinsert(int);
66
67     // use to know where we are in expression
68     void                    setLevel(int);
69     int                     getLevel();
70
71     // management of expression a(x) or a{x}
72     void                    setCellExp();
73     bool                    isCellExp();
74
75 private :
76
77     void                    initHistory();
78
79     types::typed_list*      m_pArgs;
80     int*                    m_piArgsDimsArray;
81     ast::SimpleVar*         m_pExp;
82     ExpHistory*             m_pParent;
83     types::InternalType*    m_pITCurrent;
84     bool                    m_bReinsertMe;
85     bool                    m_bCellExp;
86     int                     m_iArgsDims;
87     int                     m_iWhere;
88     int                     m_iLevel;
89     bool                    m_pArgsOwner;
90     bool                    m_pExpOwner;
91     bool                    m_bDeleteCurrent;
92
93 };
94
95 #endif /* __EXPHISTORY_HXX__ */