当前位置: 首页>>代码示例>>C++>>正文


C++ xml_node::name方法代码示例

本文整理汇总了C++中xml_node::name方法的典型用法代码示例。如果您正苦于以下问题:C++ xml_node::name方法的具体用法?C++ xml_node::name怎么用?C++ xml_node::name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xml_node的用法示例。


在下文中一共展示了xml_node::name方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: parseBlackAreas

void Camera::parseBlackAreas(xml_node &cur) {
  if (isTag(cur.name(), "Vertical")) {

    int x = cur.attribute("x").as_int(-1);
    if (x < 0) {
      ThrowCME("Invalid x coordinate in vertical BlackArea of in camera %s %s", make.c_str(), model.c_str());
    }

    int w = cur.attribute("width").as_int(-1);
    if (w < 0) {
      ThrowCME("Invalid width in vertical BlackArea of in camera %s %s", make.c_str(), model.c_str());
    }

    blackAreas.push_back(BlackArea(x, w, true));

  } else if (isTag(cur.name(), "Horizontal")) {

    int y = cur.attribute("y").as_int(-1);
    if (y < 0) {
      ThrowCME("Invalid y coordinate in horizontal BlackArea of in camera %s %s", make.c_str(), model.c_str());
    }

    int h = cur.attribute("height").as_int(-1);
    if (h < 0) {
      ThrowCME("Invalid width in horizontal BlackArea of in camera %s %s", make.c_str(), model.c_str());
    }
    blackAreas.push_back(BlackArea(y, h, false));
  }
}
开发者ID:acarrasco,项目名称:darktable,代码行数:29,代码来源:Camera.cpp

示例2: from_xml

node_ptr registry::from_xml(xml_node const& xml, fontset_map const& fontsets)
{
    std::map<std::string, from_xml_function_ptr>::const_iterator itr = map_.find(xml.name());
    if (itr == map_.end())  throw config_error("Unknown element '" + xml.name() + "'", xml);
    xml.set_processed(true);
    return itr->second(xml, fontsets);
}
开发者ID:HogwartsRico,项目名称:mapnik,代码行数:7,代码来源:registry.cpp

示例3: parseCFA

void Camera::parseCFA(xml_node &cur) {
  if (isTag(cur.name(), "ColorRow")) {
    int y = cur.attribute("y").as_int(-1);
    if (y < 0 || y >= cfa.size.y) {
      ThrowCME("Invalid y coordinate in CFA array of in camera %s %s", make.c_str(), model.c_str());
    }
    const char* key = cur.first_child().value();
    if ((int)strlen(key) != cfa.size.x) {
      ThrowCME("Invalid number of colors in definition for row %d in camera %s %s. Expected %d, found %d.", y, make.c_str(), model.c_str(),  cfa.size.x, strlen(key));
    }
    for (int x = 0; x < cfa.size.x; x++) {
    	char v = (char)tolower((int)key[x]);
    	if (v == 'g')
      	cfa.setColorAt(iPoint2D(x, y), CFA_GREEN);
    	else if (v == 'r')
      	cfa.setColorAt(iPoint2D(x, y), CFA_RED);
    	else if (v == 'b')
      	cfa.setColorAt(iPoint2D(x, y), CFA_BLUE);
    	else if (v == 'f')
      	cfa.setColorAt(iPoint2D(x, y), CFA_FUJI_GREEN);
    	else if (v == 'c')
      	cfa.setColorAt(iPoint2D(x, y), CFA_CYAN);
    	else if (v == 'm')
      	cfa.setColorAt(iPoint2D(x, y), CFA_MAGENTA);
    	else if (v == 'y')
      	cfa.setColorAt(iPoint2D(x, y), CFA_YELLOW);
      else 
        supported = FALSE;
    }
  }
  if (isTag(cur.name(), "Color")) {
    int x = cur.attribute("x").as_int(-1);
    if (x < 0 || x >= cfa.size.x) {
      ThrowCME("Invalid x coordinate in CFA array of in camera %s %s", make.c_str(), model.c_str());
    }

    int y = cur.attribute("y").as_int(-1);
    if (y < 0 || y >= cfa.size.y) {
      ThrowCME("Invalid y coordinate in CFA array of in camera %s %s", make.c_str(), model.c_str());
    }

    const char* key = cur.first_child().value();
    if (isTag(key, "GREEN"))
      cfa.setColorAt(iPoint2D(x, y), CFA_GREEN);
    else if (isTag(key, "RED"))
      cfa.setColorAt(iPoint2D(x, y), CFA_RED);
    else if (isTag(key, "BLUE"))
      cfa.setColorAt(iPoint2D(x, y), CFA_BLUE);
    else if (isTag(key, "FUJIGREEN"))
      cfa.setColorAt(iPoint2D(x, y), CFA_FUJI_GREEN);
    else if (isTag(key, "CYAN"))
      cfa.setColorAt(iPoint2D(x, y), CFA_CYAN);
    else if (isTag(key, "MAGENTA"))
      cfa.setColorAt(iPoint2D(x, y), CFA_MAGENTA);
    else if (isTag(key, "YELLOW"))
      cfa.setColorAt(iPoint2D(x, y), CFA_YELLOW);
  }
}
开发者ID:acarrasco,项目名称:darktable,代码行数:58,代码来源:Camera.cpp

