本文整理汇总了C++中AttributeList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ AttributeList::begin方法的具体用法?C++ AttributeList::begin怎么用?C++ AttributeList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttributeList
的用法示例。
在下文中一共展示了AttributeList::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: beginElement
void beginElement( void * userdata, const XML_Char * nam, const XML_Char ** atts){
AttributeList::const_iterator iter;
XML * xml = (XML *)userdata;
string tname (nam);
AttributeList attributes (atts);
GalaxyNames elem = (GalaxyNames) element_map.lookup(tname);
GalaxyNames attr;
string name;
string value;
switch (elem) {
case GALAXY:
break;
case SYSTEMS:
break;
case PLANETS:
xml->stak.push_back ("<planets>");
xml->g->addSection (xml->stak);
break;
case SECTOR:
case SYSTEM:
case PLANET:
for (iter = attributes.begin(); iter!=attributes.end();++iter) {
attr = (GalaxyNames)attribute_map.lookup((*iter).name);
switch (attr) {
case NAME:
name = (*iter).value;
break;
default:
break;
}
}
xml->stak.push_back (name);
xml->g->addSection (xml->stak);
break;
case VAR:
for (iter = attributes.begin(); iter!=attributes.end();++iter) {
attr = (GalaxyNames)attribute_map.lookup((*iter).name);
switch(attr) {
case NAME:
name = (*iter).value;
break;
case VALUE:
value = (*iter).value;
break;
default:break;
}
}
xml->g->setVariable(xml->stak,name,value);
break;
default:break;
}
}
示例2: encodingFromMetaAttributes
TextEncoding HTMLMetaCharsetParser::encodingFromMetaAttributes(const AttributeList& attributes)
{
bool gotPragma = false;
Mode mode = None;
String charset;
for (AttributeList::const_iterator iter = attributes.begin(); iter != attributes.end(); ++iter) {
const AtomicString& attributeName = iter->first;
const String& attributeValue = iter->second;
if (attributeName == http_equivAttr) {
if (equalIgnoringCase(attributeValue, "content-type"))
gotPragma = true;
} else if (charset.isEmpty()) {
if (attributeName == charsetAttr) {
charset = attributeValue;
mode = Charset;
} else if (attributeName == contentAttr) {
charset = extractCharset(attributeValue);
if (charset.length())
mode = Pragma;
}
}
}
if (mode == Charset || (mode == Pragma && gotPragma))
return TextEncoding(stripLeadingAndTrailingHTMLSpaces(charset));
return TextEncoding();
}
示例3: bind_parameters
void Connection::bind_parameters( sqlite3_stmt *ppStmt,
const AttributeList ¶meters ) {
int i = 0;
for( AttributeList::const_iterator it = parameters.begin();
it != parameters.end();
++it ) {
switch( it->which() ) {
case integer: {
int value = boost::get< int >( *it );
sqlite3_bind_int( ppStmt, i + 1, value );
break;
}
case text: {
string value = boost::get< std::string >( *it );
sqlite3_bind_text( ppStmt, i + 1, value.c_str(), value.size(), 0 );
break;
}
case floating_point: {
double value = boost::get< double >( *it );
sqlite3_bind_double( ppStmt, i + 1, value );
break;
}
case date: {
Date value = boost::get< Date >( *it );
string s = value.to_string();
sqlite3_bind_text( ppStmt, i + 1, s.c_str(), s.size(), 0 );
break;
}
default: {
throw ActiveRecordException( "Type not implemented", __FILE__, __LINE__ );
}
}
++i;
}
}
示例4: on_start_element
/**
Analiza los elementos de inicio del xml y los asigna a sus correspondientes
atributos.
@param &name, const Glib::ustring del atributo de inicio del xml.
@param &attributes, const AttributeList (array) con los atributos del xml.
*/
void XmlInstalador::on_start_element(const Glib::ustring& name, const AttributeList& attributes)
{
nodeName = name;
//Atributos
for(xmlpp::SaxParser::AttributeList::const_iterator iter = attributes.begin(); iter != attributes.end(); ++iter)
{
try
{
if("nombre" == iter->name)
{
nombre = iter->value;
}
if("ruta" == iter->name)
{
ruta = iter->value;
}
}
catch(const Glib::ConvertError& ex)
{
//cerr<<"XmlParse atributos Excepcion obteniendo el nombre o valor"<<ex.what()<<endl;
cerr<<"XmlParse attributes Exception obtaining name or value"<<ex.what()<<endl;
}
}
}
示例5:
void rise::parser::on_start_element(const Glib::ustring &_name,
const AttributeList &_attributes)
{
Glib::ustring prefix, name = _name;
auto pos = _name.find(':');
if(pos != Glib::ustring::npos)
{
prefix = _name.substr(0, pos);
name = _name.substr(pos + 1);
}
auto *el = doc.get_root_node();
if(!el) el = doc.create_root_node();
else el = context.top()->add_child(name, prefix);
context.push(el);
for(auto itr = _attributes.begin(); itr != _attributes.end(); ++itr)
{
Glib::ustring name = itr->name;
Glib::ustring value = itr->value;
auto pos = name.find(':');
if(pos == Glib::ustring::npos)
{
if(name == "xmlns") el->set_namespace_declaration(value);
else el->set_attribute(name, value);
}
else
{
Glib::ustring prefix = name.substr(0, pos);
Glib::ustring suffix = name.substr(pos + 1);
if(prefix == "xmlns") el->set_namespace_declaration(value, suffix);
else el->set_attribute(suffix, value, prefix);
}
}
}
示例6:
void
AttributedNode::addAttributes( const AttributeList& attrs )
{
for( AttributeList::const_iterator i = attrs.begin(); i != attrs.end(); i++ )
{
this->setAttribute( *i );
}
}
示例7: generateAttributes
string Renderer::generateAttributes(const AttributeList& attributes)
{
string str;
AttributeList::const_iterator itr;
for(itr = attributes.begin();itr!=attributes.end();itr++)
{
str += (" " + itr->first + "=\"" + itr->second + "\" ");
}
return str;
}
示例8: generateAttributes
string View::generateAttributes(AttributeList attributes)
{
string str;
AttributeList::iterator itr;
for(itr = attributes.begin();itr!=attributes.end();itr++)
{
str += (" " + itr->first + "=\"" + itr->second + "\" ");
}
return str;
}
示例9: on_start_element
virtual void on_start_element(const Glib::ustring & name,
const AttributeList & properties) {
path.push_back(getId(name));
vector<uint> rpath;
rpath.insert(rpath.end(),path.rbegin(),path.rend());
trie.insertPath(rpath,fake_id++);
rpath.insert(rpath.begin(),0);
for(AttributeList::const_iterator iter=properties.begin(); iter!=properties.end(); ++iter) {
rpath[0] = getId(iter->name);
trie.insertPath(rpath,fake_id++);
}
}
示例10:
void
TL_Xml2Array::on_start_element(const string& name_,
const AttributeList& attributes_)
{
_startElement=true;
TL_AssocArray &newKey = (*_table)(name_);
xmlpp::SaxParser::AttributeList::const_iterator iter;
for(iter = attributes_.begin(); iter != attributes_.end(); ++iter)
{
newKey.attr[iter->name] = iter->value;
}
_table = &newKey;
}
示例11:
static String AttrList2String(const AttributeList& attr_list)
{
String result;
AttributeList::const_iterator it = attr_list.begin();
for (; it != attr_list.end(); ++it) {
std::stringstream ss;
ss << (int)it->get_type() << ':';
ss << it->get_start() << ':';
ss << it->get_length() << ':';
ss << it->get_value() << ';';
result += ss.str();
}
return result;
}
示例12: on_start_element
/**
Lee el xml y asigna los valores a los atributos
@param name nombre del atributo
@param attributes lista de atributos del xml
*/
void XmlCache::on_start_element(const Glib::ustring& name, const AttributeList& attributes)
{
string aux = "";
//Atributos
for(xmlpp::SaxParser::AttributeList::const_iterator iter = attributes.begin(); iter != attributes.end(); ++iter)
{
try
{
if(iter->name == "nombre_imagen")
{
cacheI->push_back(iter->value);
}
}
catch(const Glib::ConvertError& ex)
{
//cerr<<"XmlParse atributos Excepcion obteniendo el nombre o valor"<<ex.what()<<endl;
cerr<<"XmlParse attributes, Exception while obtaining name or value"<<ex.what()<<endl;
}
}
}
示例13: beginElement
void AIScript::beginElement( const string &name, const AttributeList &attributes )
{
using namespace AiXml;
xml->itts = false;
Unit *tmp;
#ifdef AIDBG
VSFileSystem::vs_fprintf( stderr, "0" );
#endif
Names elem = (Names) element_map.lookup( name );
#ifdef AIDBG
VSFileSystem::vs_fprintf( stderr, "1%x ", &elem );
#endif
AttributeList::const_iterator iter;
switch (elem)
{
case DEFAULT:
xml->unitlevel += 2; //pretend it's at a reasonable level
break;
case UNKNOWN:
xml->unitlevel++;
return;
case SCRIPT:
xml->unitlevel++;
break;
case LINEAR:
xml->lin = 1;
case ANGULAR:
case VECTOR:
xml->unitlevel++;
xml->vectors.push( QVector( 0, 0, 0 ) );
for (iter = attributes.begin(); iter != attributes.end(); iter++) {
switch ( attribute_map.lookup( (*iter).name ) )
{
case X:
topv().i = parse_float( (*iter).value );
break;
case Y:
topv().j = parse_float( (*iter).value );
break;
case Z:
topv().k = parse_float( (*iter).value );
break;
case DUPLIC:
#ifdef AIDBG
VSFileSystem::vs_fprintf( stderr, "1%x ", &elem );
#endif
xml->vectors.pop(); //get rid of dummy vector pushed on above
xml->vectors.push( xml->vectors.top() );
break;
case THREATPOS:
if ( ( tmp = this->parent->Threat() ) ) {
topv() = ( tmp->Position() );
} else {
if ( ( tmp = this->parent->Target() ) )
topv() = ( tmp->Position() );
else
topv() = (xml->defaultvec);
}
break;
case TARGETPOS:
if ( ( tmp = this->parent->Target() ) )
topv() = ( tmp->Position() );
else
topv() = (xml->defaultvec);
break;
case YOURPOS:
topv() = ( this->parent->Position() );
break;
case THREATV:
if ( ( tmp = this->parent->Threat() ) ) {
topv() = ( tmp->GetVelocity() );
} else {
if ( ( tmp = this->parent->Target() ) )
topv() = ( tmp->GetVelocity() );
else
topv() = (xml->defaultvec);
}
break;
case TARGETV:
if ( ( tmp = this->parent->Target() ) )
topv() = ( tmp->GetVelocity() );
else
topv() = (xml->defaultvec);
break;
case YOURV:
topv() = ( this->parent->GetVelocity() );
break;
}
}
break;
case MOVETO:
xml->unitlevel++;
xml->acc = 2;
xml->afterburn = true;
for (iter = attributes.begin(); iter != attributes.end(); iter++) {
switch ( attribute_map.lookup( (*iter).name ) )
{
//.........这里部分代码省略.........
示例14: set_preedit_attributes
retval_t ScimBridgeAgentClientListenerImpl::set_preedit_attributes (scim_bridge_imcontext_id_t imcontext_id, const AttributeList &attributes)
{
scim_bridge_pdebugln (6, "set_preedit_attributes ()");
ScimBridgeMessage *message = scim_bridge_alloc_message (SCIM_BRIDGE_MESSAGE_SET_PREEDIT_ATTRIBUTES, attributes.size () * 4 + 1);
char *imcontext_id_str;
scim_bridge_string_from_uint (&imcontext_id_str, imcontext_id);
scim_bridge_message_set_argument (message, 0, imcontext_id_str);
free (imcontext_id_str);
int arg_index = 1;
for (AttributeList::const_iterator i = attributes.begin (); i != attributes.end (); ++i) {
const Attribute &attribute = *i;
char *begin_str;
char *end_str;
scim_bridge_string_from_uint (&begin_str, attribute.get_start ());
scim_bridge_string_from_uint (&end_str, attribute.get_end ());
const char *type_str;
const char *value_str;
if (attribute.get_type () == SCIM_ATTR_DECORATE) {
type_str = SCIM_BRIDGE_MESSAGE_DECORATE;
switch (attribute.get_value ()) {
case SCIM_ATTR_DECORATE_UNDERLINE:
value_str = SCIM_BRIDGE_MESSAGE_UNDERLINE;
break;
case SCIM_ATTR_DECORATE_REVERSE:
value_str = SCIM_BRIDGE_MESSAGE_REVERSE;
break;
case SCIM_ATTR_DECORATE_HIGHLIGHT:
value_str = SCIM_BRIDGE_MESSAGE_HIGHLIGHT;
break;
default:
type_str = SCIM_BRIDGE_MESSAGE_NONE;
value_str = SCIM_BRIDGE_MESSAGE_NONE;
}
} else if (attribute.get_type () == SCIM_ATTR_FOREGROUND || attribute.get_type () == SCIM_ATTR_BACKGROUND) {
if (attribute.get_type () == SCIM_ATTR_FOREGROUND) {
type_str = SCIM_BRIDGE_MESSAGE_FOREGROUND;
} else {
type_str = SCIM_BRIDGE_MESSAGE_BACKGROUND;
}
char *tmp_str = static_cast<char*> (alloca (sizeof (char) * (strlen (SCIM_BRIDGE_MESSAGE_COLOR) + 7)));
value_str = tmp_str;
strcpy (tmp_str, SCIM_BRIDGE_MESSAGE_COLOR);
char *color_str = tmp_str + sizeof (char) * strlen (SCIM_BRIDGE_MESSAGE_COLOR);
color_str[6] = '\0';
const char chars[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
for (unsigned int k = 0; k < 6; ++k) {
const unsigned int digit_index = (attribute.get_value () >> (k * 4)) % 0x10;
color_str[5 - k] = chars[digit_index];
}
} else {
type_str = SCIM_BRIDGE_MESSAGE_NONE;
value_str = SCIM_BRIDGE_MESSAGE_NONE;
}
scim_bridge_message_set_argument (message, arg_index + 0, begin_str);
scim_bridge_message_set_argument (message, arg_index + 1, end_str);
scim_bridge_message_set_argument (message, arg_index + 2, type_str);
scim_bridge_message_set_argument (message, arg_index + 3, value_str);
free (begin_str);
free (end_str);
arg_index += 4;
}
示例15: beginElement
void GameCockpit::beginElement(const string &name, const AttributeList &attributes) {
static bool cockpit_smooth=XMLSupport::parse_bool(vs_config->getVariable("graphics","cockpit_smooth_texture","false"));
static bool panel_smooth=XMLSupport::parse_bool(vs_config->getVariable("graphics","panel_smooth_texture","true"));
static bool crosshair_smooth=XMLSupport::parse_bool(vs_config->getVariable("graphics","crosshair_smooth_texture","true"));
AttributeList::const_iterator iter;
Gauge::DIRECTION tmpdir=Gauge::GAUGE_UP;
VSSprite ** newsprite=NULL;
VDU **newvdu=NULL;
VSSprite * adjsprite=NULL;
std::string gaugename ("shieldstat.spr");
std::string myfont ("9x12.font");
Names elem = (Names)element_map.lookup(name);
Names attr;
unsigned int mymodes=0;
float xsize=-1,ysize=-1,xcent=FLT_MAX,ycent=FLT_MAX;
float leftx=-10; float rightx=-10;
float topy=-10; float boty = -10;
short rows=13;
short cols=15;
int default_mode=VDU::TARGET;
VSSprite * oldpit=NULL;
bool replaced[4]={false,false,false,false};
int counter=0;
switch (elem) {
case COCKPIT:
for(iter = attributes.begin(); iter!=attributes.end(); iter++) {
attr = (Names)attribute_map.lookup((*iter).name);
switch (attr) {
case MYFONT:
myfont = (*iter).value;
break;
case RED:
textcol.r = XMLSupport::parse_float ((*iter).value);
break;
case GREEN:
textcol.g = XMLSupport::parse_float ((*iter).value);
break;
case BLUE:
textcol.b = XMLSupport::parse_float ((*iter).value);
break;
case ALPH:
textcol.a=XMLSupport::parse_float ((*iter).value);
break;
case VIEWOFFSET:
viewport_offset = XMLSupport::parse_float ((*iter).value);
break;
case COCKPITOFFSET:
cockpit_offset = XMLSupport::parse_float ((*iter).value);
break;
case XFILE:
{
std::string tmp=getRes((*iter).value);
oldpit=Pit[0];
Pit[0]= new VSSprite (tmp.c_str(),cockpit_smooth?BILINEAR:NEAREST);
if (!Pit[0]->LoadSuccess()){
delete Pit[0];
Pit[0]= new VSSprite ((*iter).value.c_str(),cockpit_smooth?BILINEAR:NEAREST);
}
replaced[0]=true;
if (oldpit) {
delete oldpit;
}
}
break;
case SOUNDFILE:
SetSoundFile((*iter).value);
break;
case MESH:
mesh = Mesh::LoadMeshes ((*iter).value.c_str(),Vector(1,1,1),0,NULL);
break;
case FRONT:
case BACK:
case LEFT:
case RIGHT:
{
std::string tmp=getRes((*iter).value);
oldpit=Pit[attr-FRONT];
Pit[attr-FRONT] = new VSSprite (tmp.c_str(),cockpit_smooth?BILINEAR:NEAREST);
if (!Pit[attr-FRONT]->LoadSuccess()) {
delete Pit[attr-FRONT];
Pit[attr-FRONT] = new VSSprite ((*iter).value.c_str(),cockpit_smooth?BILINEAR:NEAREST);
}
replaced[attr-FRONT]=true;
if (oldpit){
delete oldpit;
}
}
break;
default:
break;
}
}
text = new TextPlane ();
for (counter=0;counter<4;++counter) {
if (!replaced[counter]) {
delete Pit[counter];
Pit[counter]=false;
}
//.........这里部分代码省略.........