本文整理汇总了C++中DBIndexItem类的典型用法代码示例。如果您正苦于以下问题:C++ DBIndexItem类的具体用法?C++ DBIndexItem怎么用?C++ DBIndexItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DBIndexItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: indexPref
int DbPlugin::indexPref ()
{
int rc = 0;
QString nam, il;
DBIndexItem item;
chartIndex->getIndexItem(indexKey, item);
item.getTitle(nam);
QString s = "List";
getData(s, il);
IndexDialog *dialog = new IndexDialog(nam, il);
int trc = dialog->exec();
if (trc == QDialog::Accepted)
{
dialog->getName(nam);
item.setTitle(nam);
dialog->getList(il);
setData(s, il);
chartIndex->setIndexItem(indexKey, item);
rc = TRUE;
}
delete dialog;
return rc;
}
示例2: saveChart
void FuturesDialog::saveChart ()
{
QString s = title->text();
DBIndexItem item;
index->getIndexItem(symbol, item);
item.setTitle(s);
index->setIndexItem(symbol, item);
if (barEdit->getSaveFlag())
{
int rc = QMessageBox::warning(this,
tr("Warning"),
tr("Record has been modified.\nSave changes?"),
QMessageBox::Yes,
QMessageBox::No,
QMessageBox::NoButton);
if (rc == QMessageBox::Yes)
saveRecord();
}
reloadFlag = TRUE;
accept();
}
示例3: createNewFutures
bool DbPlugin::createNewFutures ()
{
QString s;
DBIndexItem item;
chartIndex->getIndexItem(indexKey, item);
item.getSymbol(s);
if (s.length())
{
qDebug("DbPlugin::createNewStock: duplicate symbol %s", s.latin1());
return TRUE;
}
type = Futures1;
FuturesData fd;
if (fd.setSymbolPath(symbol))
return TRUE;
s = "Futures";
item.setType(s);
fd.getName(s);
item.setTitle(s);
item.setSymbol(indexKey);
fd.getSymbol(s);
item.setFuturesType(s);
s = symbol.right(1);
item.setFuturesMonth(s);
chartIndex->setIndexItem(indexKey, item);
return FALSE;
}
示例4: createNewStock
bool DbPlugin::createNewStock ()
{
QString s;
DBIndexItem item;
chartIndex->getIndexItem(indexKey, item);
item.getSymbol(s);
if (s.length())
{
qDebug("DbPlugin::createNewStock: duplicate symbol %s", s.latin1());
return TRUE;
}
type = Stock1;
s = "Stock";
item.setType(s);
item.setTitle(indexKey);
item.setSymbol(indexKey);
chartIndex->setIndexItem(indexKey, item);
return FALSE;
}
示例5: qDebug
bool CSV::openDb (QString &path, QString &symbol, QString &type, bool tickFlag)
{
if (db.open(path, chartIndex))
{
qDebug("CSV::openDb:can't open chart");
QString ss("CSV::OpenDb:Could not open db.");
printStatusLogMessage(ss);
db.close();
return TRUE;
}
QString s;
DBIndexItem item;
chartIndex->getIndexItem(symbol, item);
item.getSymbol(s);
if (! s.length())
{
if (! type.compare("Futures"))
{
db.setType(DbPlugin::Futures1);
if (db.createNewFutures())
{
db.close();
return TRUE;
}
}
else
{
if(db.createNewStock())
{
db.close();
return TRUE;
}
}
item.setSymbol(symbol);
item.setBarType(tickFlag);
chartIndex->setIndexItem(symbol, item);
}
// verify if this chart can be updated by this plugin
item.getQuotePlugin(s);
if (! s.length())
{
item.setQuotePlugin(pluginName);
chartIndex->setIndexItem(symbol, item);
}
else
{
if (s.compare(pluginName))
{
s = symbol + " - skipping update. Source does not match destination.";
printStatusLogMessage(s);
db.close();
return TRUE;
}
}
return FALSE;
}
示例6: open
bool DbPlugin::open (QString &d, DBIndex *i)
{
if (DBBase::open(d))
return TRUE;
chartIndex = i;
QString s;
DBIndexItem item;
chartIndex->getIndexItem(indexKey, item);
item.getType(s);
type = getType(s);
item.getPath(s);
if (! s.length())
{
item.setPath(d);
chartIndex->setIndexItem(indexKey, item);
}
return FALSE;
}
示例7: createNewSpread
bool DbPlugin::createNewSpread (DBIndex *i)
{
bool ok = FALSE;
QString sn = QInputDialog::getText(QObject::tr("New Spread"),
QObject::tr("Enter symbol name for the new Spread"),
QLineEdit::Normal,
QString::null,
&ok,
0);
if (! sn.length() || ok == FALSE)
return TRUE;
QDir dir;
Config config;
QString s;
config.getData(Config::DataPath, s);
s.append("/Spread");
if (! dir.exists(s))
{
if (! dir.mkdir(s, TRUE))
{
QMessageBox::information(0, QObject::tr("Qtstalker: Error"), QObject::tr("Could not create Spread directory."));
return TRUE;
}
}
s.append("/" + sn);
if (dir.exists(s))
{
QMessageBox::information(0, QObject::tr("Qtstalker: Error"), QObject::tr("This Spread already exists."));
return TRUE;
}
DBIndexItem item;
QString ts;
chartIndex->getIndexItem(sn, item);
item.getSymbol(ts);
if (ts.length())
{
qDebug("DbPlugin::createNewStock: duplicate symbol %s", sn.latin1());
return TRUE;
}
if (open(s, i))
{
QMessageBox::information(0,
QObject::tr("Qtstalker: Error"),
QObject::tr("Disk error, cannot create chart"));
return TRUE;
}
type = Spread1;
item.setSymbol(indexKey);
s = "Spread";
item.setType(s);
item.setTitle(indexKey);
chartIndex->setIndexItem(indexKey, item);
spreadPref();
return FALSE;
}
示例8: getRule
//.........这里部分代码省略.........
r.getData(ts, s);
if (! s.length())
continue;
ts = "Time";
r.getData(ts, ts2);
if (ts2.length())
s.append(ts2);
else
s.append("000000");
Bar bar;
if (bar.setDate(s))
{
ts = "Date";
r.getData(ts, ts2);
QString ss = tr("Bad date") + " " + ts2;
printStatusLogMessage(ss);
continue;
}
bar.setTickFlag(tickFlag);
ts = "Open";
bar.setOpen(r.getDouble(ts));
ts = "High";
bar.setHigh(r.getDouble(ts));
ts = "Low";
bar.setLow(r.getDouble(ts));
ts = "Close";
bar.setClose(r.getDouble(ts));
ts = "Volume";
bar.setVolume(r.getDouble(ts));
ts = "OI";
bar.setOI(r.getInt(ts));
DBIndexItem item;
if (! symbol.length())
{
ts = "Symbol";
QString t;
r.getData(ts, t);
s = path;
s.append(t);
if (openDb(s, t, type, tickFlag))
continue;
ts = "Name";
r.getData(ts, s);
if (s.length())
{
chartIndex->getIndexItem(t, item);
item.setTitle(s);
chartIndex->setIndexItem(t, item);
}
db.setBar(bar);
ts = "Symbol";
r.getData(ts, ts2);
// QString ss = tr("Updating") + " " + ts2;
// printStatusLogMessage(ss);
config.closePlugin(type);
db.close();
emit signalWakeup();
}
else
{
ts = "Name";
r.getData(ts, s);
if (s.length())
{
chartIndex->getIndexItem(symbol, item);
item.setTitle(s);
chartIndex->setIndexItem(symbol, item);
}
db.setBar(bar);
emit signalWakeup();
}
}
db.close();
f.close();
}
progressBar->setProgress((int) list.count(), (int) list.count());
downloadComplete();
if (cancelFlag)
{
cancelFlag = FALSE;
printStatusLogMessage(stringCanceled);
}
else {
QString ss = stringDone + " " + QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss");
printStatusLogMessage(ss);
}
progressBar->reset();
}
示例9: f
void Yahoo::parseHistory ()
{
if (! data.length())
return;
if (data.contains("No data available"))
return;
if (data.contains("No Prices in this date range"))
return;
// strip off the header
QString s = "Date,Open,High,Low,Close,Volume,Adj Close\n";
int p = data.find(s, 0, TRUE);
if (p != -1)
data.remove(0, p + s.length());
QFile f(file);
if (! f.open(QIODevice::WriteOnly))
return;
Q3TextStream stream(&f);
stream << data;
f.close();
f.setName(file);
if (! f.open(QIODevice::ReadOnly))
return;
stream.setDevice(&f);
s = dataPath + "/";
QString ts = "symbol";
QString ts2;
currentUrl->getData(ts, ts2);
QFileInfo fi(ts2);
if (fi.extension(FALSE).length())
s.append(fi.extension(FALSE).upper());
else
s.append("US");
s.append("/");
s.append(ts2);
if (plug.open(s, chartIndex))
{
QString ss(tr("Could not open db"));
printStatusLogMessage(ss);
f.close();
return;
}
QString fn = ts2;
// verify if this chart can be updated by this plugin
DBIndexItem item;
chartIndex->getIndexItem(fn, item);
item.getSymbol(s);
if (! s.length())
{
if (plug.createNewStock())
{
f.close();
plug.close();
return;
}
chartIndex->getIndexItem(fn, item);
item.setSymbol(ts2);
item.setTitle(ts2);
item.setQuotePlugin(pluginName);
chartIndex->setIndexItem(fn, item);
}
// item.getQuotePlugin(s);
// if (s.compare(pluginName))
// {
// s = ts2 + " - " + tr("skipping update. Source does not match destination");
// printStatusLogMessage(s);
// f.close();
// plug.close();
// return;
// }
while(stream.atEnd() == 0)
{
ts = stream.readLine();
QStringList l = QStringList::split( '\n', substituteSeparator( ts, ',', '\n' ), FALSE);
if (l.count() < 5)
{
QString ss = tr("Parse: invalid number of parameters") + " '" + ts2 + "' " + tr("skipped");
printStatusLogMessage(ss);
errorList.append(ts2);
continue;
}
// date
QString date = parseDate(l[0]);
Bar bar;
if (bar.setDate(date))
{
//.........这里部分代码省略.........
示例10: QWidget
void StocksDialog::createDetailsPage ()
{
QWidget *w = new QWidget(this);
Q3VBoxLayout *vbox = new Q3VBoxLayout(w);
vbox->setMargin(5);
vbox->setSpacing(5);
Q3GridLayout *grid = new Q3GridLayout(vbox);
grid->setMargin(0);
grid->setSpacing(5);
QLabel *label = new QLabel(tr("Symbol"), w);
grid->addWidget(label, 0, 0);
QString s;
DBIndexItem item;
index->getIndexItem(symbol, item);
item.getSymbol(s);
label = new QLabel(s, w);
label->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken);
grid->addWidget(label, 0, 1);
label = new QLabel(tr("Name"), w);
grid->addWidget(label, 1, 0);
item.getTitle(s);
title = new QLineEdit(s, w);
grid->addWidget(title, 1, 1);
label = new QLabel(tr("Exchange"), w);
grid->addWidget(label, 2, 0);
item.getExchange(s);
Exchange ex;
ex.getExchange(s.toInt(), s);
label = new QLabel(s, w);
label->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken);
grid->addWidget(label, 2, 1);
label = new QLabel(tr("Type"), w);
grid->addWidget(label, 3, 0);
item.getType(s);
label = new QLabel(s, w);
label->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken);
grid->addWidget(label, 3, 1);
label = new QLabel(tr("First Date"), w);
grid->addWidget(label, 4, 0);
Bar bar;
db->getFirstBar(bar);
if (! bar.getEmptyFlag())
{
bar.getDateTimeString(TRUE, s);
label = new QLabel(s, w);
label->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken);
grid->addWidget(label, 4, 1);
}
label = new QLabel(tr("Last Date"), w);
grid->addWidget(label, 5, 0);
Bar bar2;
db->getLastBar(bar2);
if (! bar2.getEmptyFlag())
{
bar2.getDateTimeString(TRUE, s);
label = new QLabel(s, w);
label->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken);
grid->addWidget(label, 5, 1);
}
grid->expand(grid->numRows() + 1, grid->numCols());
grid->setColStretch(1, 1);
vbox->addStretch(1);
addTab(w, tr("Details"));
}
示例11: f
//.........这里部分代码省略.........
case 7:
fmonth = "N";
break;
case 8:
fmonth = "Q";
break;
case 9:
fmonth = "U";
break;
case 10:
fmonth = "V";
break;
case 11:
fmonth = "X";
break;
case 12:
fmonth = "Z";
break;
default:
break;
}
if (fd.setSymbol(symbol))
continue;
if (year.length())
{
symbol.append(year);
if (fmonth.length())
symbol.append(fmonth);
else
continue;
}
else
continue;
s = "Futures/";
QString s2;
fd.getExchange(s2);
s.append(s2 + "/");
fd.getSymbol(s2);
s.append(s2);
QString path;
createDirectory(s, path);
if (! path.length())
{
QString ss(tr("Unable to create futures directory"));
printStatusLogMessage(ss);
return;
}
s = path + "/" + symbol;
if (plug.open(s, chartIndex))
{
QString ss(tr("Could not open db"));
printStatusLogMessage(ss);
return;
}
DBIndexItem item;
chartIndex->getIndexItem(symbol, item);
item.getSymbol(s);
if (! s.length())
{
if (plug.createNewFutures())
return;
chartIndex->getIndexItem(symbol, item);
s = QString::number(Exchange::NYBOT);
item.setExchange(s);
item.setQuotePlugin(pluginName);
chartIndex->setIndexItem(symbol, item);
}
plug.setBar(bar);
plug.close();
emit signalWakeup();
}
f.close();
downloadComplete();
if (cancelFlag)
{
cancelFlag = FALSE;
QString ss(tr("Update cancelled"));
printStatusLogMessage(ss);
}
else
{
QString ss(tr("Done"));
printStatusLogMessage(ss);
}
}
示例12: qDebug
void Yahoo::createAutoHistoryUrls (QString &path, QString &d)
{
if (plug.open(path, chartIndex))
{
qDebug("Yahoo::createAutoHistoryUrls:could not open db");
return;
}
QFileInfo fi(path);
QString fn = fi.fileName();
// verify if this chart can be updated by this plugin
QString s;
DBIndexItem item;
chartIndex->getIndexItem(fn, item);
item.getQuotePlugin(s);
if (! s.length())
{
item.setQuotePlugin(pluginName);
chartIndex->setIndexItem(fn, item);
}
// else
// {
// if (s.compare(pluginName))
// {
// qDebug("Yahoo::createAutoHistoryUrls:source not same as destination");
// plug.close();
// return;
// }
// }
QDate edt = QDate::currentDate();
if (edt.dayOfWeek() == 6)
edt = edt.addDays(-1);
else
{
if (edt.dayOfWeek() == 7)
edt = edt.addDays(-2);
}
Bar bar;
plug.getLastBar(bar);
if (bar.getEmptyFlag())
{
QDate dt = edt;
dt = dt.addDays(-365);
s = dt.toString("yyyyMMdd000000");
bar.setDate(s);
}
QDateTime dt;
bar.getDate(dt);
if (dt.date() == edt)
{
// qDebug("Yahoo::createAutoHistoryUrls:barDate == endDate");
plug.close();
return;
}
s = "http://table.finance.yahoo.com/table.csv?s=";
s.append(d);
s.append("&a=");
s.append(QString::number(dt.date().month() - 1));
s.append("&b=");
s.append(dt.toString("dd"));
s.append("&c=");
s.append(dt.toString("yyyy"));
s.append("&d=");
s.append(QString::number(edt.month() - 1));
s.append("&e=");
s.append(edt.toString("dd"));
s.append("&f=");
s.append(edt.toString("yyyy"));
s.append("&g=d&ignore=.csv");
plug.close();
Setting *set = new Setting;
QString ts = "url";
set->setData(ts, s);
ts = "symbol";
set->setData(ts, d);
url.append(set);
}
示例13: fi
void Yahoo::parseFundamental ()
{
if (! data.length())
return;
if (data.contains("no data available"))
return;
QStringList l = QStringList::split("yfnc_tablehead1", data, FALSE);
int loop;
Setting fund;
for (loop = 1; loop < (int) l.count(); loop++)
{
QString k = l[loop];
int p = k.find(">", 0, TRUE);
if (p == -1)
continue;
p++;
k.remove(0, p);
p = k.find("<", 0, TRUE);
if (p == -1)
continue;
k.truncate(p);
if (k.contains("&sup"))
k.truncate(k.length() - 6);
if (k.contains("&"))
k.remove(k.find("&", 0, TRUE), 5);
k = k.stripWhiteSpace();
if (! k.length())
continue;
QString d = l[loop];
p = d.find("yfnc_tabledata1", 0, TRUE);
if (p == -1)
continue;
p = d.find(">", p, TRUE);
if (p == -1)
continue;
p++;
d.remove(0, p);
p = d.find("<", 0, TRUE);
if (p == -1)
continue;
d.truncate(p);
d = d.stripWhiteSpace();
if (! d.length())
continue;
fund.setData(k, d);
}
QString s = dataPath + "/";
QString ts = "symbol";
QString ts2;
currentUrl->getData(ts, ts2);
QFileInfo fi(ts2);
if (fi.extension(FALSE).length())
s.append(fi.extension(FALSE).upper());
else
s.append("US");
s.append("/");
s.append(ts2);
if (plug.open(s, chartIndex))
{
QString ss(tr("Could not open db"));
printStatusLogMessage(ss);
return;
}
QString fn = ts2;
// verify if this chart can be updated by this plugin
DBIndexItem item;
chartIndex->getIndexItem(fn, item);
item.getSymbol(s);
if (! s.length())
{
if(plug.createNewStock())
{
plug.close();
return;
}
chartIndex->getIndexItem(fn, item);
item.setQuotePlugin(pluginName);
item.setSymbol(ts2);
QString title = ts2;
int p = data.find("yfnc_leftnav1", 0, TRUE);
if (p != -1)
{
p = data.find("b>", p, TRUE);
if (p != -1)
{
p = p + 2;
int p2 = data.find("<", p, TRUE);
if (p2 != -1)
{
//.........这里部分代码省略.........
示例14: PrefDialog
bool DbPlugin::createNewCC (DBIndex *i)
{
FuturesData fd;
QStringList l;
fd.getSymbolList(l);
QString pl = QObject::tr("Parms");
QString fsl = QObject::tr("Futures Symbol");
QString gl = QObject::tr("Gapless");
PrefDialog *dialog = new PrefDialog(0);
dialog->setCaption(QObject::tr("New CC"));
dialog->createPage (pl);
dialog->setHelpFile(helpFile);
dialog->addComboItem(fsl, pl, l, 0);
dialog->addCheckItem(gl, pl, TRUE);
int rc = dialog->exec();
if (rc != QDialog::Accepted)
{
delete dialog;
return TRUE;
}
QString sym;
dialog->getCombo(fsl, sym);
bool f = dialog->getCheck(gl);
delete dialog;
QDir dir;
Config config;
QString s;
config.getData(Config::DataPath, s);
s.append("/CC");
if (! dir.exists(s))
{
if (! dir.mkdir(s, TRUE))
{
QMessageBox::information(0,
QObject::tr("Qtstalker: Error"),
QObject::tr("Could not create ~/.qtstalker/data/CC directory."));
return TRUE;
}
}
DBIndexItem item;
QString ts;
chartIndex->getIndexItem(sym, item);
item.getSymbol(ts);
if (ts.length())
{
qDebug("DbPlugin::createNewStock: duplicate symbol %s", ts.latin1());
return TRUE;
}
s.append("/" + sym);
if (open(s, i))
{
QMessageBox::information(0,
QObject::tr("Qtstalker: Error"),
QObject::tr("Disk error, cannot create chart"));
return TRUE;
}
type = CC1;
item.setSymbol(sym);
s = "CC";
item.setType(s);
s = sym + " - " + QObject::tr("Continuous Adjusted");
item.setTitle(s);
chartIndex->setIndexItem(indexKey, item);
s = QString::number(f);
sym = "Adjustment";
setData(sym, s);
return FALSE;
}
示例15: saveHeaderData
void UpgradeMessage::saveHeaderData (DbPlugin &db, QString &k, QString &d, QString &sym, DBIndexItem &item)
{
// is this a co key?
bool ok = FALSE;
double t = k.toDouble(&ok);
if (ok)
{
if (t < 10000)
{
// its a chart object
Setting t;
t.parse(d);
QString s = "Plugin";
QString s2;
t.getData(s,s2);
if (s2.length())
{
t.remove(s);
s = "Type";
t.setData(s, s2);
}
s = "Plot";
t.getData(s, s2);
if (! s2.compare("Main Plot"))
{
s2 = "Bars";
t.setData(s, s2);
}
else
return;
index.setChartObject(sym, k, t);
return;
}
}
if (! k.compare("Type"))
{
item.setType(d);
return;
}
if (! k.compare("FuturesType"))
{
item.setFuturesType(d);
return;
}
if (! k.compare("FuturesMonth"))
{
item.setFuturesMonth(d);
return;
}
if (! k.compare("BarType"))
{
item.setBarType(d);
return;
}
if (! k.compare("Fundamentals"))
{
index.setFundamentals(sym, d);
return;
}
if (! k.compare("LocalIndicators"))
{
index.addIndicator(sym, d);
return;
}
if (! k.compare("QuotePlugin"))
{
item.setQuotePlugin(d);
return;
}
if (! k.compare("Symbol"))
{
item.setSymbol(d);
return;
}
if (! k.compare("Title"))
{
item.setTitle(d);
return;
}
if (! k.compare("Path"))
{
item.setPath(d);
return;
}
if (! k.compare("SpreadFirstSymbol"))
{
int t = d.find("/data0/", 0, TRUE);
//.........这里部分代码省略.........