示例4: process

	ProcessResult XMPPProcessor::process(mtalk::talk::SessionPtr sessionPtr, const xml_node& node){
		ProcessResult result;

		if(!node){
			result.setCode(ProcessResult::EMPTY);
			return result;
		}
		
		

		string name = node.name();

		if(name == "message"){
			result = messageRouterPtr_->route(sessionPtr, node);
		} else if(name == "presence"){
			result = presenceRouterPtr_->route(sessionPtr, node);
		} else if(name == "iq"){
			result = iqRouterPtr_->route(sessionPtr, node);
		} else {
			return StreamErrorFactory::invalidXml("unknown node : " + name);
		}

		if(result.getCode() != ProcessResult::OK 
			&& result.getCode() != ProcessResult::HAS_RESPONSE
			&& result.getCode() != ProcessResult::ANTISPAM
			&& result.getCode() != ProcessResult::SESSION_CLOSE){
			result = StreamErrorFactory::invalidFrom(result.getMsg());
		}

		return result;

	};
开发者ID:xiaoyu-real,项目名称:Test,代码行数:32,代码来源:XMPPProcessor.cpp

示例5: switch

void Editor_Html2Usfm::processNode (xml_node node)
{
  switch (node.type ()) {
    case node_element:
    {
      openElementNode (node);
      for (xml_node child : node.children()) {
        processNode (child);
      }
      closeElementNode (node);
      break;
    }
    case node_pcdata:
    {
      // Add the text to the current USFM line.
      string text = node.text ().get ();
      currentLine += text;
      break;
    }
    default:
    {
      string nodename = node.name ();
      Database_Logs::log ("Unknown XML node " + nodename + " while saving editor text");
      break;
    }
  }
}
开发者ID:alerque,项目名称:bibledit,代码行数:27,代码来源:html2usfm.cpp

示例6: returnHashString

string XMLProcessor::returnHashString(xml_node node)
{
	if (node.parent().name() == "")
		return DBStringProcessor::getOriginalTrueTableName(node.name());
	else
		return returnHashString(node.parent()) + "->" + DBStringProcessor::getOriginalTrueTableName(node.name());
}
开发者ID:gaozheyuan,项目名称:xmltodb,代码行数:7,代码来源:XMLProcessor.cpp

示例7: intFromChild

int Scene::intFromChild(const xml_node &node, const string &child)
{
	xml_node childNode = node.child(child.c_str());
	if(!childNode){
		stringstream ss;
		ss << "node <"<< node.name() << "> has no child named '" << child << "'";
		throw invalid_argument(ss.str().c_str());
	}
	return childNode.text().as_int();
}
开发者ID:mvignale1987,项目名称:computer-graphics,代码行数:10,代码来源:Scene.cpp

示例8: stringAttributeFromNode

string Scene::stringAttributeFromNode(const xml_node &node, const string& attributeName)
{
	xml_attribute attr = node.attribute(attributeName.c_str());
	if(!attr){
		stringstream ss;
		ss << "node <"<< node.name() << "> has no '" << attributeName << "' attribute";
		throw invalid_argument(ss.str().c_str());
	}
	return attr.as_string();
}
开发者ID:mvignale1987,项目名称:computer-graphics,代码行数:10,代码来源:Scene.cpp

示例9: parseAlias

void Camera::parseAlias( xml_node &cur )
{
  if (isTag(cur.name(), "Alias")) {
    aliases.push_back(string(cur.first_child().value()));
    pugi::xml_attribute key = cur.attribute("id");
    if (key)
      canonical_aliases.push_back(string(key.as_string()));
    else
      canonical_aliases.push_back(string(cur.first_child().value()));
  }
}
开发者ID:acarrasco,项目名称:darktable,代码行数:11,代码来源:Camera.cpp

示例10: nodetype

// Dispatch to the correct element constructor, based on the node
unique_ptr<Elem> glsvg::Elem::construct(
    const xml_node &rootnode,
    const weak_ptr<Elem> &parent)
{
    string nodetype(rootnode.name());
    
    if(nodetype == "svg")
        return shared_ptr<Elem>(new Svg(rootnode, parent));
    else if(nodetype == "rect")
        return shared_ptr<Elem>(new Rect(rootnode, parent));
    else
        throw SvgRuntimeError("Elem::construct() given invalid node type");
}
开发者ID:ahmedtd,项目名称:glsvg,代码行数:14,代码来源:svg.cpp

示例11: parse_gdimm_setting_node

