本文整理汇总了C++中wxArrayString::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ wxArrayString::push_back方法的具体用法?C++ wxArrayString::push_back怎么用?C++ wxArrayString::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxArrayString
的用法示例。
在下文中一共展示了wxArrayString::push_back方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getFlags
void getFlags(const Model::GameConfig::FlagConfigList& flags, wxArrayString& names, wxArrayString& descriptions) {
Model::GameConfig::FlagConfigList::const_iterator it, end;
for (it = flags.begin(), end = flags.end(); it != end; ++it) {
const Model::GameConfig::FlagConfig& flag = *it;
names.push_back(flag.name);
descriptions.push_back(flag.description);
}
}
示例2: EnumCameras
bool GuideCamera::EnumCameras(wxArrayString& names, wxArrayString& ids)
{
names.clear();
names.push_back(wxString::Format(_("Camera %d"), 1));
ids.clear();
ids.push_back(DEFAULT_CAMERA_ID);
return false;
}
示例3: SetArguments
void wxCmdLineParserData::SetArguments(const wxString& cmdLine)
{
m_arguments.clear();
if(wxTheApp && wxTheApp->argc > 0)
m_arguments.push_back(wxTheApp->argv[0]);
else
m_arguments.push_back(wxEmptyString);
wxArrayString args = wxCmdLineParser::ConvertStringToArgs(cmdLine);
WX_APPEND_ARRAY(m_arguments, args);
}
示例4: wxUnusedVar
wxString
wxGUIAppTraits::GetStandardCmdLineOptions(wxArrayString& names,
wxArrayString& desc) const
{
wxString usage;
#ifdef __WXGTK26__
#ifndef __WXGTK3__
if (!gtk_check_version(2,6,0))
#endif
{
// since GTK>=2.6, we can use the glib_check_version() symbol...
// check whether GLib version is greater than 2.6 but also lower than 2.33
// because, as we use the undocumented _GOptionGroup struct, we don't want
// to run this code with future versions which might change it (2.32 is the
// latest one at the time of this writing)
if (glib_check_version(2,6,0) == NULL && glib_check_version(2,33,0))
{
usage << _("The following standard GTK+ options are also supported:\n");
// passing true here means that the function can open the default
// display while parsing (not really used here anyhow)
GOptionGroup *gtkOpts = gtk_get_option_group(true);
// WARNING: here we access the internals of GOptionGroup:
GOptionEntry *entries = ((_GOptionGroup*)gtkOpts)->entries;
unsigned int n_entries = ((_GOptionGroup*)gtkOpts)->n_entries;
wxArrayString namesOptions, descOptions;
for ( size_t n = 0; n < n_entries; n++ )
{
if ( entries[n].flags & G_OPTION_FLAG_HIDDEN )
continue; // skip
names.push_back(wxGetNameFromGtkOptionEntry(&entries[n]));
const gchar * const entryDesc = entries[n].description;
desc.push_back(wxString(entryDesc));
}
g_option_group_free (gtkOpts);
}
}
#else
wxUnusedVar(names);
wxUnusedVar(desc);
#endif // __WXGTK26__
return usage;
}
示例5: wordTokenizer
void
wxGridCellAutoWrapStringRenderer::BreakLine(wxDC& dc,
const wxString& logicalLine,
wxCoord maxWidth,
wxArrayString& lines)
{
wxCoord lineWidth = 0;
wxString line;
// For each word
wxStringTokenizer wordTokenizer(logicalLine, wxS(" \t"), wxTOKEN_RET_DELIMS);
while ( wordTokenizer.HasMoreTokens() )
{
const wxString word = wordTokenizer.GetNextToken();
const wxCoord wordWidth = dc.GetTextExtent(word).x;
if ( lineWidth + wordWidth < maxWidth )
{
// Word fits, just add it to this line.
line += word;
lineWidth += wordWidth;
}
else
{
// Word does not fit, check whether the word is itself wider that
// available width
if ( wordWidth < maxWidth )
{
// Word can fit in a new line, put it at the beginning
// of the new line.
lines.push_back(line);
line = word;
lineWidth = wordWidth;
}
else // Word cannot fit in available width at all.
{
if ( !line.empty() )
{
lines.push_back(line);
line.clear();
lineWidth = 0;
}
// Break it up in several lines.
lineWidth = BreakWord(dc, word, maxWidth, lines, line);
}
}
}
if ( !line.empty() )
lines.push_back(line);
}
示例6: OnCmdLineParsed
// Handle command line options
//
bool TestApp::OnCmdLineParsed(wxCmdLineParser& parser)
{
if (parser.GetParamCount())
{
for (size_t i = 0; i < parser.GetParamCount(); i++)
m_registries.push_back(parser.GetParam(i));
}
m_longlist = parser.Found("longlist");
m_list = m_longlist || parser.Found("list");
m_timing = parser.Found("timing");
m_detail = !m_timing && parser.Found("detail");
wxString loc;
if ( parser.Found("locale", &loc) )
{
const wxLanguageInfo * const info = wxLocale::FindLanguageInfo(loc);
if ( !info )
{
cerr << "Locale \"" << string(loc.mb_str()) << "\" is unknown.\n";
return false;
}
m_locale = new wxLocale(info->Language);
if ( !m_locale->IsOk() )
{
cerr << "Using locale \"" << string(loc.mb_str()) << "\" failed.\n";
return false;
}
}
return TestAppBase::OnCmdLineParsed(parser);
}
示例7: SetArguments
void wxCmdLineParserData::SetArguments(int argc, char **argv)
{
m_arguments.clear();
// Command-line arguments are supposed to be in the user locale encoding
// (what else?) but wxLocale probably wasn't initialized yet as we're
// called early during the program startup and so our locale might not have
// been set from the environment yet. To work around this problem we
// temporarily change the locale here. The only drawback is that changing
// the locale is thread-unsafe but precisely because we're called so early
// it's hopefully safe to assume that no other threads had been created yet.
char * const locOld = SetAllLocaleFacets("");
wxON_BLOCK_EXIT1( SetAllLocaleFacets, locOld );
for ( int n = 0; n < argc; n++ )
{
// try to interpret the string as being in the current locale
wxString arg(argv[n]);
// but just in case we guessed wrongly and the conversion failed, do
// try to salvage at least something
if ( arg.empty() && argv[n][0] != '\0' )
arg = wxString(argv[n], wxConvISO8859_1);
m_arguments.push_back(arg);
}
}
示例8: unserializeTileset
bool Materials::unserializeTileset(xmlNodePtr node, wxArrayString& warnings)
{
std::string strVal;
if(readXMLString(node, "name", strVal))
{
Tileset* ts;
TilesetContainer::iterator iter = tilesets.find(strVal);
if(iter != tilesets.end())
{
ts = iter->second;
}
else
{
ts = newd Tileset(brushes, strVal);
tilesets.insert(make_pair(strVal, ts));
}
xmlNodePtr child = node->children;
while(child)
{
ts->loadCategory(child, warnings);
child = child->next;
}
}
else
{
warnings.push_back(wxT("Couldn't read tileset name"));
return false;
}
return true;
}
示例9: loadFromXML
bool CreatureDatabase::loadFromXML(const FileName& filename, bool standard, wxString& error, wxArrayString& warnings)
{
pugi::xml_document doc;
pugi::xml_parse_result result = doc.load_file(filename.GetFullPath().mb_str());
if (!result) {
error = wxT("Couldn't open file \"") + filename.GetFullName() + wxT("\", invalid format?");
return false;
}
pugi::xml_node node = doc.child("creatures");
if (!node) {
error = wxT("Invalid file signature, this file is not a valid creatures file.");
return false;
}
for (pugi::xml_node creatureNode = node.first_child(); creatureNode; creatureNode = creatureNode.next_sibling()) {
if (as_lower_str(creatureNode.name()) != "creature") {
continue;
}
CreatureType* creatureType = CreatureType::loadFromXML(creatureNode, warnings);
if (creatureType) {
creatureType->standard = standard;
if ((*this)[creatureType->name]) {
warnings.push_back(wxT("Duplicate creature type name \"") + wxstr(creatureType->name) + wxT("\"! Discarding..."));
delete creatureType;
} else {
creature_map[as_lower_str(creatureType->name)] = creatureType;
}
}
}
return true;
}
示例10: FindAllPlugins
void ModuleManager::FindAllPlugins(PluginIDList & providers, wxArrayString & paths)
{
PluginManager & pm = PluginManager::Get();
wxArrayString modIDs;
wxArrayString modPaths;
const PluginDescriptor *plug = pm.GetFirstPlugin(PluginTypeModule);
while (plug)
{
modIDs.push_back(plug->GetID());
modPaths.push_back(plug->GetPath());
plug = pm.GetNextPlugin(PluginTypeModule);
}
for (size_t i = 0, cnt = modIDs.size(); i < cnt; i++)
{
PluginID providerID = modIDs[i];
ModuleInterface *module =
static_cast<ModuleInterface *>(CreateProviderInstance(providerID, modPaths[i]));
wxArrayString newpaths = module->FindPlugins(pm);
for (size_t i = 0, cnt = newpaths.size(); i < cnt; i++)
{
providers.push_back(providerID);
paths.push_back(newpaths[i]);
}
}
}
示例11: unserializeMaterials
bool Materials::unserializeMaterials(const FileName& filename, xmlNodePtr root, wxString& error, wxArrayString& warnings)
{
xmlNodePtr materialNode = root->children;
wxString warning;
while(materialNode)
{
warning = wxT("");
if(xmlStrcmp(materialNode->name,(const xmlChar*)"include") == 0)
{
std::string include_file;
if(readXMLValue(materialNode, "file", include_file))
{
FileName include_name;
include_name.SetPath(filename.GetPath());
include_name.SetFullName(wxstr(include_file));
wxString suberror;
bool success = loadMaterials(include_name, suberror, warnings);
if(!success)
warnings.push_back(wxT("Error while loading file \"") + wxstr(include_file) + wxT("\": ") + suberror);
}
}
else if(xmlStrcmp(materialNode->name,(const xmlChar*)"metaitem") == 0)
{
item_db.loadMetaItem(materialNode);
}
else if(xmlStrcmp(materialNode->name,(const xmlChar*)"border") == 0)
{
brushes.unserializeBorder(materialNode, warnings);
if(warning.size()) warnings.push_back(wxT("materials.xml: ") + warning);
}
else if(xmlStrcmp(materialNode->name,(const xmlChar*)"brush") == 0)
{
brushes.unserializeBrush(materialNode, warnings);
if(warning.size()) warnings.push_back(wxT("materials.xml: ") + warning);
}
else if(xmlStrcmp(materialNode->name,(const xmlChar*)"tileset") == 0)
{
unserializeTileset(materialNode, warnings);
}
materialNode = materialNode->next;
}
return true;
}
示例12: loadMaterials
bool Materials::loadMaterials(const FileName& identifier, wxString& error, wxArrayString& warnings)
{
pugi::xml_document doc;
pugi::xml_parse_result result = doc.load_file(identifier.GetFullPath().mb_str());
if(!result) {
warnings.push_back("Could not open " + identifier.GetFullName() + " (file not found or syntax error)");
return false;
}
pugi::xml_node node = doc.child("materials");
if(!node) {
warnings.push_back(identifier.GetFullName() + ": Invalid rootheader.");
return false;
}
unserializeMaterials(identifier, node, error, warnings);
return true;
}
示例13: unserializeBorder
bool Brushes::unserializeBorder(pugi::xml_node node, wxArrayString& warnings)
{
pugi::xml_attribute attribute = node.attribute("id");
if (!attribute) {
warnings.push_back(wxT("Couldn't read border id node"));
return false;
}
int32_t id = pugi::cast<int32_t>(attribute.value());
if (borders[id]) {
warnings.push_back(wxT("Border ID ") + std::to_string(id) + wxT(" already exists"));
return false;
}
AutoBorder* border = newd AutoBorder(id);
border->load(node, warnings);
borders[id] = border;
return true;
}
示例14: GetSideList
void tcScenarioDialog::GetSideList(wxArrayString& sideList)
{
sideList.clear();
for (size_t n=0; n<countrySelection.size(); n++)
{
wxString s = countrySelection[n]->GetValue();
if (s.size() > 0) sideList.push_back(s);
}
}
示例15: getValue
bool Config::getValue(const wxString& key, wxArrayString& value)
{
wxString s;
if (!getValue(key, s))
return false;
value.clear();
wxString item;
size_t pos = 0, sep = s.find(',');
while (sep != wxString::npos)
{
item = s.substr(pos, sep - pos);
if (!item.empty())
value.push_back(item);
sep = s.find(',', pos = sep + 1);
}
if (!(item = s.substr(pos)).empty())
value.push_back(item);
return true;
}