本文整理汇总了C++中common::List类的典型用法代码示例。如果您正苦于以下问题:C++ List类的具体用法?C++ List怎么用?C++ List使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了List类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Common::List<Graphics::PixelFormat> OSystem_Wii::getSupportedFormats() const {
Common::List<Graphics::PixelFormat> res;
res.push_back(_pfRGB565);
res.push_back(Graphics::PixelFormat::createFormatCLUT8());
return res;
}
示例2: clearList
void clearList(Common::List<T> &list) {
while (!list.empty()) {
T p = list.front();
list.erase(list.begin());
delete p;
}
}
示例3: detectMessageFunctionType
SciVersion GameFeatures::detectMessageFunctionType() {
if (_messageFunctionType != SCI_VERSION_NONE)
return _messageFunctionType;
if (getSciVersion() > SCI_VERSION_1_1) {
_messageFunctionType = SCI_VERSION_1_1;
return _messageFunctionType;
} else if (getSciVersion() < SCI_VERSION_1_1) {
_messageFunctionType = SCI_VERSION_1_LATE;
return _messageFunctionType;
}
Common::List<ResourceId> resources = g_sci->getResMan()->listResources(kResourceTypeMessage, -1);
if (resources.empty()) {
// No messages found, so this doesn't really matter anyway...
_messageFunctionType = SCI_VERSION_1_1;
return _messageFunctionType;
}
Resource *res = g_sci->getResMan()->findResource(*resources.begin(), false);
assert(res);
// Only v2 Message resources use the kGetMessage kernel function.
// v3-v5 use the kMessage kernel function.
if (READ_SCI11ENDIAN_UINT32(res->data) / 1000 == 2)
_messageFunctionType = SCI_VERSION_1_LATE;
else
_messageFunctionType = SCI_VERSION_1_1;
debugC(1, kDebugLevelVM, "Detected message function type: %s", getSciVersionDesc(_messageFunctionType));
return _messageFunctionType;
}
示例4: getThemeFile
Common::String ThemeEngine::getThemeFile(const Common::String &id) {
// FIXME: Actually "default" rather sounds like it should use
// our default theme which would mean "scummmodern" instead
// of the builtin one.
if (id.equalsIgnoreCase("default"))
return Common::String();
// For our builtin theme we don't have to do anything for now too
if (id.equalsIgnoreCase("builtin"))
return Common::String();
Common::FSNode node(id);
// If the given id is a full path we'll just use it
if (node.exists() && (node.isDirectory() || node.getName().matchString("*.zip", true)))
return id;
// FIXME:
// A very ugly hack to map a id to a filename, this will generate
// a complete theme list, thus it is slower than it could be.
// But it is the easiest solution for now.
Common::List<ThemeDescriptor> list;
listUsableThemes(list);
for (Common::List<ThemeDescriptor>::const_iterator i = list.begin(); i != list.end(); ++i) {
if (id.equalsIgnoreCase(i->id))
return i->filename;
}
warning("Could not find theme '%s' falling back to builtin", id.c_str());
// If no matching id has been found we will
// just fall back to the builtin theme
return Common::String();
}
示例5: listUsableThemes
void ThemeEngine::listUsableThemes(const Common::FSNode &node, Common::List<ThemeDescriptor> &list, int depth) {
if (!node.exists() || !node.isReadable() || !node.isDirectory())
return;
ThemeDescriptor td;
// Check whether we point to a valid theme directory.
if (themeConfigUsable(node, td.name)) {
td.filename = node.getPath();
td.id = node.getName();
list.push_back(td);
// A theme directory should never contain any other themes
// thus we just return to the caller here.
return;
}
Common::FSList fileList;
// Check all files. We need this to find all themes inside ZIP archives.
if (!node.getChildren(fileList, Common::FSNode::kListFilesOnly))
return;
for (Common::FSList::iterator i = fileList.begin(); i != fileList.end(); ++i) {
// We will only process zip files for now
if (!i->getPath().matchString("*.zip", true))
continue;
td.name.clear();
if (themeConfigUsable(*i, td.name)) {
td.filename = i->getPath();
td.id = i->getName();
// If the name of the node object also contains
// the ".zip" suffix, we will strip it.
if (td.id.matchString("*.zip", true)) {
for (int j = 0; j < 4; ++j)
td.id.deleteLastChar();
}
list.push_back(td);
}
}
fileList.clear();
// Check if we exceeded the given recursion depth
if (depth - 1 == -1)
return;
// As next step we will search all subdirectories
if (!node.getChildren(fileList, Common::FSNode::kListDirectoriesOnly))
return;
for (Common::FSList::iterator i = fileList.begin(); i != fileList.end(); ++i)
listUsableThemes(*i, list, depth == -1 ? - 1 : depth - 1);
}
示例6:
Common::List<Graphics::PixelFormat> OSystem_Android::getSupportedFormats() const {
Common::List<Graphics::PixelFormat> res;
res.push_back(GLES565Texture::pixelFormat());
res.push_back(GLES5551Texture::pixelFormat());
res.push_back(GLES4444Texture::pixelFormat());
res.push_back(Graphics::PixelFormat::createFormatCLUT8());
return res;
}
示例7:
Common::List<Graphics::PixelFormat> TizenGraphicsManager::getSupportedFormats() const {
logEntered();
Common::List<Graphics::PixelFormat> res;
res.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0));
res.push_back(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
res.push_back(Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0));
res.push_back(Graphics::PixelFormat::createFormatCLUT8());
return res;
}
示例8:
Common::List<Graphics::PixelFormat> OSystem_3DS::getSupportedFormats() const {
Common::List<Graphics::PixelFormat> list;
list.push_back(Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0)); // GPU_RGBA8
list.push_back(Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0)); // GPU_RGB565
// list.push_back(Graphics::PixelFormat(3, 0, 0, 0, 8, 0, 8, 16, 0)); // GPU_RGB8
list.push_back(Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)); // RGB555 (needed for FMTOWNS?)
list.push_back(Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0)); // GPU_RGBA5551
list.push_back(Graphics::PixelFormat::createFormatCLUT8());
return list;
}
示例9:
Common::List<Graphics::PixelFormat> DisplayManager::getSupportedPixelFormats() const {
Common::List<Graphics::PixelFormat> list;
// In order of preference
list.push_back(PSPPixelFormat::convertToScummvmPixelFormat(PSPPixelFormat::Type_5650));
list.push_back(PSPPixelFormat::convertToScummvmPixelFormat(PSPPixelFormat::Type_5551));
list.push_back(PSPPixelFormat::convertToScummvmPixelFormat(PSPPixelFormat::Type_4444));
list.push_back(Graphics::PixelFormat::createFormatCLUT8());
return list;
}
示例10: updateState
void ViewManager::updateState() {
Common::List<View *> viewList = _views;
for (ListIterator i = viewList.begin(); i != viewList.end(); ++i) {
if (_vm->_events->quitFlag)
return;
View *v = *i;
v->updateState();
}
}
示例11: findCompatibleFormat
/**
* Determines the first matching format between two lists.
*
* @param backend The higher priority list, meant to be a list of formats supported by the backend
* @param frontend The lower priority list, meant to be a list of formats supported by the engine
* @return The first item on the backend list that also occurs on the frontend list
* or PixelFormat::createFormatCLUT8() if no matching formats were found.
*/
inline PixelFormat findCompatibleFormat(Common::List<PixelFormat> backend, Common::List<PixelFormat> frontend) {
#ifdef USE_RGB_COLOR
for (Common::List<PixelFormat>::iterator i = backend.begin(); i != backend.end(); ++i) {
for (Common::List<PixelFormat>::iterator j = frontend.begin(); j != frontend.end(); ++j) {
if (*i == *j)
return *i;
}
}
#endif
return PixelFormat::createFormatCLUT8();
}
示例12: findCompatibleFormat
/**
* Determines the first matching format between two lists.
*
* @param backend The higher priority list, meant to be a list of formats supported by the backend
* @param frontend The lower priority list, meant to be a list of formats supported by the engine
* @return The first item on the backend list that also occurs on the frontend list
* or PixelFormat::createFormatCLUT8() if no matching formats were found.
*/
inline Graphics::PixelFormat findCompatibleFormat(const Common::List<Graphics::PixelFormat> &backend, const Common::List<Graphics::PixelFormat> &frontend) {
#ifdef USE_RGB_COLOR
for (Common::List<Graphics::PixelFormat>::const_iterator i = backend.begin(); i != backend.end(); ++i) {
for (Common::List<Graphics::PixelFormat>::const_iterator j = frontend.begin(); j != frontend.end(); ++j) {
if (*i == *j)
return *i;
}
}
#endif
return Graphics::PixelFormat::createFormatCLUT8();
}
示例13: parseCriteria
bool ScriptManager::parseCriteria(Common::SeekableReadStream &stream, Common::List<Common::List<Puzzle::CriteriaEntry> > &criteriaList) const {
// Loop until we find the closing brace
Common::String line = stream.readLine();
trimCommentsAndWhiteSpace(&line);
// Criteria can be empty
if (line.contains('}')) {
return false;
}
// Create a new List to hold the CriteriaEntries
criteriaList.push_back(Common::List<Puzzle::CriteriaEntry>());
while (!stream.eos() && !line.contains('}')) {
Puzzle::CriteriaEntry entry;
// Split the string into tokens using ' ' as a delimiter
Common::StringTokenizer tokenizer(line);
Common::String token;
// Parse the id out of the first token
token = tokenizer.nextToken();
sscanf(token.c_str(), "[%u]", &(entry.key));
// Parse the operator out of the second token
token = tokenizer.nextToken();
if (token.c_str()[0] == '=')
entry.criteriaOperator = Puzzle::EQUAL_TO;
else if (token.c_str()[0] == '!')
entry.criteriaOperator = Puzzle::NOT_EQUAL_TO;
else if (token.c_str()[0] == '>')
entry.criteriaOperator = Puzzle::GREATER_THAN;
else if (token.c_str()[0] == '<')
entry.criteriaOperator = Puzzle::LESS_THAN;
// First determine if the last token is an id or a value
// Then parse it into 'argument'
token = tokenizer.nextToken();
if (token.contains('[')) {
sscanf(token.c_str(), "[%u]", &(entry.argument));
entry.argumentIsAKey = true;
} else {
sscanf(token.c_str(), "%u", &(entry.argument));
entry.argumentIsAKey = false;
}
criteriaList.back().push_back(entry);
line = stream.readLine();
trimCommentsAndWhiteSpace(&line);
}
return true;
}
示例14: getNewFrame
void RMWindow::getNewFrame(RMGfxTargetBuffer &bigBuf, Common::Rect *rcBoundEllipse) {
// Get a pointer to the bytes of the source buffer
byte *lpBuf = bigBuf;
if (rcBoundEllipse != NULL) {
// Circular wipe effect
getNewFrameWipe(lpBuf, *rcBoundEllipse);
_wiping = true;
} else if (_wiping) {
// Just finished a wiping effect, so copy the full screen
copyRectToScreen(lpBuf, RM_SX * 2, 0, 0, RM_SX, RM_SY);
_wiping = false;
} else {
// Standard screen copy - iterate through the dirty rects
Common::List<Common::Rect> dirtyRects = bigBuf.getDirtyRects();
Common::List<Common::Rect>::iterator i;
// If showing dirty rects, copy the entire screen background and set up a surface pointer
Graphics::Surface *s = NULL;
if (_showDirtyRects) {
copyRectToScreen(lpBuf, RM_SX * 2, 0, 0, RM_SX, RM_SY);
s = g_system->lockScreen();
}
for (i = dirtyRects.begin(); i != dirtyRects.end(); ++i) {
Common::Rect &r = *i;
const byte *lpSrc = lpBuf + (RM_SX * 2) * r.top + (r.left * 2);
copyRectToScreen(lpSrc, RM_SX * 2, r.left, r.top, r.width(), r.height());
}
if (_showDirtyRects) {
for (i = dirtyRects.begin(); i != dirtyRects.end(); ++i) {
// Frame the copied area with a rectangle
s->frameRect(*i, 0xffffff);
}
g_system->unlockScreen();
}
}
if (_bGrabThumbnail) {
// Need to generate a thumbnail
RMSnapshot s;
s.grabScreenshot(lpBuf, 4, _wThumbBuf);
_bGrabThumbnail = false;
}
// Clear the dirty rect list
bigBuf.clearDirtyRects();
}
示例15: freeList
void Location::freeList(Common::List<T> &list, bool removeAll, Common::MemFunc1<bool, T, Location> filter) {
typedef typename Common::List<T>::iterator iterator;
iterator it = list.begin();
while (it != list.end()) {
T z = *it;
if (!removeAll && filter(this, z)) {
++it;
} else {
z->_commands.clear();
it = list.erase(it);
}
}
}