I am pulling in a twitter feed with OF and I would like to add this string data to an array. The following code is pulling in the twitter data.
The specific string data I want in the array is within tweets[i].title. I would like an array to store this data and constantly add to this array, therefore growing a small database.
Could anyone suggest how this may be done?
void testApp::setup(){
twitterPage = 1;
twitter.setup();
twitter.setSearchDelegate(this);
twitter.startTwitterQuery("giggs", 10, twitterPage);
millis = ofGetElapsedTimeMillis();
}
//--------------------------------------------------------------
void testApp::update(){
if ( ABS(ofGetElapsedTimeMillis()-millis) > 10000) {
twitterPage = ++twitterPage % 5;
twitter.startTwitterQuery("giggs", 10, twitterPage);
millis = ofGetElapsedTimeMillis();
}
}
//--------------------------------------------------------------
void testApp::draw(){
ofBackground(255, 255, 255);
for(int i=0; i<tweets.size(); i++) {
ofSetColor(0, 0, 0);
ofDrawBitmapString(tweets[i].author.name, 50, 35+i*40);
ofDrawBitmapString(tweets[i].title, 50, 50+i*40);
//cout << tweets[i].author.name;
cout << tweets[i].title;
}
}
void testApp::searchResult(vector<Tweet> results) {
tweets.clear();
for(int i=0; i<results.size(); i++) {
tweets.push_back(results[i]);
cout << results[i].print() << endl << endl;
}
}