From acc3790c3c38df02937fdfea6b97de2c622b3c0d Mon Sep 17 00:00:00 2001 From: aneejit1 Date: Wed, 11 Nov 2020 00:22:16 +0000 Subject: [PATCH] Fix undeclared declarations of string/vector/list; prefix declarations with 'std::' Signed-off-by: aneejit1 (cherry picked from commit 208f77024e5231bffa800964b1123cbde8fa3f29) --- src/kqalculate.cpp | 69 +++++++++++----------- src/main.cpp | 3 +- src/preferences.cpp | 14 +++-- src/qalculate_tde_utils.cpp | 35 ++++++----- src/qalculate_tde_utils.h | 15 +++-- src/qalculateconvertnumberbasesdialog.cpp | 9 +-- src/qalculateconvertunitsdialog.cpp | 8 ++- src/qalculateeditdataobjectdialog.cpp | 5 +- src/qalculateeditdatasetdialog.cpp | 5 +- src/qalculateeditfunctiondialog.cpp | 5 +- src/qalculateeditmatrixvectordialog.cpp | 5 +- src/qalculateeditunitdialog.cpp | 3 +- src/qalculateeditunknownvariabledialog.cpp | 3 +- src/qalculateeditvariabledialog.cpp | 5 +- src/qalculateexportcsvdialog.cpp | 5 +- src/qalculateexpressionedit.cpp | 14 +++-- src/qalculatefunctionsdialog.cpp | 8 ++- src/qalculateimportcsvdialog.cpp | 3 +- src/qalculateplotdialog.cpp | 18 +++--- src/qalculateplotdialog.h | 6 +- src/qalculateresultdisplay.cpp | 3 +- src/qalculateunitsdialog.cpp | 8 ++- src/qalculatevariablesdialog.cpp | 8 ++- 23 files changed, 147 insertions(+), 110 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 #include #include +#include +#include +#include #include #include #include @@ -139,11 +142,11 @@ extern bool enable_expression_completion; extern TQString initial_history; extern tree_struct function_cats, unit_cats, variable_cats; -extern vector ia_units, ia_variables, ia_functions; -extern vector recent_functions; -extern vector recent_variables; -extern vector recent_units; -vector result_parts; +extern std::vector ia_units, ia_variables, ia_functions; +extern std::vector recent_functions; +extern std::vector recent_variables; +extern std::vector recent_units; +std::vector 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 modes; +extern std::vector modes; extern TQValueVector inhistory; extern TQValueVector 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 terms; - vector do_space; + std::vector terms; + std::vector 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 nm; - vector terms; - vector do_space; + std::vector nm; + std::vector terms; + std::vector 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 menus; + std::stack 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 menus; + std::stack 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 menus; + std::stack 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 menus; + std::stack 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; diff --git a/src/main.cpp b/src/main.cpp index c9c9ee6..b56623f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -24,6 +24,7 @@ #include "kqalculate.h" #include "preferences.h" +#include #include #include #include @@ -152,7 +153,7 @@ void start_qalculate() { CALCULATOR->loadExchangeRates(); - string ans_str = i18n("ans").ascii(); + std::string ans_str = i18n("ans").ascii(); vans[0] = (KnownVariable*) CALCULATOR->addVariable(new KnownVariable(i18n("Temporary").ascii(), ans_str, m_undefined, i18n("Last Answer").ascii(), false)); vans[0]->addName(i18n("answer").ascii()); vans[0]->addName(ans_str + "1"); diff --git a/src/preferences.cpp b/src/preferences.cpp index f4f4011..e75ee66 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -30,6 +30,8 @@ #include #include #include +#include +#include #include #include #include @@ -71,9 +73,9 @@ bool canplot; TQString initial_history; -extern vector recent_functions; -extern vector recent_variables; -extern vector recent_units; +extern std::vector recent_functions; +extern std::vector recent_variables; +extern std::vector recent_units; TQValueVector recent_functions_pre; TQValueVector recent_variables_pre; TQValueVector recent_units_pre; @@ -84,7 +86,7 @@ TQStringList expression_history; bool show_keypad, show_history, show_stack; -vector modes; +std::vector modes; TQValueVector inhistory; TQValueVector inhistory_type; @@ -232,7 +234,7 @@ void load_preferences() { load_global_defs = true; fetch_exchange_rates_at_startup = false; first_time = false; - string filename = getLocalDir(); + std::string filename = getLocalDir(); DIR *dir = opendir(filename.c_str()); if(!dir) { first_qalculate_run = true; @@ -661,7 +663,7 @@ void load_preferences() { void save_preferences(bool mode) { FILE *file = NULL; - string filename = getLocalDir(); + std::string filename = getLocalDir(); mkdir(filename.c_str(), S_IRWXU); filename += "qalculate-tde.cfg"; file = fopen(filename.c_str(), "w+"); diff --git a/src/qalculate_tde_utils.cpp b/src/qalculate_tde_utils.cpp index fb34e9a..4bfaf65 100644 --- a/src/qalculate_tde_utils.cpp +++ b/src/qalculate_tde_utils.cpp @@ -19,6 +19,9 @@ ***************************************************************************/ #include "qalculate_tde_utils.h" +#include +#include +#include #include #include #include @@ -28,10 +31,10 @@ #include "kqalculate.h" tree_struct function_cats, unit_cats, variable_cats; -vector ia_units, ia_variables, ia_functions; -vector recent_functions; -vector recent_variables; -vector recent_units; +std::vector ia_units, ia_variables, ia_functions; +std::vector recent_functions; +std::vector recent_variables; +std::vector recent_units; extern PrintOptions printops; extern KnownVariable *vans[5]; extern TQWidget *topWidget; @@ -81,13 +84,13 @@ bool can_display_unicode_string_function(const char *str, void *arg) { void generate_units_tree_struct() { size_t cat_i, cat_i_prev; bool b; - string str, cat, cat_sub; + std::string str, cat, cat_sub; Unit *u = NULL; unit_cats.items.clear(); unit_cats.objects.clear(); unit_cats.parent = NULL; ia_units.clear(); - list::iterator it; + std::list::iterator it; for(size_t i = 0; i < CALCULATOR->units.size(); i++) { if(!CALCULATOR->units[i]->isActive()) { b = false; @@ -107,7 +110,7 @@ void generate_units_tree_struct() { cat_i = cat.find("/"); cat_i_prev = 0; b = false; while(true) { - if(cat_i == string::npos) { + if(cat_i == std::string::npos) { cat_sub = cat.substr(cat_i_prev, cat.length() - cat_i_prev); } else { cat_sub = cat.substr(cat_i_prev, cat_i - cat_i_prev); @@ -129,7 +132,7 @@ void generate_units_tree_struct() { item = &*it; item->item = cat_sub; } - if(cat_i == string::npos) { + if(cat_i == std::string::npos) { break; } cat_i_prev = cat_i + 1; @@ -156,13 +159,13 @@ void generate_variables_tree_struct() { size_t cat_i, cat_i_prev; bool b; - string str, cat, cat_sub; + std::string str, cat, cat_sub; Variable *v = NULL; variable_cats.items.clear(); variable_cats.objects.clear(); variable_cats.parent = NULL; ia_variables.clear(); - list::iterator it; + std::list::iterator it; for(size_t i = 0; i < CALCULATOR->variables.size(); i++) { if(!CALCULATOR->variables[i]->isActive()) { //deactivated variable @@ -183,7 +186,7 @@ void generate_variables_tree_struct() { cat_i = cat.find("/"); cat_i_prev = 0; b = false; while(true) { - if(cat_i == string::npos) { + if(cat_i == std::string::npos) { cat_sub = cat.substr(cat_i_prev, cat.length() - cat_i_prev); } else { cat_sub = cat.substr(cat_i_prev, cat_i - cat_i_prev); @@ -205,7 +208,7 @@ void generate_variables_tree_struct() { item = &*it; item->item = cat_sub; } - if(cat_i == string::npos) { + if(cat_i == std::string::npos) { break; } cat_i_prev = cat_i + 1; @@ -232,13 +235,13 @@ void generate_functions_tree_struct() { size_t cat_i, cat_i_prev; bool b; - string str, cat, cat_sub; + std::string str, cat, cat_sub; MathFunction *f = NULL; function_cats.items.clear(); function_cats.objects.clear(); function_cats.parent = NULL; ia_functions.clear(); - list::iterator it; + std::list::iterator it; for(size_t i = 0; i < CALCULATOR->functions.size(); i++) { if(!CALCULATOR->functions[i]->isActive()) { @@ -260,7 +263,7 @@ void generate_functions_tree_struct() { cat_i = cat.find("/"); cat_i_prev = 0; b = false; while(true) { - if(cat_i == string::npos) { + if(cat_i == std::string::npos) { cat_sub = cat.substr(cat_i_prev, cat.length() - cat_i_prev); } else { cat_sub = cat.substr(cat_i_prev, cat_i - cat_i_prev); @@ -282,7 +285,7 @@ void generate_functions_tree_struct() { item = &*it; item->item = cat_sub; } - if(cat_i == string::npos) { + if(cat_i == std::string::npos) { break; } cat_i_prev = cat_i + 1; diff --git a/src/qalculate_tde_utils.h b/src/qalculate_tde_utils.h index 05df313..e51d0c1 100644 --- a/src/qalculate_tde_utils.h +++ b/src/qalculate_tde_utils.h @@ -21,6 +21,9 @@ #ifndef QALCULATE_TDE_UTILS_H #define QALCULATE_TDE_UTILS_H +#include +#include +#include #include #undef insertItem #undef addItem @@ -34,15 +37,15 @@ class TQLabel; class TQLineEdit; struct tree_struct { - string item; - list items; - list::iterator it; - list::reverse_iterator rit; - vector objects; + std::string item; + std::list items; + std::list::iterator it; + std::list::reverse_iterator rit; + std::vector objects; tree_struct *parent; void sort() { items.sort(); - for(list::iterator it = items.begin(); it != items.end(); ++it) { + for(std::list::iterator it = items.begin(); it != items.end(); ++it) { it->sort(); } } diff --git a/src/qalculateconvertnumberbasesdialog.cpp b/src/qalculateconvertnumberbasesdialog.cpp index 8ff4ba9..88db1a1 100644 --- a/src/qalculateconvertnumberbasesdialog.cpp +++ b/src/qalculateconvertnumberbasesdialog.cpp @@ -19,6 +19,7 @@ ***************************************************************************/ #include "qalculateconvertnumberbasesdialog.h" #include "qalculate_tde_utils.h" +#include #include #include #include @@ -59,7 +60,7 @@ QalculateConvertNumberBasesDialog::QalculateConvertNumberBasesDialog(TQWidget *p QalculateConvertNumberBasesDialog::~QalculateConvertNumberBasesDialog() {} void QalculateConvertNumberBasesDialog::setDecimalValue(const TQString &qstr) { - string str = qstr.ascii(); + std::string str = qstr.ascii(); remove_blank_ends(str); if(str.empty()) return; if(is_in(OPERATORS EXP, str[str.length() - 1])) return; @@ -69,7 +70,7 @@ void QalculateConvertNumberBasesDialog::setDecimalValue(const TQString &qstr) { updateEntries(&value, 10); } void QalculateConvertNumberBasesDialog::setBinaryValue(const TQString &qstr) { - string str = qstr.ascii(); + std::string str = qstr.ascii(); remove_blank_ends(str); if(str.empty()) return; if(is_in(OPERATORS EXP, str[str.length() - 1])) return; @@ -80,7 +81,7 @@ void QalculateConvertNumberBasesDialog::setBinaryValue(const TQString &qstr) { updateEntries(&value, 2); } void QalculateConvertNumberBasesDialog::setOctalValue(const TQString &qstr) { - string str = qstr.ascii(); + std::string str = qstr.ascii(); remove_blank_ends(str); if(str.empty()) return; if(is_in(OPERATORS EXP, str[str.length() - 1])) return; @@ -91,7 +92,7 @@ void QalculateConvertNumberBasesDialog::setOctalValue(const TQString &qstr) { updateEntries(&value, 8); } void QalculateConvertNumberBasesDialog::setHexadecimalValue(const TQString &qstr) { - string str = qstr.ascii(); + std::string str = qstr.ascii(); remove_blank_ends(str); if(str.empty()) return; if(is_in(OPERATORS EXP, str[str.length() - 1])) return; diff --git a/src/qalculateconvertunitsdialog.cpp b/src/qalculateconvertunitsdialog.cpp index 25336c4..dde95c3 100644 --- a/src/qalculateconvertunitsdialog.cpp +++ b/src/qalculateconvertunitsdialog.cpp @@ -20,6 +20,8 @@ #include "qalculateconvertunitsdialog.h" #include "qalculate_tde_utils.h" +#include +#include #include #include #include @@ -34,7 +36,7 @@ #include extern tree_struct unit_cats; -extern vector ia_units; +extern std::vector ia_units; extern PrintOptions printops; extern EvaluationOptions evalops; @@ -183,7 +185,7 @@ void QalculateConvertUnitsDialog::categorySelected() { no_cat = true; } if(!b_all && !no_cat && selected_category[0] == '/') { - string str = selected_category.ascii(); + std::string str = selected_category.ascii(); str.erase(str.begin()); for(size_t i = 0; i < CALCULATOR->units.size(); i++) { if(CALCULATOR->units[i]->isActive() && !CALCULATOR->units[i]->isHidden() && CALCULATOR->units[i]->category().substr(0, selected_category.length() - 1) == str) { @@ -191,7 +193,7 @@ void QalculateConvertUnitsDialog::categorySelected() { } } } else { - string str = selected_category.ascii(); + std::string str = selected_category.ascii(); for(size_t i = 0; i < CALCULATOR->units.size(); i++) { if(CALCULATOR->units[i]->isActive() && !CALCULATOR->units[i]->isHidden() && (b_all || (no_cat && CALCULATOR->units[i]->category().empty()) || CALCULATOR->units[i]->category() == str)) { addUnitTreeItem(CALCULATOR->units[i]); diff --git a/src/qalculateeditdataobjectdialog.cpp b/src/qalculateeditdataobjectdialog.cpp index df63409..612b19c 100644 --- a/src/qalculateeditdataobjectdialog.cpp +++ b/src/qalculateeditdataobjectdialog.cpp @@ -19,6 +19,7 @@ ***************************************************************************/ #include "qalculateeditdataobjectdialog.h" #include "qalculate_tde_utils.h" +#include #include #include #include @@ -51,10 +52,10 @@ DataObject *QalculateEditDataObjectDialog::editDataObject(DataSet *ds, DataObjec new TQLabel(i18n("Approximation"), grid); DataPropertyIter it; DataProperty *dp = ds->getFirstProperty(&it); - string sval; + std::string sval; TQValueVector value_entries; TQValueVector approx_menus; - string str; + std::string str; while(dp) { new TQLabel(dp->title().c_str(), grid); KLineEdit *entry = new KLineEdit(grid); diff --git a/src/qalculateeditdatasetdialog.cpp b/src/qalculateeditdatasetdialog.cpp index e543368..a7dc88a 100644 --- a/src/qalculateeditdatasetdialog.cpp +++ b/src/qalculateeditdatasetdialog.cpp @@ -21,6 +21,7 @@ #include "qalculate_tde_utils.h" #include "qalculateeditnamesdialog.h" +#include #include #include #include @@ -204,7 +205,7 @@ void QalculateEditDataSetDialog::updateDatasetPropertyList() { void QalculateEditDataSetDialog::slotOk() { - string str = nameEdit->text().ascii(); + std::string str = nameEdit->text().ascii(); remove_blank_ends(str); if(str.empty() && (!names_edit_dialog || names_edit_dialog->isEmpty())) { //no name -- open dialog again @@ -491,7 +492,7 @@ QalculateEditDataPropertyDialog::~QalculateEditDataPropertyDialog() {} void QalculateEditDataPropertyDialog::slotOk() { - string str = nameEdit->text().ascii(); + std::string str = nameEdit->text().ascii(); remove_blank_ends(str); if(str.empty() && (!names_edit_dialog || names_edit_dialog->isEmpty())) { //no name -- open dialog again diff --git a/src/qalculateeditfunctiondialog.cpp b/src/qalculateeditfunctiondialog.cpp index 82dd579..0912b2b 100644 --- a/src/qalculateeditfunctiondialog.cpp +++ b/src/qalculateeditfunctiondialog.cpp @@ -21,6 +21,7 @@ #include "qalculate_tde_utils.h" #include "qalculateeditnamesdialog.h" +#include #include #include #include @@ -178,9 +179,9 @@ void QalculateEditFunctionDialog::argumentRenamed(TQListViewItem *i, const TQStr void QalculateEditFunctionDialog::slotOk() { - string str = nameEdit->text().ascii(); + std::string str = nameEdit->text().ascii(); remove_blank_ends(str); - string str2 = CALCULATOR->unlocalizeExpression(expressionEdit->text().ascii(), evalops.parse_options); + std::string str2 = CALCULATOR->unlocalizeExpression(expressionEdit->text().ascii(), evalops.parse_options); remove_blank_ends(str2); gsub("\n", " ", str2); if(str.empty() && (!names_edit_dialog || names_edit_dialog->isEmpty())) { diff --git a/src/qalculateeditmatrixvectordialog.cpp b/src/qalculateeditmatrixvectordialog.cpp index 578f06b..1a65a48 100644 --- a/src/qalculateeditmatrixvectordialog.cpp +++ b/src/qalculateeditmatrixvectordialog.cpp @@ -21,6 +21,7 @@ #include "qalculate_tde_utils.h" #include "qalculateeditnamesdialog.h" +#include #include #include #include @@ -177,7 +178,7 @@ KnownVariable *QalculateEditMatrixVectorDialog::newMatrix(TQString category) { } void QalculateEditMatrixVectorDialog::slotOk() { - string str = nameEdit->text().ascii(); + std::string str = nameEdit->text().ascii(); remove_blank_ends(str); if(str.empty() && (!names_edit_dialog || names_edit_dialog->isEmpty())) { //no name -- open dialog again @@ -202,7 +203,7 @@ void QalculateEditMatrixVectorDialog::slotOk() { int c = columnsBox->value(); if(vectorButton->isChecked()) { mstruct_new.clearVector(); - string str2; + std::string str2; for(int index_r = 0; index_r < r; index_r++) { for(int index_c = 0; index_c < c; index_c++) { if(!elementsTable->text(index_r, index_c).isEmpty()) { diff --git a/src/qalculateeditunitdialog.cpp b/src/qalculateeditunitdialog.cpp index b678b10..1c3d361 100644 --- a/src/qalculateeditunitdialog.cpp +++ b/src/qalculateeditunitdialog.cpp @@ -21,6 +21,7 @@ #include "qalculate_tde_utils.h" #include "qalculateeditnamesdialog.h" +#include #include #include #include @@ -138,7 +139,7 @@ void QalculateEditUnitDialog::slotHelp() { } void QalculateEditUnitDialog::slotOk() { - string str = nameEdit->text().ascii(); + std::string str = nameEdit->text().ascii(); remove_blank_ends(str); if(str.empty() && (!names_edit_dialog || names_edit_dialog->isEmpty())) { //no name -- open dialog again diff --git a/src/qalculateeditunknownvariabledialog.cpp b/src/qalculateeditunknownvariabledialog.cpp index 15ca74a..d8ad09d 100644 --- a/src/qalculateeditunknownvariabledialog.cpp +++ b/src/qalculateeditunknownvariabledialog.cpp @@ -21,6 +21,7 @@ #include "qalculate_tde_utils.h" #include "qalculateeditnamesdialog.h" +#include #include #include #include @@ -124,7 +125,7 @@ void QalculateEditUnknownVariableDialog::slotHelp() { } void QalculateEditUnknownVariableDialog::slotOk() { - string str = nameEdit->text().ascii(); + std::string str = nameEdit->text().ascii(); remove_blank_ends(str); if(str.empty() && (!names_edit_dialog || names_edit_dialog->isEmpty())) { //no name -- open dialog again diff --git a/src/qalculateeditvariabledialog.cpp b/src/qalculateeditvariabledialog.cpp index aab9af3..8475cdd 100644 --- a/src/qalculateeditvariabledialog.cpp +++ b/src/qalculateeditvariabledialog.cpp @@ -21,6 +21,7 @@ #include "qalculate_tde_utils.h" #include "qalculateeditnamesdialog.h" +#include #include #include #include @@ -94,7 +95,7 @@ void QalculateEditVariableDialog::slotHelp() { } void QalculateEditVariableDialog::slotOk() { - string str = nameEdit->text().ascii(); + std::string str = nameEdit->text().ascii(); remove_blank_ends(str); if(str.empty() && (!names_edit_dialog || names_edit_dialog->isEmpty())) { //no name -- open dialog again @@ -102,7 +103,7 @@ void QalculateEditVariableDialog::slotOk() { KMessageBox::error(this, i18n("Empty name field")); return; } - string str2 = valueEdit->text().ascii(); + std::string str2 = valueEdit->text().ascii(); remove_blank_ends(str2); if(!(init_value && force_init_value) && str2.empty()) { //no value -- open dialog again diff --git a/src/qalculateexportcsvdialog.cpp b/src/qalculateexportcsvdialog.cpp index 9c73297..a224ee8 100644 --- a/src/qalculateexportcsvdialog.cpp +++ b/src/qalculateexportcsvdialog.cpp @@ -20,6 +20,7 @@ #include "qalculateexportcsvdialog.h" #include "qalculate_tde_utils.h" +#include #include #include #include @@ -93,7 +94,7 @@ void QalculateExportCSVDialog::slotOk() { KMessageBox::error(this, i18n("No file name entered.")); return; } - string delimiter = ""; + std::string delimiter = ""; switch(delimiterCombo->currentItem()) { case 0: { delimiter = ","; @@ -128,7 +129,7 @@ void QalculateExportCSVDialog::slotOk() { } else if(currentResultButton->isChecked()) { matrix_struct = mstruct; } else { - string str2 = matrixVectorEdit->text().ascii(); + std::string str2 = matrixVectorEdit->text().ascii(); remove_blank_ends(str2); if(str2.empty()) { matrixVectorEdit->setFocus(); diff --git a/src/qalculateexpressionedit.cpp b/src/qalculateexpressionedit.cpp index 31ccecf..3eff804 100644 --- a/src/qalculateexpressionedit.cpp +++ b/src/qalculateexpressionedit.cpp @@ -21,6 +21,8 @@ #include "qalculate_tde_utils.h" #include "kqalculate.h" +#include +#include #include #include #include @@ -35,14 +37,14 @@ #include #include -extern vector modes; +extern std::vector modes; extern KQalculate *mainWin; extern PrintOptions printops; extern EvaluationOptions evalops; extern bool rpn_mode, rpn_keypad_only; extern tree_struct function_cats, unit_cats, variable_cats; -extern vector ia_units, ia_variables, ia_functions; +extern std::vector ia_units, ia_variables, ia_functions; class QalculateExpressionEditListBoxItem : public TQListBoxItem { @@ -726,11 +728,11 @@ void set_title(ExpressionItem *item, TQString &title) { } } -string sub_suffix(const ExpressionName *ename) { +std::string sub_suffix(const ExpressionName *ename) { 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; - string str; + std::string str; if(b) { if(is_in(NUMBERS, ename->name[ename->name.length() - 1])) { while(ename->name.length() > i2 + 1 && is_in(NUMBERS, ename->name[ename->name.length() - 1 - i2])) { @@ -749,7 +751,7 @@ string sub_suffix(const ExpressionName *ename) { } TQString makeListName(ExpressionItem *item, TQWidget *w, int *italic_index, bool *rich_text) { - string str; + std::string str; const ExpressionName *ename, *ename_r; *rich_text = false; bool b = false; diff --git a/src/qalculatefunctionsdialog.cpp b/src/qalculatefunctionsdialog.cpp index 4bb53bf..d60c9be 100644 --- a/src/qalculatefunctionsdialog.cpp +++ b/src/qalculatefunctionsdialog.cpp @@ -20,6 +20,8 @@ #include "qalculatefunctionsdialog.h" #include "qalculate_tde_utils.h" #include "qalculateeditfunctiondialog.h" +#include +#include #include #include #include @@ -33,7 +35,7 @@ #include extern tree_struct function_cats; -extern vector ia_functions; +extern std::vector ia_functions; extern PrintOptions printops; QalculateFunctionsDialog::QalculateFunctionsDialog(TQWidget *parent, const char *name) : KDialog(parent, name, false) { @@ -510,7 +512,7 @@ void QalculateFunctionsDialog::categorySelected() { b_inactive = true; } if(!b_all && !no_cat && !b_inactive && selected_category[0] == '/') { - string str = selected_category.ascii(); + std::string str = selected_category.ascii(); str.erase(str.begin()); for(size_t i = 0; i < CALCULATOR->functions.size(); i++) { if(CALCULATOR->functions[i]->isActive() && CALCULATOR->functions[i]->category().substr(0, selected_category.length() - 1) == str) { @@ -518,7 +520,7 @@ void QalculateFunctionsDialog::categorySelected() { } } } else { - string str = selected_category.ascii(); + std::string str = selected_category.ascii(); for(size_t i = 0; i < CALCULATOR->functions.size(); i++) { if((b_inactive && !CALCULATOR->functions[i]->isActive()) || (CALCULATOR->functions[i]->isActive() && (b_all || (no_cat && CALCULATOR->functions[i]->category().empty()) || (!b_inactive && CALCULATOR->functions[i]->category() == str)))) { addFunctionTreeItem(CALCULATOR->functions[i]); diff --git a/src/qalculateimportcsvdialog.cpp b/src/qalculateimportcsvdialog.cpp index 2a6e257..251adc9 100644 --- a/src/qalculateimportcsvdialog.cpp +++ b/src/qalculateimportcsvdialog.cpp @@ -20,6 +20,7 @@ #include "qalculateimportcsvdialog.h" #include "qalculate_tde_utils.h" +#include #include #include #include @@ -116,7 +117,7 @@ void QalculateImportCSVDialog::slotOk() { KMessageBox::error(this, i18n("No file name entered.")); return; } - string delimiter = ""; + std::string delimiter = ""; switch(delimiterCombo->currentItem()) { case 0: { delimiter = ","; diff --git a/src/qalculateplotdialog.cpp b/src/qalculateplotdialog.cpp index 6755bed..6c0a61b 100644 --- a/src/qalculateplotdialog.cpp +++ b/src/qalculateplotdialog.cpp @@ -20,6 +20,8 @@ #include "qalculateplotdialog.h" #include "qalculateexpressionedit.h" +#include +#include #include #include #include @@ -587,7 +589,7 @@ void QalculatePlotDialog::applyAppearance() { updatePlot(); } -bool QalculatePlotDialog::generatePlot(PlotParameters &pp, vector &y_vectors, vector &x_vectors, vector &pdps) { +bool QalculatePlotDialog::generatePlot(PlotParameters &pp, std::vector &y_vectors, std::vector &x_vectors, std::vector &pdps) { TQListViewItemIterator it(seriesView); if(!it.current()) { return false; @@ -736,9 +738,9 @@ void QalculatePlotDialog::savePlot() { } } } - vector y_vectors; - vector x_vectors; - vector pdps; + std::vector y_vectors; + std::vector x_vectors; + std::vector pdps; PlotParameters pp; if(generatePlot(pp, y_vectors, x_vectors, pdps)) { pp.filename = filename.ascii(); @@ -750,9 +752,9 @@ void QalculatePlotDialog::savePlot() { } } void QalculatePlotDialog::updatePlot() { - vector y_vectors; - vector x_vectors; - vector pdps; + std::vector y_vectors; + std::vector x_vectors; + std::vector pdps; PlotParameters pp; if(!generatePlot(pp, y_vectors, x_vectors, pdps)) { CALCULATOR->closeGnuplot(); @@ -765,7 +767,7 @@ void QalculatePlotDialog::updatePlot() { if(pdps[i]) delete pdps[i]; } } -void QalculatePlotDialog::generatePlotSeries(MathStructure **x_vector, MathStructure **y_vector, int type, string str, string str_x) { +void QalculatePlotDialog::generatePlotSeries(MathStructure **x_vector, MathStructure **y_vector, int type, std::string str, std::string str_x) { EvaluationOptions eo; eo.approximation = APPROXIMATION_APPROXIMATE; eo.parse_options = evalops.parse_options; diff --git a/src/qalculateplotdialog.h b/src/qalculateplotdialog.h index 4d8e9b8..c35ac53 100644 --- a/src/qalculateplotdialog.h +++ b/src/qalculateplotdialog.h @@ -20,6 +20,8 @@ #ifndef QALCULATEPLOTDIALOG_H #define QALCULATEPLOTDIALOG_H +#include +#include #include #include #include @@ -63,8 +65,8 @@ public: TQTabWidget *tabs; TDEListView *seriesView; - bool generatePlot(PlotParameters &pp, vector &y_vectors, vector &x_vectors, vector &pdps); - void generatePlotSeries(MathStructure **x_vector, MathStructure **y_vector, int type, string str, string str_x); + bool generatePlot(PlotParameters &pp, std::vector &y_vectors, std::vector &x_vectors, std::vector &pdps); + void generatePlotSeries(MathStructure **x_vector, MathStructure **y_vector, int type, std::string str, std::string str_x); TQMap itemStyle; TQMap itemSmoothing; diff --git a/src/qalculateresultdisplay.cpp b/src/qalculateresultdisplay.cpp index aea41fa..0c7ccdf 100644 --- a/src/qalculateresultdisplay.cpp +++ b/src/qalculateresultdisplay.cpp @@ -21,6 +21,7 @@ #include "qalculate_tde_utils.h" #include "kqalculate.h" +#include #include #include #include @@ -32,7 +33,7 @@ #include #include -extern vector modes; +extern std::vector modes; extern TQString parsed_text; extern KQalculate *mainWin; diff --git a/src/qalculateunitsdialog.cpp b/src/qalculateunitsdialog.cpp index 8710f2f..c5c74e1 100644 --- a/src/qalculateunitsdialog.cpp +++ b/src/qalculateunitsdialog.cpp @@ -20,6 +20,8 @@ #include "qalculateunitsdialog.h" #include "qalculate_tde_utils.h" #include "qalculateeditunitdialog.h" +#include +#include #include #include #include @@ -37,7 +39,7 @@ #include extern tree_struct unit_cats; -extern vector ia_units; +extern std::vector ia_units; extern PrintOptions printops; extern EvaluationOptions evalops; @@ -421,7 +423,7 @@ void QalculateUnitsDialog::categorySelected() { b_inactive = true; } if(!b_all && !no_cat && !b_inactive && selected_category[0] == '/') { - string str = selected_category.ascii(); + std::string str = selected_category.ascii(); str.erase(str.begin()); for(size_t i = 0; i < CALCULATOR->units.size(); i++) { if(CALCULATOR->units[i]->isActive() && CALCULATOR->units[i]->category().substr(0, selected_category.length() - 1) == str) { @@ -429,7 +431,7 @@ void QalculateUnitsDialog::categorySelected() { } } } else { - string str = selected_category.ascii(); + std::string str = selected_category.ascii(); for(size_t i = 0; i < CALCULATOR->units.size(); i++) { if((b_inactive && !CALCULATOR->units[i]->isActive()) || (CALCULATOR->units[i]->isActive() && (b_all || (no_cat && CALCULATOR->units[i]->category().empty()) || (!b_inactive && CALCULATOR->units[i]->category() == str)))) { addUnitTreeItem(CALCULATOR->units[i]); diff --git a/src/qalculatevariablesdialog.cpp b/src/qalculatevariablesdialog.cpp index 57e07ea..86ec001 100644 --- a/src/qalculatevariablesdialog.cpp +++ b/src/qalculatevariablesdialog.cpp @@ -23,6 +23,8 @@ #include "qalculateeditmatrixvectordialog.h" #include "qalculateeditunknownvariabledialog.h" #include "qalculateexportcsvdialog.h" +#include +#include #include #include #include @@ -35,7 +37,7 @@ #include extern tree_struct variable_cats; -extern vector ia_variables; +extern std::vector ia_variables; QalculateVariablesDialog::QalculateVariablesDialog(TQWidget *parent, const char *name) : KDialog(parent, name, false) { @@ -467,7 +469,7 @@ void QalculateVariablesDialog::categorySelected() { b_inactive = true; } if(!b_all && !no_cat && !b_inactive && selected_category[0] == '/') { - string str = selected_category.ascii(); + std::string str = selected_category.ascii(); str.erase(str.begin()); for(size_t i = 0; i < CALCULATOR->variables.size(); i++) { if(CALCULATOR->variables[i]->isActive() && CALCULATOR->variables[i]->category().substr(0, selected_category.length() - 1) == str) { @@ -475,7 +477,7 @@ void QalculateVariablesDialog::categorySelected() { } } } else { - string str = selected_category.ascii(); + std::string str = selected_category.ascii(); for(size_t i = 0; i < CALCULATOR->variables.size(); i++) { if((b_inactive && !CALCULATOR->variables[i]->isActive()) || (CALCULATOR->variables[i]->isActive() && (b_all || (no_cat && CALCULATOR->variables[i]->category().empty()) || (!b_inactive && CALCULATOR->variables[i]->category() == str)))) { addVariableTreeItem(CALCULATOR->variables[i]);