Changeset View
Changeset View
Standalone View
Standalone View
src/backends/julia/juliakeywords.h
Show All 15 Lines | |||||
16 | * | 16 | * | ||
17 | * --- | 17 | * --- | ||
18 | * Copyright (C) 2016 Ivan Lakhtanov <ivan.lakhtanov@gmail.com> | 18 | * Copyright (C) 2016 Ivan Lakhtanov <ivan.lakhtanov@gmail.com> | ||
19 | */ | 19 | */ | ||
20 | #pragma once | 20 | #pragma once | ||
21 | 21 | | |||
22 | #include <QStringList> | 22 | #include <QStringList> | ||
23 | 23 | | |||
24 | /** | ||||
25 | * Keywords storage for Julia session | ||||
26 | * | ||||
27 | * Class is implemented with singleton pattern | ||||
28 | */ | ||||
24 | class JuliaKeywords | 29 | class JuliaKeywords | ||
25 | { | 30 | { | ||
26 | public: | 31 | public: | ||
32 | /** | ||||
33 | * @return singleton instance pointer | ||||
34 | */ | ||||
27 | static JuliaKeywords *instance(); | 35 | static JuliaKeywords *instance(); | ||
28 | 36 | | |||
37 | /** | ||||
38 | * @return list of Julia language predefined keywords | ||||
39 | */ | ||||
29 | const QStringList &keywords() const { return m_keywords; } | 40 | const QStringList &keywords() const { return m_keywords; } | ||
41 | | ||||
42 | /** | ||||
43 | * @return list of predefined commands, that are capable to show plot | ||||
44 | */ | ||||
30 | const QStringList &plotShowingCommands() const | 45 | const QStringList &plotShowingCommands() const | ||
31 | { | 46 | { | ||
32 | return m_plotShowingCommands; | 47 | return m_plotShowingCommands; | ||
33 | } | 48 | } | ||
34 | 49 | | |||
50 | /** | ||||
51 | * @return list of known variable names | ||||
52 | */ | ||||
35 | const QStringList &variables() const { return m_variables; } | 53 | const QStringList &variables() const { return m_variables; } | ||
54 | | ||||
55 | /** | ||||
56 | * @return list of variables removed during the last clearVariables() call | ||||
57 | */ | ||||
36 | const QStringList &removedVariables() const { return m_removedVariables; } | 58 | const QStringList &removedVariables() const { return m_removedVariables; } | ||
59 | | ||||
60 | /** | ||||
61 | * Clears all known variables | ||||
62 | */ | ||||
37 | void clearVariables(); | 63 | void clearVariables(); | ||
64 | | ||||
65 | /** | ||||
66 | * Add new variable to the known list | ||||
67 | * | ||||
68 | * @param variable name of the variable to add | ||||
69 | */ | ||||
38 | void addVariable(const QString &variable); | 70 | void addVariable(const QString &variable); | ||
39 | 71 | | |||
72 | /** | ||||
73 | * @return list of known function names | ||||
74 | */ | ||||
40 | const QStringList &functions() const { return m_functions; } | 75 | const QStringList &functions() const { return m_functions; } | ||
76 | | ||||
77 | /** | ||||
78 | * @return list of functions removed during the last clearFunctions() call | ||||
79 | */ | ||||
41 | const QStringList &removedFunctions() const { return m_removedFunctions; } | 80 | const QStringList &removedFunctions() const { return m_removedFunctions; } | ||
81 | | ||||
82 | /** | ||||
83 | * Clears all known functions | ||||
84 | */ | ||||
42 | void clearFunctions(); | 85 | void clearFunctions(); | ||
86 | | ||||
87 | /** | ||||
88 | * Add new function to the known list | ||||
89 | * | ||||
90 | * @param function name of the function to add | ||||
91 | */ | ||||
43 | void addFunction(const QString &function); | 92 | void addFunction(const QString &function); | ||
44 | 93 | | |||
45 | private: | 94 | private: | ||
46 | QStringList m_keywords; | 95 | QStringList m_keywords; //< list of predefined keywords | ||
47 | QStringList m_plotShowingCommands; | 96 | QStringList m_plotShowingCommands; //< list of predefined plot showing cmds | ||
48 | QStringList m_variables; | 97 | QStringList m_variables; //< list of variables known at the moment | ||
49 | QStringList m_removedVariables; | 98 | QStringList m_removedVariables; //< list of variables removed during cleaning | ||
50 | QStringList m_functions; | 99 | QStringList m_functions; //< list of known function at the moment | ||
51 | QStringList m_removedFunctions; | 100 | QStringList m_removedFunctions; //< list of functions removed during cleaning | ||
52 | 101 | | |||
102 | // We are hidding constructor and destructor for singleton | ||||
53 | JuliaKeywords() {} | 103 | JuliaKeywords() {} | ||
54 | ~JuliaKeywords() {} | 104 | ~JuliaKeywords() {} | ||
55 | 105 | | |||
106 | /// Do first load of predefined stuff from keywords.xml | ||||
56 | void loadFromFile(); | 107 | void loadFromFile(); | ||
57 | }; | 108 | }; |