void gdipp_setting::parse_gdimm_setting_node(const xml_node &setting_node, setting_map &setting_store)
{
	const string_t name = setting_node.name();

	if (name == L"freetype" || name == L"gamma" || name == L"render_mode" || name == L"shadow")
	{
		// these settings have nested items
		for (xml_node::iterator iter = setting_node.begin(); iter != setting_node.end(); iter++)
			setting_store[name + L"/" + iter->name()] = iter->first_child().value();
	}
	else
		setting_store[name] = setting_node.first_child().value();
}
开发者ID:Carye,项目名称:gdipp,代码行数:13,代码来源:setting.cpp

示例12: parseSensorInfo

void Camera::parseSensorInfo( xml_node &cur )
{
  int min_iso = cur.attribute("iso_min").as_int(0);
  int max_iso = cur.attribute("iso_max").as_int(0);;
  int black = cur.attribute("black").as_int(-1);
  int white = cur.attribute("white").as_int(65536);

  pugi::xml_attribute key = cur.attribute("black_colors");
  vector<int> black_colors;
  if (key) {
    black_colors = MultipleStringToInt(key.as_string(), cur.name(), "black_colors");
  }
  key = cur.attribute("iso_list");
  if (key) {
    vector<int> values = MultipleStringToInt(key.as_string(), cur.name(), "iso_list");
    if (!values.empty()) {
      for (uint32 i = 0; i < values.size(); i++) {
        sensorInfo.push_back(CameraSensorInfo(black, white, values[i], values[i], black_colors));
      }
    }
  } else {
    sensorInfo.push_back(CameraSensorInfo(black, white, min_iso, max_iso, black_colors));
  }
}
开发者ID:acarrasco,项目名称:darktable,代码行数:24,代码来源:Camera.cpp

示例13: flushLine

void Editor_Html2Usfm::closeElementNode (xml_node node)
{
  // The tag and class names of this element node.
  string tagName = node.name ();
  string className = node.attribute ("class").value ();
  
  if (tagName == "p")
  {
    // While editing it happens that the p element does not have a class.
    // Use the 'p' class in such cases.
    if (className == "") className = "p";
    
    if (noteOpeners.find (className) != noteOpeners.end()) {
      // Deal with note closers.
      currentLine += usfm_get_closing_usfm (className);
    } else {
      // Normally a p element closes the USFM line.
      flushLine ();
      mono = false;
      // Clear active character styles.
      characterStyles.clear();
    }
  }
  
  if (tagName == "span")
  {
    // Do nothing for monospace elements, because the USFM would be the text nodes only.
    if (mono) return;
    // Do nothing without a class.
    if (className.empty()) return;
    // Do nothing if no endmarkers are supposed to be produced.
    if (suppressEndMarkers.find (className) != suppressEndMarkers.end()) return;
    // Add closing USFM, optionally closing embedded tags in reverse order.
    vector <string> classes = filter_string_explode (className, ' ');
    characterStyles = filter_string_array_diff (characterStyles, classes);
    reverse (classes.begin(), classes.end());
    for (unsigned int offset = 0; offset < classes.size(); offset++) {
      bool embedded = (classes.size () > 1) && (offset == 0);
      if (!characterStyles.empty ()) embedded = true;
      currentLine += usfm_get_closing_usfm (classes [offset], embedded);
    }
  }
  
  if (tagName == "a")
  {
    // Do nothing for note citations in the text.
  }
}
开发者ID:alerque,项目名称:bibledit,代码行数:48,代码来源:html2usfm.cpp

示例14: loadSructure

 void meta::loadSructure(xml_node& val) {
     if (val == 0) return;
     nodetype type_ = nodeType(val.name());
     if (type_ == NT_MF_ROOT) meta_node = val;
     if (type_ == NT_MF_HOME) homeList_node = val;
     if (type_ == NT_MF_REPLIST) reportList_node = val;
     if (type_ == NT_MF_TRENDLIST) trendList_node = val;
     if (type_ == NT_MF_MESSLIST) messageList_node = val;
     num_xmlnode_map* tmpreg = registry(type_);
     if (tmpreg) {
         xml_attribute atr = val.attribute("key");
         if (!atr.empty())
             tmpreg->insert(num_xmlnode_pair(atr.as_int(), val));}
     xml_node_iterator it = val.begin();
     while (it != val.end()) {
         loadSructure(*it);
         it++;}}
开发者ID:sealeks,项目名称:nsdavinci,代码行数:17,代码来源:meta.cpp

示例15: parseID

void Camera::parseID( xml_node &cur )
{
  if (isTag(cur.name(), "ID")) {
    pugi::xml_attribute id_make = cur.attribute("make");
    if (id_make) {
      canonical_make = string(id_make.as_string());
    } else
      ThrowCME("CameraMetadata: Could not find make for ID for %s %s camera.", make.c_str(), model.c_str());

    pugi::xml_attribute id_model = cur.attribute("model");
    if (id_model) {
      canonical_model = string(id_model.as_string());
    } else
      ThrowCME("CameraMetadata: Could not find model for ID for %s %s camera.", make.c_str(), model.c_str());

    canonical_id = string(cur.first_child().value());
  }
}
开发者ID:acarrasco,项目名称:darktable,代码行数:18,代码来源:Camera.cpp


注:本文中的xml_node::name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。