本文整理汇总了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));
}
}
示例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);
}
示例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);
}
}
示例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;
};
示例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;
}
}
}
示例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());
}
示例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();
}
示例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();
}
示例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()));
}
}
示例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");
}
示例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();
}
示例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));
}
}
示例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.
}
}
示例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++;}}
示例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());
}
}