本文整理汇总了C++中XMLToken::isText方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLToken::isText方法的具体用法?C++ XMLToken::isText怎么用?C++ XMLToken::isText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLToken
的用法示例。
在下文中一共展示了XMLToken::isText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
bool
XMLTokenizer::containsChild(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 false;
}
unsigned int index = 0;
//unsigned int depth = 0;
std::string name;
XMLToken next = mTokens.at(index);
name = next.getName();
while (index < size-2)
{
// skip any text elements
while(next.isText() == true && index < size-1)
{
index++;
next = mTokens.at(index);
}
if (next.getName() == qualifier)
{
valid = true;
return true;
}
index++;
if (index < size)
{
next = mTokens.at(index);
}
}
// we might have hit the end of the loop and the end of the correct tag
if (valid == false && index >= size-2)
{
valid = true;
}
return false;
}
示例2: 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++;
//.........这里部分代码省略.........