summaryrefslogtreecommitdiffstats
path: root/src/kqalculate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kqalculate.cpp')
-rw-r--r--src/kqalculate.cpp69
1 files changed, 36 insertions, 33 deletions
diff --git a/src/kqalculate.cpp b/src/kqalculate.cpp
index c48c350..8d2b834 100644
--- a/src/kqalculate.cpp
+++ b/src/kqalculate.cpp
@@ -79,6 +79,9 @@
#include <math.h>
#include <dirent.h>
#include <pthread.h>
+#include <vector>
+#include <string>
+#include <stack>
#include <tqsimplerichtext.h>
#include <tqstatusbar.h>
#include <tqwidgetstack.h>
@@ -139,11 +142,11 @@ extern bool enable_expression_completion;
extern TQString initial_history;
extern tree_struct function_cats, unit_cats, variable_cats;
-extern vector<void*> ia_units, ia_variables, ia_functions;
-extern vector<MathFunction*> recent_functions;
-extern vector<Variable*> recent_variables;
-extern vector<Unit*> recent_units;
-vector<MathStructure> result_parts;
+extern std::vector<void*> ia_units, ia_variables, ia_functions;
+extern std::vector<MathFunction*> recent_functions;
+extern std::vector<Variable*> recent_variables;
+extern std::vector<Unit*> recent_units;
+std::vector<MathStructure> result_parts;
KnownVariable *vans[5];
int vans_id_start[5];
@@ -174,7 +177,7 @@ uint initial_result_index = 0;
extern bool show_keypad, show_history, show_stack;
-extern vector<mode_struct> modes;
+extern std::vector<mode_struct> modes;
extern TQValueVector<TQString> inhistory;
extern TQValueVector<int> inhistory_type;
@@ -1416,7 +1419,7 @@ TQString draw_structure(MathStructure &m, const TQFont &font, const TQColorGroup
if(m.precision() > 0 && (ips_n.parent_precision < 1 || m.precision() < ips_n.parent_precision)) ips_n.parent_precision = m.precision();
switch(m.type()) {
case STRUCT_NUMBER: {
- string exp = "";
+ std::string exp = "";
bool exp_minus;
ips_n.exp = &exp;
ips_n.exp_minus = &exp_minus;
@@ -1465,8 +1468,8 @@ TQString draw_structure(MathStructure &m, const TQFont &font, const TQColorGroup
ips_n.depth++;
- vector<TQString> terms;
- vector<bool> do_space;
+ std::vector<TQString> terms;
+ std::vector<bool> do_space;
for(size_t i = 0; i < m.size(); i++) {
if(m[i].type() == STRUCT_NEGATE && i > 0) {
ips_n.wrap = m[i][0].needsParenthesis(po, ips_n, m, i + 1, ips.division_depth > 0 || ips.power_depth > 0, ips.power_depth > 0);
@@ -1526,9 +1529,9 @@ TQString draw_structure(MathStructure &m, const TQFont &font, const TQColorGroup
}
bool par_prev = false;
- vector<int> nm;
- vector<TQString> terms;
- vector<bool> do_space;
+ std::vector<int> nm;
+ std::vector<TQString> terms;
+ std::vector<bool> do_space;
for(size_t i = 0; i < m.size(); i++) {
ips_n.wrap = m[i].needsParenthesis(po, ips_n, m, i + 1, ips.division_depth > 0 || ips.power_depth > 0, ips.power_depth > 0);
terms.push_back(draw_structure(m[i], font, cg, po, ips_n));
@@ -1647,7 +1650,7 @@ TQString draw_structure(MathStructure &m, const TQFont &font, const TQColorGroup
h = (int) (textsmall.height() / 1.5);
h += h % 2;
- string filename = getLocalDir();
+ std::string filename = getLocalDir();
if(saved_divisionline_height != h) {
TQPixmap *pixmap = new TQPixmap(10, h);
@@ -1974,11 +1977,11 @@ TQString draw_structure(MathStructure &m, const TQFont &font, const TQColorGroup
TQString str;
const ExpressionName *ename = &m.unit()->preferredDisplayName(po.abbreviate_names, po.use_unicode_signs, m.isPlural(), po.use_reference_names, po.can_display_unicode_string_function, po.can_display_unicode_string_arg);
if(m.prefix()) {
- str += m.prefix()->name(po.abbreviate_names && ename->abbreviation && (ename->suffix || ename->name.find("_") == string::npos), po.use_unicode_signs, po.can_display_unicode_string_function, po.can_display_unicode_string_arg).c_str();
+ str += m.prefix()->name(po.abbreviate_names && ename->abbreviation && (ename->suffix || ename->name.find("_") == std::string::npos), po.use_unicode_signs, po.can_display_unicode_string_function, po.can_display_unicode_string_arg).c_str();
}
if(ename->suffix && ename->name.length() > 1) {
size_t i = ename->name.rfind('_');
- bool b = i == string::npos || i == ename->name.length() - 1 || i == 0;
+ bool b = i == std::string::npos || i == ename->name.length() - 1 || i == 0;
size_t i2 = 1;
if(b) {
if(is_in(NUMBERS, ename->name[ename->name.length() - 1])) {
@@ -2026,7 +2029,7 @@ TQString draw_structure(MathStructure &m, const TQFont &font, const TQColorGroup
const ExpressionName *ename = &m.variable()->preferredDisplayName(po.abbreviate_names, po.use_unicode_signs, false, po.use_reference_names, po.can_display_unicode_string_function, po.can_display_unicode_string_arg);
if(ename->suffix && ename->name.length() > 1) {
size_t i = ename->name.rfind('_');
- bool b = i == string::npos || i == ename->name.length() - 1 || i == 0;
+ bool b = i == std::string::npos || i == ename->name.length() - 1 || i == 0;
size_t i2 = 1;
if(b) {
if(is_in(NUMBERS, ename->name[ename->name.length() - 1])) {
@@ -2077,7 +2080,7 @@ TQString draw_structure(MathStructure &m, const TQFont &font, const TQColorGroup
const ExpressionName *ename = &m.function()->preferredDisplayName(po.abbreviate_names, po.use_unicode_signs, false, po.use_reference_names, po.can_display_unicode_string_function, po.can_display_unicode_string_arg);
if(ename->suffix && ename->name.length() > 1) {
size_t i = ename->name.rfind('_');
- bool b = i == string::npos || i == ename->name.length() - 1 || i == 0;
+ bool b = i == std::string::npos || i == ename->name.length() - 1 || i == 0;
size_t i2 = 1;
if(b) {
if(is_in(NUMBERS, ename->name[ename->name.length() - 1])) {
@@ -2326,7 +2329,7 @@ void *view_proc(void *pipe) {
if(mm && m.isMatrix()) {
mm->set(m);
MathStructure mm2(m);
- string mstr;
+ std::string mstr;
int c = mm->columns(), r = mm->rows();
for(int index_r = 0; index_r < r; index_r++) {
for(int index_c = 0; index_c < c; index_c++) {
@@ -2422,7 +2425,7 @@ void reduceDivLineSize(QalculateResultDisplay *resultLabel) {
h = (int) (textsmall.height() / 1.5);
h += h % 2;
- string filename = getLocalDir();
+ std::string filename = getLocalDir();
if(saved_divisionline_height != h) {
TQPixmap *pixmap = new TQPixmap(10, h);
@@ -3030,7 +3033,7 @@ void KQalculate::execute_expression2() {
if(f) CALCULATOR->calculateRPN(f, 0, evalops, parsed_mstruct);
else CALCULATOR->calculateRPN(op, 0, evalops, parsed_mstruct);
} else {
- string str2 = CALCULATOR->unlocalizeExpression(str.ascii(), evalops.parse_options);
+ std::string str2 = CALCULATOR->unlocalizeExpression(str.ascii(), evalops.parse_options);
CALCULATOR->parseSigns(str2);
if(str2.length() == 1) {
do_mathoperation = true;
@@ -3291,13 +3294,13 @@ void KQalculate::create_vmenu() {
menu_variables_ids.clear();
- stack<TQPopupMenu*> menus;
+ std::stack<TQPopupMenu*> menus;
menus.push(sub);
sub3 = sub;
while(titem) {
sub = new TQPopupMenu();
TQObject::connect(sub, SIGNAL(activated(int)), this, SLOT(onVariableMenuItemActivated(int)));
- if(titem->item.find('&') != string::npos) {
+ if(titem->item.find('&') != std::string::npos) {
TQString str2 = titem->item.c_str();
str2.replace("&", "&&");
sub3->insertItem(str2, sub, -1, 0);
@@ -3309,7 +3312,7 @@ void KQalculate::create_vmenu() {
for(size_t i = 0; i < titem->objects.size(); i++) {
v = (Variable*) titem->objects[i];
if(v->isActive() && !v->isHidden()) {
- if(v->title(true).find('&') != string::npos) {
+ if(v->title(true).find('&') != std::string::npos) {
TQString str2 = v->title(true).c_str();
str2.replace("&", "&&");
menu_variables_ids[sub->insertItem(str2)] = v;
@@ -3386,13 +3389,13 @@ void KQalculate::create_fmenu() {
menu_functions_ids.clear();
- stack<TQPopupMenu*> menus;
+ std::stack<TQPopupMenu*> menus;
menus.push(sub);
sub3 = sub;
while(titem) {
sub = new TQPopupMenu();
TQObject::connect(sub, SIGNAL(activated(int)), this, SLOT(onFunctionMenuItemActivated(int)));
- if(titem->item.find('&') != string::npos) {
+ if(titem->item.find('&') != std::string::npos) {
TQString str2 = titem->item.c_str();
str2.replace("&", "&&");
sub3->insertItem(str2, sub, -1, 0);
@@ -3404,7 +3407,7 @@ void KQalculate::create_fmenu() {
for(size_t i = 0; i < titem->objects.size(); i++) {
f = (MathFunction*) titem->objects[i];
if(f->isActive() && !f->isHidden()) {
- if(f->title(true).find('&') != string::npos) {
+ if(f->title(true).find('&') != std::string::npos) {
TQString str2 = f->title(true).c_str();
str2.replace("&", "&&");
menu_functions_ids[sub->insertItem(str2)] = f;
@@ -3484,13 +3487,13 @@ void KQalculate::create_umenu() {
menu_units_ids.clear();
- stack<TQPopupMenu*> menus;
+ std::stack<TQPopupMenu*> menus;
menus.push(sub);
sub3 = sub;
while(titem) {
sub = new TQPopupMenu();
TQObject::connect(sub, SIGNAL(activated(int)), this, SLOT(onUnitMenuItemActivated(int)));
- if(titem->item.find('&') != string::npos) {
+ if(titem->item.find('&') != std::string::npos) {
TQString str2 = titem->item.c_str();
str2.replace("&", "&&");
sub3->insertItem(str2, sub, -1, 0);
@@ -3502,7 +3505,7 @@ void KQalculate::create_umenu() {
for(size_t i = 0; i < titem->objects.size(); i++) {
u = (Unit*) titem->objects[i];
if(u->isActive() && !u->isHidden()) {
- if(u->title(true).find('&') != string::npos) {
+ if(u->title(true).find('&') != std::string::npos) {
TQString str2 = u->title(true).c_str();
str2.replace("&", "&&");
menu_units_ids[sub->insertItem(str2)] = u;
@@ -3608,13 +3611,13 @@ void KQalculate::create_toumenu() {
menu_to_unit_ids.clear();
- stack<TQPopupMenu*> menus;
+ std::stack<TQPopupMenu*> menus;
menus.push(sub);
sub3 = sub;
while(titem) {
sub = new TQPopupMenu();
TQObject::connect(sub, SIGNAL(activated(int)), this, SLOT(onConvertToUnitMenuItemActivated(int)));
- if(titem->item.find('&') != string::npos) {
+ if(titem->item.find('&') != std::string::npos) {
TQString str2 = titem->item.c_str();
str2.replace("&", "&&");
sub3->insertItem(str2, sub, -1, 0);
@@ -3626,7 +3629,7 @@ void KQalculate::create_toumenu() {
for(size_t i = 0; i < titem->objects.size(); i++) {
u = (Unit*) titem->objects[i];
if(u->isActive() && !u->isHidden()) {
- if(u->title(true).find('&') != string::npos) {
+ if(u->title(true).find('&') != std::string::npos) {
TQString str2 = u->title(true).c_str();
str2.replace("&", "&&");
menu_to_unit_ids[sub->insertItem(str2)] = u;
@@ -6286,7 +6289,7 @@ void KQalculate::displayParseStatus() {
return;
}
MathStructure mparse, mfunc;
- string str_e, str_u;
+ std::string str_e, str_u;
int pos = expressionEdit->cursorPosition();
bool full_parsed = false;
bool had_errors = false, had_warnings = false;