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


C++ StylesheetConstructionContext::allocateAVTPartPointerVector方法代码示例

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


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

示例1: buffer

/**
 * Construct an AVT by parsing the string, and either 
 * constructing a vector of AVTParts, or simply hold 
 * on to the string if the AVT is simple.
 */
AVT::AVT(
            StylesheetConstructionContext&  constructionContext,
            const LocatorType*              locator,
            const XalanDOMChar*             name,
            const XalanDOMChar*             stringedValue,
            const PrefixResolver&           resolver) :
        m_parts(0),
        m_partsSize(0),
        m_simpleString(0),
        m_simpleStringLength(0),
        m_name(constructionContext.getPooledString(name))
{
    StringTokenizer     tokenizer(stringedValue, theTokenDelimiterCharacters, true);

    const StringTokenizer::size_type    nTokens = tokenizer.countTokens();

    if(nTokens < 2)
    {
        // Do the simple thing
        m_simpleStringLength = length(stringedValue);

        m_simpleString = constructionContext.allocateXalanDOMCharVector(stringedValue, m_simpleStringLength, false);
    }
    else
    {
        // This over-allocates, but we probably won't waste that much space.  If necessary,
        // we could tokenize twice, just counting the numbers of AVTPart instances we
        // will need the first time.
        m_parts = constructionContext.allocateAVTPartPointerVector(nTokens + 1);

        XalanDOMString  buffer(constructionContext.getMemoryManager());
        XalanDOMString  exprBuffer(constructionContext.getMemoryManager());
        XalanDOMString  t(constructionContext.getMemoryManager()); // base token
        XalanDOMString  lookahead(constructionContext.getMemoryManager()); // next token

        while(tokenizer.hasMoreTokens())
        {
            if(length(lookahead))
            {
                t = lookahead;

                clear(lookahead);
            }
            else
            {
                nextToken(constructionContext, locator, tokenizer, t);
            }

            if(length(t) == 1)
            {
                const XalanDOMChar  theChar = charAt(t, 0);

                switch(theChar)
                {
                    case(XalanUnicode::charLeftCurlyBracket):
                    {
                        // Attribute Value Template start
                        nextToken(constructionContext, locator, tokenizer, lookahead);

                        if(equals(lookahead, theLeftCurlyBracketString))
                        {
                            // Double braces mean escape to show brace
                            append(buffer, lookahead);

                            clear(lookahead);

                            break; // from switch
                        }
                        else
                        {
                            if(length(buffer) > 0)
                            {
                                assert(m_partsSize + 1 < nTokens);

                                m_parts[m_partsSize++] =
                                    constructionContext.createAVTPart(
                                        c_wstr(buffer),
                                        length(buffer));

                                clear(buffer);
                            }
                                    
                            clear(exprBuffer);

                            while(length(lookahead) > 0 && !equals(lookahead, theRightCurlyBracketString))
                            {
                                if(length(lookahead) == 1)
                                {
                                    switch(charAt(lookahead, 0))
                                    {
                                        case XalanUnicode::charApostrophe:
                                        case XalanUnicode::charQuoteMark:
                                        {
                                            // String start
                                            append(exprBuffer, lookahead);
//.........这里部分代码省略.........
开发者ID:rherardi,项目名称:xml-xalan-c-src_1_10_0,代码行数:101,代码来源:AVT.cpp


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