Fix undeclared declarations of string/vector/list; prefix declarations with 'std::'

Signed-off-by: aneejit1 <aneejit1@gmail.com>
pull/1/head
aneejit1 4 years ago
parent 7cbf6dffbb
commit 208f77024e

@ -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;

@ -24,6 +24,7 @@
#include "kqalculate.h"
#include "preferences.h"
#include <string>
#include <twin.h>
#include <kuniqueapplication.h>
#include <tdeaboutdata.h>
@ -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");

@ -30,6 +30,8 @@
#include <unistd.h>
#include <dirent.h>
#include <stdio.h>
#include <vector>
#include <string>
#include <tdelocale.h>
#include <tqstringlist.h>
#include <ktextbrowser.h>
@ -71,9 +73,9 @@ bool canplot;
TQString initial_history;
extern vector<MathFunction*> recent_functions;
extern vector<Variable*> recent_variables;
extern vector<Unit*> recent_units;
extern std::vector<MathFunction*> recent_functions;
extern std::vector<Variable*> recent_variables;
extern std::vector<Unit*> recent_units;
TQValueVector<TQString> recent_functions_pre;
TQValueVector<TQString> recent_variables_pre;
TQValueVector<TQString> recent_units_pre;
@ -84,7 +86,7 @@ TQStringList expression_history;
bool show_keypad, show_history, show_stack;
vector<mode_struct> modes;
std::vector<mode_struct> modes;
TQValueVector<TQString> inhistory;
TQValueVector<int> 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+");

@ -19,6 +19,9 @@
***************************************************************************/
#include "qalculate_tde_utils.h"
#include <vector>
#include <string>
#include <list>
#include <tqwidget.h>
#include <tqlabel.h>
#include <tqlineedit.h>
@ -28,10 +31,10 @@
#include "kqalculate.h"
tree_struct function_cats, unit_cats, variable_cats;
vector<void*> ia_units, ia_variables, ia_functions;
vector<MathFunction*> recent_functions;
vector<Variable*> recent_variables;
vector<Unit*> recent_units;
std::vector<void*> ia_units, ia_variables, ia_functions;
std::vector<MathFunction*> recent_functions;
std::vector<Variable*> recent_variables;
std::vector<Unit*> 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<tree_struct>::iterator it;
std::list<tree_struct>::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<tree_struct>::iterator it;
std::list<tree_struct>::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<tree_struct>::iterator it;
std::list<tree_struct>::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;

@ -21,6 +21,9 @@
#ifndef QALCULATE_TDE_UTILS_H
#define QALCULATE_TDE_UTILS_H
#include <vector>
#include <string>
#include <list>
#include <libqalculate/qalculate.h>
#undef insertItem
#undef addItem
@ -34,15 +37,15 @@ class TQLabel;
class TQLineEdit;
struct tree_struct {
string item;
list<tree_struct> items;
list<tree_struct>::iterator it;
list<tree_struct>::reverse_iterator rit;
vector<void*> objects;
std::string item;
std::list<tree_struct> items;
std::list<tree_struct>::iterator it;
std::list<tree_struct>::reverse_iterator rit;
std::vector<void*> objects;
tree_struct *parent;
void sort() {
items.sort();
for(list<tree_struct>::iterator it = items.begin(); it != items.end(); ++it) {
for(std::list<tree_struct>::iterator it = items.begin(); it != items.end(); ++it) {
it->sort();
}
}

@ -19,6 +19,7 @@
***************************************************************************/
#include "qalculateconvertnumberbasesdialog.h"
#include "qalculate_tde_utils.h"
#include <string>
#include <tdelocale.h>
#include <tqgrid.h>
#include <tqlabel.h>
@ -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;

@ -20,6 +20,8 @@
#include "qalculateconvertunitsdialog.h"
#include "qalculate_tde_utils.h"
#include <vector>
#include <string>
#include <tqlabel.h>
#include <klineedit.h>
#include <tdelocale.h>
@ -34,7 +36,7 @@
#include <tqsplitter.h>
extern tree_struct unit_cats;
extern vector<void*> ia_units;
extern std::vector<void*> 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]);

