bool AlchemyList::printSymbolList() { YahooStockDataSource yahoo(getContext()); std::vector<StockID> stockList; if (yahoo.getStockList(stockList)) { std::vector<StockID>::const_iterator end = stockList.end(); std::vector<StockID>::const_iterator iter; for (iter = stockList.begin(); iter != end; ++iter) { std::cout << *iter << "\n"; } getContext() << Context::PRIORITY_info << "Wrote " << stockList.size() << " symbols to STDOUT" << Context::endl; getContext() << Context::PRIORITY_info << "Store the list of symbols you wish to retrieve " << "in the file '" << PathRegistry::getSymbolFile() << "'" << Context::endl; return true; } else { getContext() << Context::PRIORITY_error << "Failed to get stock list" << Context::endl; return false; } }
void PictureViewer::HandleSimpleData(BMessage *e) { WindowPeek* motherWindow = ((WindowPeek*)Window()); // CASE 1: we have files entry_ref *ref = new entry_ref; if ( e->FindRef("refs",ref) == B_OK ) { BEntry *file = new BEntry(ref, true); if (motherWindow->IsType( file, "image" )) motherWindow->LoadImage(file); delete file; } delete ref; // CASE 2: we don't have a file. // make sure we're not wasting our time // if ( strcmp(e->FindString("source"),"Peek") == 0 ) { // return; // } const char *m_type; int32 i = 0, action; while ( e->FindInt32("be:actions",i,&action) == B_OK && action != B_COPY_TARGET) i++; if (action != B_COPY_TARGET) return; i = 0; while (e->FindString("be:types",i,&m_type) == B_OK && !SupportedFormat(m_type)) i++; if (!m_type) return; BMessage yahoo(B_COPY_TARGET); yahoo.AddString("be:types",m_type); e->SendReply(&yahoo,this); }