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


C++ TiXmlText::Blank方法代码示例

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


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

示例1: ReadValue

const char* TiXmlElement::ReadValue(const char* p, TiXmlParsingData* data,
        TiXmlEncoding encoding) {
    TiXmlDocument* document = GetDocument();

    // Read in text and elements in any order.
    const char* pWithWhiteSpace = p;
    p = SkipWhiteSpace(p, encoding);

    while (p && *p) {
        if (*p != '<') {
            // Take what we have, make a text element.
            TiXmlText* textNode = new TiXmlText("");

            if (!textNode) {
                if (document)
                    document->SetError(TIXML_ERROR_OUT_OF_MEMORY, 0, 0,
                            encoding);
                return 0;
            }

            if (TiXmlBase::IsWhiteSpaceCondensed()) {
                p = textNode->Parse(p, data, encoding);
            } else {
                // Special case: we want to keep the white space
                // so that leading spaces aren't removed.
                p = textNode->Parse(pWithWhiteSpace, data, encoding);
            }

            if (!textNode->Blank())
                LinkEndChild(textNode);
            else
                delete textNode;
        } else {
            // We hit a '<'
            // Have we hit a new element or an end tag? This could also be
            // a TiXmlText in the "CDATA" style.
            if (StringEqual(p, "</", false, encoding)) {
                return p;
            } else {
                TiXmlNode* node = Identify(p, encoding);
                if (node) {
                    p = node->Parse(p, data, encoding);
                    LinkEndChild(node);
                } else {
                    return 0;
                }
            }
        }
        pWithWhiteSpace = p;
        p = SkipWhiteSpace(p, encoding);
    }

    if (!p) {
        if (document)
            document->SetError(TIXML_ERROR_READING_ELEMENT_VALUE, 0, 0,
                    encoding);
    }
    return p;
}
开发者ID:cboettig,项目名称:appl,代码行数:59,代码来源:tinyxmlparser.cpp

示例2: ReadValue

const char* TiXmlElement::ReadValue( const char* p, TiXmlParsingData* data )
{
    TiXmlDocument* document = GetDocument();

    // Read in text and elements in any order.
    p = SkipWhiteSpace( p );
    while ( p && *p )
    {
        if ( *p != '<' )
        {
            // Take what we have, make a text element.
            TiXmlText* textNode = new TiXmlText( "" );

            if ( !textNode )
            {
                if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0 );
                return 0;
            }

            p = textNode->Parse( p, data );

            if ( !textNode->Blank() )
                LinkEndChild( textNode );
            else
                delete textNode;
        }
        else
        {
            // We hit a '<'
            // Have we hit a new element or an end tag?
            if ( StringEqual( p, "</", false ) )
            {
                return p;
            }
            else
            {
                TiXmlNode* node = Identify( p );
                if ( node )
                {
                    p = node->Parse( p, data );
                    LinkEndChild( node );
                }
                else
                {
                    return 0;
                }
            }
        }
        p = SkipWhiteSpace( p );
    }

    if ( !p )
    {
        if ( document ) document->SetError( TIXML_ERROR_READING_ELEMENT_VALUE, 0, 0 );
    }
    return p;
}
开发者ID:vovoid,项目名称:vsxu-archive,代码行数:57,代码来源:tinyxmlparser.cpp

示例3: data

const char* TiXmlDocument::Parse
  ( const char* p, TiXmlParsingData* prevData, TiXmlEncoding encoding )
{
    ClearError();

    // Parse away, at the document level. Since a document
    // contains nothing but other tags, most of what happens
    // here is skipping white space.
    // sherm 100319: I changed this so that untagged top-level text is
    // parsed as a Text node rather than a parsing error. CDATA text was
    // already allowed at the top level so this seems more consistent.
    if ( !p || !*p )
    {
        SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
        return 0;
    }

    // Note that, for a document, this needs to come
    // before the while space skip, so that parsing
    // starts from the pointer we are given.
    location.Clear();
    if ( prevData )
    {
        location.row = prevData->cursor.row;
        location.col = prevData->cursor.col;
    }
    else
    {
        location.row = 0;
        location.col = 0;
    }
    TiXmlParsingData data( p, TabSize(), location.row, location.col );
    location = data.Cursor();

    if ( encoding == TIXML_ENCODING_UNKNOWN )
    {
        // Check for the Microsoft UTF-8 lead bytes.
        const unsigned char* pU = (const unsigned char*)p;
        if (    *(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0
             && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1
             && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 )
        {
            encoding = TIXML_ENCODING_UTF8;
            useMicrosoftBOM = true;
        }
    }

    // Remember the start of white space in case we end up reading a text
    // element in a "keep white space" mode.
    const char* pWithWhiteSpace = p;
    p = SkipWhiteSpace( p, encoding );
    if ( !p )
    {
        SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
        return 0;
    }

    // sherm 100319: ignore all but the first Declaration
    bool haveSeenDeclaration = false;
    while ( p && *p )
    {
        TiXmlNode* node = 0;
        if ( *p != '<' )
        {   // sherm 100319: I added this case by stealing the code from
            // Element parsing; see above comment.
            // Take what we have, make a text element.
            TiXmlText* textNode = new TiXmlText( "" );

            if ( !textNode )
            {
                SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, encoding );
                return 0;
            }

            if ( TiXmlBase::IsWhiteSpaceCondensed() )
            {
                p = textNode->Parse( p, &data, encoding );
            }
            else
            {
                // Special case: we want to keep the white space
                // so that leading spaces aren't removed.
                p = textNode->Parse( pWithWhiteSpace, &data, encoding );
            }

            if ( !textNode->Blank() ) {
                LinkEndChild( textNode );
                node = textNode;
            }
            else
                delete textNode;
        }
        else // We saw a '<', now identify what kind of tag it is.
        {
            TiXmlNode* node = Identify( p, encoding );
            if ( node )
            {
                p = node->Parse( p, &data, encoding );
                if (node->ToDeclaration()) {
                    if (haveSeenDeclaration) {
//.........这里部分代码省略.........
开发者ID:thomasklau,项目名称:simbody,代码行数:101,代码来源:tinyxmlparser.cpp


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