@ -19,6 +19,7 @@
***************************************************************************/
#include "qalculateeditdataobjectdialog.h"
#include "qalculate_tde_utils.h"
#include <string>
#include <tqlabel.h>
#include <tqgrid.h>
#include <klineedit.h>
@ -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<KLineEdit*> value_entries;
TQValueVector<KComboBox*> approx_menus;
string str;
std::string str;
while(dp) {
new TQLabel(dp->title().c_str(), grid);
KLineEdit *entry = new KLineEdit(grid);

@ -21,6 +21,7 @@
#include "qalculate_tde_utils.h"
#include "qalculateeditnamesdialog.h"
#include <string>
#include <tqgrid.h>
#include <klineedit.h>
#include <kpushbutton.h>
@ -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

@ -21,6 +21,7 @@
#include "qalculate_tde_utils.h"
#include "qalculateeditnamesdialog.h"
#include <string>
#include <tqgrid.h>
#include <klineedit.h>
#include <kpushbutton.h>
@ -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())) {

@ -21,6 +21,7 @@
#include "qalculate_tde_utils.h"
#include "qalculateeditnamesdialog.h"
#include <string>
#include <tqgrid.h>
#include <klineedit.h>
#include <tqpushbutton.h>
@ -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()) {

@ -21,6 +21,7 @@
#include "qalculate_tde_utils.h"
#include "qalculateeditnamesdialog.h"
#include <string>
#include <tqgrid.h>
#include <klineedit.h>
#include <tqpushbutton.h>
@ -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

@ -21,6 +21,7 @@
#include "qalculate_tde_utils.h"
#include "qalculateeditnamesdialog.h"
#include <string>
#include <tqgrid.h>
#include <klineedit.h>
#include <tqpushbutton.h>
@ -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

@ -21,6 +21,7 @@
#include "qalculate_tde_utils.h"
#include "qalculateeditnamesdialog.h"
#include <string>
#include <tqgrid.h>
#include <klineedit.h>
#include <tqpushbutton.h>
@ -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

@ -20,6 +20,7 @@
#include "qalculateexportcsvdialog.h"
#include "qalculate_tde_utils.h"
#include <string>
#include <tqlayout.h>
#include <kurlrequester.h>
#include <klineedit.h>
@ -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();

@ -21,6 +21,8 @@
#include "qalculate_tde_utils.h"
#include "kqalculate.h"
#include <vector>
#include <string>
#include <tdeversion.h>
#include <kcursor.h>
#include <tqstyle.h>
@ -35,14 +37,14 @@
#include <tdelocale.h>
#include <tqsimplerichtext.h>
extern vector<mode_struct> modes;
extern std::vector<mode_struct> 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<void*> ia_units, ia_variables, ia_functions;
extern std::vector<void*> 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;

@ -20,6 +20,8 @@
#include "qalculatefunctionsdialog.h"
#include "qalculate_tde_utils.h"
#include "qalculateeditfunctiondialog.h"
#include <vector>
#include <string>
#include <kpushbutton.h>
#include <tqsplitter.h>
#include <tqvbox.h>
@ -33,7 +35,7 @@
#include <kstdguiitem.h>
extern tree_struct function_cats;
extern vector<void*> ia_functions;
extern std::vector<void*> 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]);

@ -20,6 +20,7 @@
#include "qalculateimportcsvdialog.h"
#include "qalculate_tde_utils.h"
#include <string>
#include <tqlayout.h>
#include <kurlrequester.h>
#include <klineedit.h>
@ -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 = ",";

