本文整理汇总了C++中arabica::xpath::NodeSet::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeSet::push_back方法的具体用法?C++ NodeSet::push_back怎么用?C++ NodeSet::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arabica::xpath::NodeSet
的用法示例。
在下文中一共展示了NodeSet::push_back方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
virtual void execute(const DOM::Node<string_type, string_adaptor>& node,
ExecutionContext<string_type, string_adaptor>& context) const
{
ParamPasser<string_type, string_adaptor> passer(*this, node, context);
if(!SortableT::has_sort() && select_ == 0)
{
if(node.hasChildNodes())
context.stylesheet().applyTemplates(node.getChildNodes(), context, mode_);
return;
}
Arabica::XPath::NodeSet<string_type, string_adaptor> nodes;
if(select_ == 0)
for(DOM::Node<string_type, string_adaptor> n = node.getFirstChild(); n != 0; n = n.getNextSibling())
nodes.push_back(n);
else
{
Arabica::XPath::XPathValue<string_type, string_adaptor> value = select_->evaluate(node, context.xpathContext());
if(value.type() != Arabica::XPath::NODE_SET)
throw std::runtime_error("apply-templates select expression is not a node-set");
nodes = value.asNodeSet();
}
this->sort(node, nodes, context);
context.stylesheet().applyTemplates(nodes, context, mode_);
} // execute
示例2: doEvaluate
virtual Arabica::XPath::NodeSet<std::string> doEvaluate(const DOM::Node<std::string>& /* context */,
const Arabica::XPath::ExecutionContext<std::string>& executionContext) const
{
Arabica::XPath::NodeSet<std::string> set;
set.push_back(executionContext.currentNode());
return set;
} // doEvaluate
示例3:
Arabica::XPath::NodeSet<std::string> InterpreterDraft6::filterPreempted(const Arabica::XPath::NodeSet<std::string>& enabledTransitions) {
Arabica::XPath::NodeSet<std::string> filteredTransitions;
for (unsigned int i = 0; i < enabledTransitions.size(); i++) {
Node<std::string> t = enabledTransitions[i];
if (!isTargetless(t)) {
for (unsigned int j = 0; j < filteredTransitions.size(); j++) {
if (j == i)
continue;
Node<std::string> t2 = filteredTransitions[j];
if (isPreemptingTransition(t2, t)) {
#if 0
std::cout << "#####" << std::endl << "Transition " << std::endl
<< t2 << std::endl << " preempts " << std::endl << t << std::endl << "#####" << std::endl;
#endif
goto LOOP;
}
}
}
#if 0
std::cout << "----" << "Enabling Transition " << std::endl << t << std::endl;
#endif
filteredTransitions.push_back(t);
LOOP:
;
}
return filteredTransitions;
}
示例4: nodeSetUnion
Arabica::XPath::NodeSet<std::string> nodeSetUnion(const std::string& keyClarkName,
const Arabica::XPath::NodeSet<std::string> nodes,
const Arabica::XPath::ExecutionContext<std::string>& executionContext) const
{
Arabica::XPath::NodeSet<std::string> results;
for(Arabica::XPath::NodeSet<std::string>::const_iterator n = nodes.begin(), ne = nodes.end(); n != ne; ++n)
{
std::string id = Arabica::XPath::impl::nodeStringValue<std::string, Arabica::default_string_adaptor<std::string> >(*n);
results.push_back(keys_.lookup(keyClarkName, id, executionContext));
} // for ...
results.to_document_order();
return results;
} // nodeSetUnion
示例5: filterChildElements
Arabica::XPath::NodeSet<std::string> InterpreterDraft6::selectTransitions(const std::string& event) {
Arabica::XPath::NodeSet<std::string> enabledTransitions;
NodeSet<std::string> states;
for (unsigned int i = 0; i < _configuration.size(); i++) {
if (isAtomic(_configuration[i]))
states.push_back(_configuration[i]);
}
states.to_document_order();
#if 0
std::cout << "Atomic states: " << std::endl;
for (int i = 0; i < states.size(); i++) {
std::cout << states[i] << std::endl << "----" << std::endl;
}
std::cout << std::endl;
#endif
unsigned int index = 0;
while(states.size() > index) {
bool foundTransition = false;
NodeSet<std::string> transitions = filterChildElements(_nsInfo.xmlNSPrefix + "transition", states[index]);
for (unsigned int k = 0; k < transitions.size(); k++) {
if (isEnabledTransition(transitions[k], event)) {
enabledTransitions.push_back(transitions[k]);
foundTransition = true;
goto LOOP;
}
}
if (!foundTransition) {
Node<std::string> parent = states[index].getParentNode();
if (parent) {
states.push_back(parent);
}
}
LOOP:
index++;
}
enabledTransitions = filterPreempted(enabledTransitions);
#if 0
std::cout << "Enabled transitions: " << std::endl;
for (int i = 0; i < enabledTransitions.size(); i++) {
std::cout << DOMUtils::xPathForNode(enabledTransitions[i]) << std::endl;
}
std::cout << std::endl;
#endif
return enabledTransitions;
}
示例6: ATTR
Arabica::XPath::NodeSet<std::string> InterpreterDraft6::selectEventlessTransitions() {
Arabica::XPath::NodeSet<std::string> enabledTransitions;
NodeSet<std::string> states;
for (unsigned int i = 0; i < _configuration.size(); i++) {
if (isAtomic(_configuration[i]))
states.push_back(_configuration[i]);
}
states.to_document_order();
#if 0
std::cout << "Atomic States: ";
for (int i = 0; i < atomicStates.size(); i++) {
std::cout << ATTR(atomicStates[i], "id") << ", ";
}
std::cout << std::endl;
#endif
unsigned int index = 0;
while(states.size() > index) {
bool foundTransition = false;
NodeSet<std::string> transitions = filterChildElements(_nsInfo.xmlNSPrefix + "transition", states[index]);
for (unsigned int k = 0; k < transitions.size(); k++) {
if (!HAS_ATTR(transitions[k], "event") && hasConditionMatch(transitions[k])) {
enabledTransitions.push_back(transitions[k]);
foundTransition = true;
goto LOOP;
}
}
if (!foundTransition) {
Node<std::string> parent = states[index].getParentNode();
if (parent) {
states.push_back(parent);
}
}
LOOP:
index++;
}
#if 0
std::cout << "Enabled eventless transitions: " << std::endl;
for (int i = 0; i < enabledTransitions.size(); i++) {
std::cout << enabledTransitions[i] << std::endl << "----" << std::endl;
}
std::cout << std::endl;
#endif
enabledTransitions = filterPreempted(enabledTransitions);
return enabledTransitions;
}
示例7: load_document
void load_document(const std::string& location,
Arabica::XPath::NodeSet<std::string>& nodes) const
{
SAX2DOM::Parser<std::string> domParser;
SAX::CatchErrorHandler<std::string> eh;
domParser.setErrorHandler(eh);
Arabica::io::URI base(baseURI_);
Arabica::io::URI absolute(base, location);
SAX::InputSource<std::string> is(absolute.as_string());
domParser.parse(is);
if(!eh.errorsReported())
nodes.push_back(domParser.getDocument());
else
std::cerr << eh.errors() << std::endl;
} // load_document