本文整理汇总了C++中mautil::Vector类的典型用法代码示例。如果您正苦于以下问题:C++ Vector类的具体用法?C++ Vector怎么用?C++ Vector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initVBO
void TriangleStripVBO::initVBO(const MAUtil::Vector<TriangleStrip>& strips) {
/**/ // VBO code
glGenBuffers(1, &mVBO);
glBindBuffer(GL_ARRAY_BUFFER, mVBO);
int totalDataSize = 0;
int vertexCoordOffset = 0;
int textureCoordOffset = 0;
mTriangleStrips.clear();
for(int i = 0; i < strips.size(); i++)
{
textureCoordOffset = vertexCoordOffset + strips[i].vertices.size()*sizeof(vec3);
mTriangleStrips.add(TriangleStripInfo(vertexCoordOffset, textureCoordOffset, strips[i].vertices.size()));
vertexCoordOffset = textureCoordOffset + strips[i].textureCoordinates.size()*sizeof(vec2);
}
totalDataSize = vertexCoordOffset;
glBufferData(GL_ARRAY_BUFFER, totalDataSize, NULL, GL_STATIC_DRAW);
for(int i = 0; i < strips.size(); i++)
{
glBufferSubData(GL_ARRAY_BUFFER, mTriangleStrips[i].vertexCoordOffset, mTriangleStrips[i].numVertices*sizeof(vec3), &strips[i].vertices[0]);
glBufferSubData(GL_ARRAY_BUFFER, mTriangleStrips[i].textureCoordOffset, mTriangleStrips[i].numVertices*sizeof(vec2), &strips[i].textureCoordinates[0]);
}
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
示例2: addNotesButton
/**
* Creates a button and adds it to the main menu
* Adds on the button a command that sends the connection request to Facebook
*/
void FacebookDemoMoblet::addNotesButton(FacebookDemoGUI::FacebookDemoScreen *menu)
{
using namespace FacebookDemoGUI;
using namespace FacebookDemoApplication;
OpenMenuCommand *notesButtonCmd = new OpenMenuCommand(menu);
/**
* We only want to retrieve from Facebook the "id", "subject" and "from" fields from an Album object
*/
MAUtil::Vector<MAUtil::String> fields;
fields.add("id");
fields.add("subject");
// fields.add("from");
ConnectionRequestCommand *displayNotesCmd = new ConnectionRequestCommand( mFacebookManager,
notesButtonCmd->getMenuScreen(),
Connections<User>::notes(), fields, "me");
ListItem *displayNotes = new ListItem(displayNotesCmd, "Display notes");
notesButtonCmd->addMenuItem(displayNotes);
//create new friend list
AddCommand<Note> *createNoteCmd = new AddCommand<Note>( mFacebookManager,
notesButtonCmd->getMenuScreen());
createNoteCmd->setNoteParams("New note created with MOSYNC_SDK", "Testing creating a note with Facebook library");
ListItem *createNote = new ListItem(createNoteCmd, "Create Note");
notesButtonCmd->addMenuItem(createNote);
ListItem *listsButton = new ListItem(notesButtonCmd, "notes");
menu->add(listsButton);
}
示例3: addCheckinsButton
/**
* Creates a button and adds it to the main menu
* Adds on the button a command that sends the connection request to Facebook
*/
void FacebookDemoMoblet::addCheckinsButton(FacebookDemoGUI::FacebookDemoScreen *menu)
{
using namespace FacebookDemoGUI;
using namespace FacebookDemoApplication;
OpenMenuCommand *checkinsButtonCmd = new OpenMenuCommand(menu);
/**
* We only want to retrieve from Facebook the "place" and "id" fields from an Checkin object
*/
MAUtil::Vector<MAUtil::String> fields;
fields.add("id");
fields.add("place");
//fields.add("application");
ConnectionRequestCommand *displayCheckinsCmd = new ConnectionRequestCommand( mFacebookManager,
checkinsButtonCmd->getMenuScreen(), Connections<User>::checkins(), fields, "me");
ListItem *displayCheckins = new ListItem(displayCheckinsCmd, "display checkins");
checkinsButtonCmd->addMenuItem(displayCheckins);
//create new checkin
AddCommand<Checkin> *createCheckinCmd = new AddCommand<Checkin>( mFacebookManager,
checkinsButtonCmd->getMenuScreen());
MAUtil::String placeIdMoSync = "126381597427662";
Coordinate coordMoSync;
coordMoSync.mLatitude = "59.339451";
coordMoSync.mLongitude = "18.05798";
createCheckinCmd->setCheckinParams(placeIdMoSync, coordMoSync);
ListItem *createCheckin = new ListItem(createCheckinCmd, "create checkin");
checkinsButtonCmd->addMenuItem(createCheckin);
ListItem *checkinsButton = new ListItem(checkinsButtonCmd, "checkins");
menu->add(checkinsButton);
}
示例4: readCountryTableFile
/**
* Reads the CountryTable file.
* Data will be written into mCountryFileNames.
*/
void DatabaseManager::readCountryTableFile()
{
// Reset array.
mCountryFileNames.clear();
// Open CountryTable file.
MAUtil::String filePath = mFileUtil->getLocalPath() + COUNTRY_TABLE_FILE_NAME;
MAUtil::String fileContent;
if (!mFileUtil->readTextFromFile(filePath, fileContent))
{
printf("Cannot read text from CountryTable");
return;
}
//Read file content.
MAUtil::YAJLDom::Value* root = MAUtil::YAJLDom::parse(
(const unsigned char*)fileContent.c_str(), fileContent.size());
MAUtil::YAJLDom::Value* countries = root->getValueForKey(sCountriesKey);
MAUtil::YAJLDom::ArrayValue* countriesArray = (MAUtil::YAJLDom::ArrayValue*) countries;
MAUtil::Vector<MAUtil::YAJLDom::Value*> allCountries = countriesArray->getValues();
// Get all country files that we should read next.
for (int index = 0; index < allCountries.size(); index++)
{
MAUtil::YAJLDom::Value* countryValue = allCountries[index];
MAUtil::String countryFileName = countryValue->toString();
mCountryFileNames.add(countryFileName);
}
delete root;
}
示例5: addStatusMessagesButton
/**
* Creates a button and adds it to the main menu
* Adds on the button a command that sends the connection request to Facebook
*/
void FacebookDemoMoblet::addStatusMessagesButton(FacebookDemoGUI::FacebookDemoScreen *menu)
{
using namespace FacebookDemoGUI;
using namespace FacebookDemoApplication;
OpenMenuCommand *statusButtonCmd = new OpenMenuCommand(menu);
/**
* We only want to retrieve from Facebook the "name", "id", "message" fields from an StatusMessage object
*/
MAUtil::Vector<MAUtil::String> fields;
fields.add("id");
fields.add("message");
ConnectionRequestCommand *displayStatusesCmd = new ConnectionRequestCommand( mFacebookManager,
menu, Connections<User>::statuses(), fields, "me");
ListItem *displayStatuses = new ListItem(displayStatusesCmd, "Display status messages");
statusButtonCmd->addMenuItem(displayStatuses);
//create new status message
AddCommand<StatusMessage> *createStatusMsgCmd = new AddCommand<StatusMessage>( mFacebookManager, menu);
createStatusMsgCmd->setMessage("New status message created with MOSYNC_SDK");
ListItem *createStatusMsg = new ListItem(createStatusMsgCmd, "Create StatusMessage");
statusButtonCmd->addMenuItem(createStatusMsg);
ListItem *statusButton = new ListItem(statusButtonCmd, "status messages");
menu->add(statusButton);
}
示例6: addAlbumsButton
/**
* Creates a button and adds it to the main menu
* Adds on the button a command that sends the connection request to Facebook
*/
void FacebookDemoMoblet::addAlbumsButton(FacebookDemoGUI::FacebookDemoScreen *menu)
{
using namespace FacebookDemoGUI;
using namespace FacebookDemoApplication;
OpenMenuCommand *albumsButtonCmd = new OpenMenuCommand(menu);
/**
* We only want to retrieve from Facebook the "name", "id", "description" and "count" fields from an Album object
*/
MAUtil::Vector<MAUtil::String> fields;
fields.add("name");
fields.add("id");
// fields.add("description");
// fields.add("count");
ConnectionRequestCommand *displayAlbumsCmd = new ConnectionRequestCommand( mFacebookManager,
albumsButtonCmd->getMenuScreen(),
Connections<User>::albums(), fields, "me");
ListItem *displayAlbums = new ListItem(displayAlbumsCmd, "display albums");
albumsButtonCmd->addMenuItem(displayAlbums);
//create new album
AddCommand<Album> *createAlbumCmd = new AddCommand<Album>( mFacebookManager,
albumsButtonCmd->getMenuScreen());
createAlbumCmd->setAlbumName("New album created with MOSYNC_SDK");
ListItem *createAlbum = new ListItem(createAlbumCmd, "create album");
albumsButtonCmd->addMenuItem(createAlbum);
ListItem *albumsButton = new ListItem(albumsButtonCmd, "albums");
menu->add(albumsButton);
}
示例7: testConnectOverload
void testConnectOverload(const char* url, bool acceptSuccess) {
int connects = 0, events = 0;
int result = 0;
int conn;
bool hasConn = false;
MAUtil::Vector<Handle> conns;
do {
EVENT event;
while(maGetEvent(&event)) {
if(event.type == EVENT_TYPE_CLOSE ||
(event.type == EVENT_TYPE_KEY_PRESSED && event.key == MAK_0))
{
maExit(0);
} else if(event.type == EVENT_TYPE_CONN) {
printf("Op %i conn %i result %i\n", event.conn.opType, event.conn.handle, event.conn.result);
MAASSERT(event.conn.opType == CONNOP_CONNECT);
conn = event.conn.handle;
if(acceptSuccess) {
if(event.conn.result < 0) {
result = event.conn.result;
}
} else {
result = event.conn.result;
}
MAASSERT(event.conn.result != 0);
hasConn = true;
events++;
printf("Event %i\n", events);
break;
}
}
if(result == 0) {
conn = maConnect(url);
conns.add(conn);
if(conn < 0) {
printf("maConnect error %i\n", conn);
result = conn;
hasConn = false;
} else {
connects++;
printf("Connect %i\n", connects);
}
} else if(events != connects)
maWait(0);
} while(events != connects);// && connects < 3);
if(hasConn) {
printf("Result %i on handle %i after %i connects\n", result, conn, connects);
} else {
printf("Result %i after %i connects\n", result, connects);
}
printf("Closing %i handles\n", conns.size());
for(int i=0; i<conns.size(); i++) {
maConnClose(conns[i]);
}
printf("Done.\n");
}
示例8:
/**
* Provides the titles.
* Only for the checked ones.
*/
MAUtil::Vector<MAUtil::String> MediaWiki::getAllCheckedTitles()
{
MAUtil::Vector<MAUtil::String> list;
for (int i=0; i < mWiki->titleResults.size(); i++)
{
if ( !isItemHidden(i) )
{
list.add(mWiki->titleResults[i]);
}
}
return list;
}
示例9: eraseExpected
// Helper function for removing an entry from the expected list.
void eraseExpected(
MAUtil::Vector<MAUtil::String>& v,
const MAUtil::String& s)
{
for (int i = 0; i < v.size(); ++i)
{
if (v[i] == s)
{
v.remove(i);
return;
}
}
}
示例10: addLinksButton
/**
* Creates a button and adds it to the main menu
* Adds on the button a command that sends the connection request to Facebook
*/
void FacebookDemoMoblet::addLinksButton(FacebookDemoGUI::FacebookDemoScreen *menu)
{
using namespace FacebookDemoGUI;
using namespace FacebookDemoApplication;
MAUtil::Vector<MAUtil::String> fields;
fields.add("id");
fields.add("name");
// fields.add("message");
ConnectionRequestCommand *displayLinksCmd = new ConnectionRequestCommand( mFacebookManager, menu,
Connections<User>::links(), fields, "me");
ListItem *button = new ListItem(displayLinksCmd, "links");
menu->add(button);
}
示例11: postRequest
/**
* Post an HTTP request.
*
* The HTTP header parameters must be a vector (possibly empty)
* of strings, ordered as key/value pairs.
*
* @param url The url of the POST request.
* @param httpParams HTTP header parameters.
* @param requestBody Data written to the request body.
* @param requestLength Length of the request body.
*
* @return WORMHOLE_HTTP_SUCCESS if successful, WORMHOLE_HTTP_ERROR on error.
*/
int HighLevelHttpConnection::postRequest(
const char* url,
MAUtil::Vector<MAUtil::String>& httpParams,
const void* requestBody,
int requestLength)
{
// Create request.
int result = create(url, HTTP_POST);
if (result < 0)
{
return WORMHOLE_HTTP_ERROR;
}
// Write headers.
for (int i = 0; i < httpParams.size(); i = i + 2)
{
setRequestHeader(
httpParams[i].c_str(),
httpParams[i + 1].c_str());
}
// Write request data.
write(requestBody, requestLength);
// Next that happens is that connWriteFinished is called.
return WORMHOLE_HTTP_SUCCESS;
}
示例12: setComments
void Video::setComments(const MAUtil::Vector<Comment> &comments)
{
mComments.clear();
for(int i=0; i<comments.size(); i++)
{
mComments.add(comments[i]);
}
}
示例13: setTags
void Video::setTags(MAUtil::Vector<IdNamePair> &tags)
{
mTags.clear();
for(int i=0; i<tags.size(); i++)
{
mTags.add(tags[i]);
}
}
示例14: addPhotosButton
/**
* Creates a button and adds it to the main menu
* Adds on the button a command that sends the connection request to Facebook
*/
void FacebookDemoMoblet::addPhotosButton(FacebookDemoGUI::FacebookDemoScreen *menu)
{
using namespace FacebookDemoGUI;
using namespace FacebookDemoApplication;
/**
* We only want to retrieve from Facebook the "from", "name" and "id" fields from an Photo object
*/
MAUtil::Vector<MAUtil::String> fields;
fields.add("from");
// fields.add("name");
fields.add("id");
ConnectionRequestCommand *displayPhotosCmd = new ConnectionRequestCommand( mFacebookManager, menu,
Connections<User>::photos(), fields, "me");
ListItem *button = new ListItem(displayPhotosCmd, "photos");
menu->add(button);
}
示例15:
/**
* Gets the current map visible area.
* @return A vector containing two location points: the upper left corner and the lower right corner if
* the value from the runtime is corrent and NULL otherwise.
*/
MAUtil::Vector<Location> Map::getVisibleArea()
{
MAUtil::Vector<Location> corners;
MAUtil::String upperLeftCornerLatitude = this->getPropertyString(MAW_MAP_VISIBLE_AREA_UPPER_LEFT_CORNER_LATITUDE);
MAUtil::String upperLeftCornerLongitude = this->getPropertyString(MAW_MAP_VISIBLE_AREA_UPPER_LEFT_CORNER_LONGITUDE);
MAUtil::String lowerRightCornerLatitude = this->getPropertyString(MAW_MAP_VISIBLE_AREA_LOWER_RIGHT_CORNER_LATITUDE);
MAUtil::String lowerRightCornerLongitude = this->getPropertyString(MAW_MAP_VISIBLE_AREA_LOWER_RIGHT_CORNER_LONGITUDE);
Location upperLeftCorner, lowerRightCorner;
upperLeftCorner.setLatitude(MAUtil::stringToDouble(upperLeftCornerLatitude));
upperLeftCorner.setLongitude(MAUtil::stringToDouble(upperLeftCornerLongitude));
lowerRightCorner.setLatitude(MAUtil::stringToDouble(lowerRightCornerLatitude));
lowerRightCorner.setLongitude(MAUtil::stringToDouble(lowerRightCornerLongitude));
corners.add(upperLeftCorner);
corners.add(lowerRightCorner);
return corners;
}