@ -20,6 +20,8 @@
#include "qalculateplotdialog.h"
#include "qalculateexpressionedit.h"
#include <vector>
#include <string>
#include <klineedit.h>
#include <kpushbutton.h>
#include <kcombobox.h>
@ -587,7 +589,7 @@ void QalculatePlotDialog::applyAppearance() {
updatePlot();
}
bool QalculatePlotDialog::generatePlot(PlotParameters &pp, vector<MathStructure> &y_vectors, vector<MathStructure> &x_vectors, vector<PlotDataParameters*> &pdps) {
bool QalculatePlotDialog::generatePlot(PlotParameters &pp, std::vector<MathStructure> &y_vectors, std::vector<MathStructure> &x_vectors, std::vector<PlotDataParameters*> &pdps) {
TQListViewItemIterator it(seriesView);
if(!it.current()) {
return false;
@ -736,9 +738,9 @@ void QalculatePlotDialog::savePlot() {
}
}
}
vector<MathStructure> y_vectors;
vector<MathStructure> x_vectors;
vector<PlotDataParameters*> pdps;
std::vector<MathStructure> y_vectors;
std::vector<MathStructure> x_vectors;
std::vector<PlotDataParameters*> 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<MathStructure> y_vectors;
vector<MathStructure> x_vectors;
vector<PlotDataParameters*> pdps;
std::vector<MathStructure> y_vectors;
std::vector<MathStructure> x_vectors;
std::vector<PlotDataParameters*> 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;

@ -20,6 +20,8 @@
#ifndef QALCULATEPLOTDIALOG_H
#define QALCULATEPLOTDIALOG_H
#include <vector>
#include <string>
#include <kdialogbase.h>
#include <tqmap.h>
#include <tqstring.h>
@ -63,8 +65,8 @@ public:
TQTabWidget *tabs;
TDEListView *seriesView;
bool generatePlot(PlotParameters &pp, vector<MathStructure> &y_vectors, vector<MathStructure> &x_vectors, vector<PlotDataParameters*> &pdps);
void generatePlotSeries(MathStructure **x_vector, MathStructure **y_vector, int type, string str, string str_x);
bool generatePlot(PlotParameters &pp, std::vector<MathStructure> &y_vectors, std::vector<MathStructure> &x_vectors, std::vector<PlotDataParameters*> &pdps);
void generatePlotSeries(MathStructure **x_vector, MathStructure **y_vector, int type, std::string str, std::string str_x);
TQMap<TQListViewItem*, int> itemStyle;
TQMap<TQListViewItem*, int> itemSmoothing;

@ -21,6 +21,7 @@
#include "qalculate_tde_utils.h"
#include "kqalculate.h"
#include <vector>
#include <tdepopupmenu.h>
#include <kxmlguifactory.h>
#include <kxmlguiclient.h>
@ -32,7 +33,7 @@
#include <tdeapplication.h>
#include <tqsimplerichtext.h>
extern vector<mode_struct> modes;
extern std::vector<mode_struct> modes;
extern TQString parsed_text;
extern KQalculate *mainWin;

@ -20,6 +20,8 @@
#include "qalculateunitsdialog.h"
#include "qalculate_tde_utils.h"
#include "qalculateeditunitdialog.h"
#include <vector>
#include <string>
#include <kpushbutton.h>
#include <tqsplitter.h>
#include <tqvbox.h>
@ -37,7 +39,7 @@
#include <kstdguiitem.h>
extern tree_struct unit_cats;
extern vector<void*> ia_units;
extern std::vector<void*> 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]);

@ -23,6 +23,8 @@
#include "qalculateeditmatrixvectordialog.h"
#include "qalculateeditunknownvariabledialog.h"
#include "qalculateexportcsvdialog.h"
#include <vector>
#include <string>
#include <kpushbutton.h>
#include <tqsplitter.h>
#include <tqvbox.h>
@ -35,7 +37,7 @@
#include <kstdguiitem.h>
extern tree_struct variable_cats;
extern vector<void*> ia_variables;
extern std::vector<void*> 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]);

Loading…
Cancel
Save