本文整理汇总了C++中XMLToken::isStart方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLToken::isStart方法的具体用法?C++ XMLToken::isStart怎么用?C++ XMLToken::isStart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLToken
的用法示例。
在下文中一共展示了XMLToken::isStart方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isEnd
/*
* @return @c true if this XMLToken is an XML end element for the given XML
* start element, false otherwise.
*/
bool
XMLToken::isEndFor (const XMLToken& element) const
{
return
isEnd() &&
!isStart() &&
element.isStart() &&
element.getName() == getName() &&
element.getURI () == getURI ();
}
示例2: while
unsigned int
XMLTokenizer::determineNumSpecificChildren(bool & valid,
const std::string& qualifier,
const std::string& container)
{
valid = false;
unsigned int numQualifiers = 0;
size_t size = mTokens.size();
if (size < 2)
{
return numQualifiers;
}
unsigned int depth = 0;
unsigned int index = 0;
std::string name;
std::string prevName = "";
std::string rogueTag = "";
XMLToken next = mTokens.at(index);
name = next.getName();
if (next.isStart() == true && next.isEnd() == true &&
name == qualifier && index < size)
{
numQualifiers++;
index++;
next = mTokens.at(index);
}
bool cleanBreak = false;
while (index < size-2)
{
// skip any text elements
while(next.isText() == true && index < size-1)
{
index++;
next = mTokens.at(index);
}
if (next.isEnd() == true)
{
if (next.getName() == container)
{
valid = true;
break;
}
//else if (!rogueTag.empty() && next.getName() == rogueTag)
//{
// index++;
// next = mTokens.at(index);
// break;
//}
}
// iterate to first start element
while (next.isStart() == false && index < size-1)
{
index++;
next = mTokens.at(index);
}
if (next.isStart() == true && next.isEnd() == true)
{
if (qualifier.empty() == true)
{
// if we are not looking for a specifc element then
// we may have a child that is a start and end
// such as <true/>
numQualifiers++;
}
index++;
if (index < size)
{
next = mTokens.at(index);
continue;
}
}
// check we have not reached the end
// this would be a bad place if we have so set num children to zero
if (index == size)
{
numQualifiers = 0;
break;
}
// record the name of the start element
name = next.getName();
// need to deal with the weird situation where someone has used a tag
// after the piece but before the next correct element
//if (container == "piecewise")
//{
// if (prevName == "piece")
// {
// if (name != "piece" && name != "otherwise")
// {
// rogueTag = name;
// index++;
// next = mTokens.at(index);
// continue;
//.........这里部分代码省略.........
示例3: if
unsigned int
XMLTokenizer::determineNumberChildren(bool & valid, const std::string element)
{
valid = false;
unsigned int numChildren = 0;
std::string closingTag = element;
bool forcedElement = true;
if (closingTag.empty() == true)
{
closingTag = "apply";
forcedElement = false;
}
// if there is only one token there cannot be any children
size_t size = mTokens.size();
if (size < 2)
{
return numChildren;
}
// we assume that the first unread token is a
// function and that at some point in the
// list of tokens we will hit the end of the
// element for that function
// need to count the number of starts
unsigned int index = 0;
XMLToken firstUnread = mTokens.at(index);
while (firstUnread.isText() && index < size - 1)
{
// skip any text
index++;
firstUnread = mTokens.at(index);
}
// if we have an apply the firstToken should be a function
// that is both a start and an end
// unless we are reading a user function
// or a csymbol
// if the tag is not a start and an end this is an error
// we want to exit
// but be happy that the read is ok
// and the error gets logged elsewhere
if (closingTag == "apply")
{
std::string firstName = firstUnread.getName();
if (firstName != "ci" && firstName != "csymbol")
{
if (firstUnread.isStart() != true
|| (firstUnread.isStart() == true && firstUnread.isEnd() != true))
{
valid = true;
return numChildren;
}
}
}
index = 1;
if (forcedElement == true)
{
index = 0;
}
unsigned int depth = 0;
std::string name;
bool cleanBreak = false;
XMLToken next = mTokens.at(index);
while (index < size-2)
{
// skip any text elements
while(next.isText() == true && index < size-1)
{
index++;
next = mTokens.at(index);
}
if (next.isEnd() == true && next.getName() == closingTag)
{
valid = true;
break;
}
// iterate to first start element
while (next.isStart() == false && index < size-1)
{
index++;
next = mTokens.at(index);
}
// check we have not reached the end
// this would be a bad place if we have so set num children to zero
if (index == size)
{
numChildren = 0;
break;
}
// record the name of the start element
name = next.getName();
numChildren++;
//.........这里部分代码省略.........