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


C++ SegmentedString类代码示例

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


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

示例1: documentWrite

static inline void documentWrite(ExecState& state, JSHTMLDocument* thisDocument, NewlineRequirement addNewline)
{
    HTMLDocument* document = &thisDocument->wrapped();
    // DOM only specifies single string argument, but browsers allow multiple or no arguments.

    size_t size = state.argumentCount();

    String firstString = state.argument(0).toString(&state)->value(&state);
    SegmentedString segmentedString = firstString;
    if (size != 1) {
        if (!size)
            segmentedString.clear();
        else {
            for (size_t i = 1; i < size; ++i) {
                String subsequentString = state.uncheckedArgument(i).toString(&state)->value(&state);
                segmentedString.append(SegmentedString(subsequentString));
            }
        }
    }
    if (addNewline)
        segmentedString.append(SegmentedString(String(&newlineCharacter, 1)));

    Document* activeDocument = findCallingDocument(state);
    document->write(segmentedString, activeDocument);
}
开发者ID:hnney,项目名称:webkit,代码行数:25,代码来源:JSHTMLDocumentCustom.cpp

示例2: write

void TextTokenizer::write(const SegmentedString& s, bool)
{
    ExceptionCode ec;

    m_dest = m_buffer;
    
    SegmentedString str = s;
    while (!str.isEmpty()) {
        UChar c = *str;
        
        if (c == '\r') {
            *m_dest++ = '\n';
            
            // possibly skip an LF in the case of an CRLF sequence
            m_skipLF = true;
        } else if (c == '\n') {
            if (!m_skipLF)
                *m_dest++ = c;
            else
                m_skipLF = false;
        } else {
            *m_dest++ = c;
            m_skipLF = false;
        }
        
        str.advance();
        
        // Maybe enlarge the buffer
        checkBuffer();
    }

    if (!m_preElement && !inViewSourceMode()) {
        RefPtr<Element> rootElement = m_doc->createElement(htmlTag, false);
        m_doc->appendChild(rootElement, ec);

        RefPtr<Element> body = m_doc->createElement(bodyTag, false);
        rootElement->appendChild(body, ec);

        RefPtr<Element> preElement = m_doc->createElement(preTag, false);
        preElement->setAttribute("style", "word-wrap: break-word; white-space: pre-wrap;", ec);

        body->appendChild(preElement, ec);
        
        m_preElement = preElement.get();
    } 
    
    String string = String(m_buffer, m_dest - m_buffer);
    if (inViewSourceMode()) {
        static_cast<HTMLViewSourceDocument*>(m_doc)->addViewSourceText(string);
        return;
    }

    unsigned charsLeft = string.length();
    while (charsLeft) {
        // split large text to nodes of manageable size
        RefPtr<Text> text = Text::createWithLengthLimit(m_doc, string, charsLeft);
        m_preElement->appendChild(text, ec);
    }
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:59,代码来源:TextDocument.cpp

示例3: prepend

void SegmentedString::prepend(const SegmentedString& s)
{
    ASSERT(!escaped());
    ASSERT(!s.escaped());
    if (s.isComposite()) {
        Deque<SegmentedSubstring>::const_reverse_iterator it = s.m_substrings.rbegin();
        Deque<SegmentedSubstring>::const_reverse_iterator e = s.m_substrings.rend();
        for (; it != e; ++it)
            prepend(*it);
    }
    prepend(s.m_currentString);
    m_currentChar = m_pushedChar1 ? m_pushedChar1 : (m_currentString.m_length ? m_currentString.getCurrentChar() : 0);
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:13,代码来源:SegmentedString.cpp

示例4: write

bool TextTokenizer::write(const SegmentedString& s, bool appendData)
{
    ExceptionCode ec;

    m_dest = m_buffer;
    
    SegmentedString str = s;
    while (!str.isEmpty()) {
        UChar c = *str;
        
        if (c == '\r') {
            *m_dest++ = '\n';
            
            // possibly skip an LF in the case of an CRLF sequence
            m_skipLF = true;
        } else if (c == '\n') {
            if (!m_skipLF)
                *m_dest++ = c;
            else
                m_skipLF = false;
        } else {
            *m_dest++ = c;
            m_skipLF = false;
        }
        
        ++str;
        
        // Maybe enlarge the buffer
        checkBuffer();
    }

    if (!m_preElement) {
        RefPtr<Element> rootElement = m_doc->createElementNS(xhtmlNamespaceURI, "html", ec);
        m_doc->appendChild(rootElement, ec);

        RefPtr<Element> body = m_doc->createElementNS(xhtmlNamespaceURI, "body", ec);
        rootElement->appendChild(body, ec);

        RefPtr<Element> preElement = m_doc->createElementNS(xhtmlNamespaceURI, "pre", ec);
        body->appendChild(preElement, ec);
        
        m_preElement = preElement.get();
    } 
    
    String string = String(m_buffer, m_dest - m_buffer);
    
    RefPtr<Text> text = m_doc->createTextNode(string);
    m_preElement->appendChild(text, ec);

    return false;
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:51,代码来源:TextDocument.cpp

示例5: end

void HTMLSourceTracker::end(SegmentedString& currentInput, HTMLTokenizer* tokenizer, HTMLToken& token)
{
    m_cachedSourceForToken = String();

    // FIXME: This work should really be done by the HTMLTokenizer.
    token.end(currentInput.numberOfCharactersConsumed() - tokenizer->numberOfBufferedCharacters());
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:7,代码来源:HTMLSourceTracker.cpp

示例6: write

void XMLTokenizer::write(const SegmentedString& s, bool /*appendData*/)
{
    String parseString = s.toString();
    
    if (m_sawXSLTransform || !m_sawFirstElement)
        m_originalSourceForTransform += parseString;

    if (m_parserStopped || m_sawXSLTransform)
        return;
    
    if (m_parserPaused) {
        m_pendingSrc.append(s);
        return;
    }
    
    doWrite(s.toString());
}
开发者ID:boyliang,项目名称:ComponentSuperAccessor,代码行数:17,代码来源:XMLTokenizer.cpp

示例7: emitRule

void CSSPreloadScanner::emitRule(const SegmentedString& source)
{
    if (equalIgnoringCase("import", m_rule.characters(), m_rule.length())) {
        String url = parseCSSStringOrURL(m_ruleValue.characters(), m_ruleValue.length());
        if (!url.isEmpty()) {
            KURL baseElementURL; // FIXME: This should be passed in from the HTMLPreloadScaner via scan()!
            TextPosition position = TextPosition(source.currentLine(), source.currentColumn());
            OwnPtr<PreloadRequest> request = PreloadRequest::create("css", position, url, baseElementURL, CachedResource::CSSStyleSheet);
            // FIXME: Should this be including the charset in the preload request?
            m_requests->append(request.release());
        }
        m_state = Initial;
    } else if (equalIgnoringCase("charset", m_rule.characters(), m_rule.length()))
        m_state = Initial;
    else
        m_state = DoneParsingImportRules;
    m_rule.clear();
    m_ruleValue.clear();
}
开发者ID:,项目名称:,代码行数:19,代码来源:

示例8: append

void XMLDocumentParser::append(const SegmentedString& s)
{
    String parseString = s.toString();

    if (m_sawXSLTransform || !m_sawFirstElement)
        m_originalSourceForTransform += parseString;

    if (isStopped() || m_sawXSLTransform)
        return;

    if (m_parserPaused) {
        m_pendingSrc.append(s);
        return;
    }

    doWrite(s.toString());

    // After parsing, go ahead and dispatch image beforeload events.
    ImageLoader::dispatchPendingBeforeLoadEvents();
}
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:20,代码来源:XMLDocumentParser.cpp

示例9: consumeNamedEntity

 static bool consumeNamedEntity(SegmentedString& source, StringBuilder& decodedEntity, bool& notEnoughCharacters, UChar additionalAllowedCharacter, UChar& cc)
 {
     StringBuilder consumedCharacters;
     HTMLEntitySearch entitySearch;
     while (!source.isEmpty()) {
         cc = source.currentChar();
         entitySearch.advance(cc);
         if (!entitySearch.isEntityPrefix())
             break;
         consumedCharacters.append(cc);
         source.advance();
     }
     notEnoughCharacters = source.isEmpty();
     if (notEnoughCharacters) {
         // We can't an entity because there might be a longer entity
         // that we could match if we had more data.
         unconsumeCharacters(source, consumedCharacters);
         return false;
     }
     if (!entitySearch.mostRecentMatch()) {
         unconsumeCharacters(source, consumedCharacters);
         return false;
     }
     if (entitySearch.mostRecentMatch()->length != entitySearch.currentLength()) {
         // We've consumed too many characters. We need to walk the
         // source back to the point at which we had consumed an
         // actual entity.
         unconsumeCharacters(source, consumedCharacters);
         consumedCharacters.clear();
         const int length = entitySearch.mostRecentMatch()->length;
         const LChar* reference = entitySearch.mostRecentMatch()->entity;
         for (int i = 0; i < length; ++i) {
             cc = source.currentChar();
             ASSERT_UNUSED(reference, cc == *reference++);
             consumedCharacters.append(cc);
             source.advance();
             ASSERT(!source.isEmpty());
         }
         cc = source.currentChar();
     }
     if (entitySearch.mostRecentMatch()->lastCharacter() == ';'
         || !additionalAllowedCharacter
         || !(isASCIIAlphanumeric(cc) || cc == '=')) {
         decodedEntity.append(entitySearch.mostRecentMatch()->firstValue);
         if (entitySearch.mostRecentMatch()->secondValue)
             decodedEntity.append(entitySearch.mostRecentMatch()->secondValue);
         return true;
     }
     unconsumeCharacters(source, consumedCharacters);
     return false;
 }
开发者ID:caiolima,项目名称:webkit,代码行数:51,代码来源:HTMLEntityParser.cpp

示例10: append

void SegmentedString::append(const SegmentedString &s)
{
    ASSERT(!s.escaped());
    append(s.m_currentString);
    if (s.m_composite) {
        DeprecatedValueListConstIterator<SegmentedSubstring> i = s.m_substrings.begin();
        DeprecatedValueListConstIterator<SegmentedSubstring> e = s.m_substrings.end();
        for (; i != e; ++i)
            append(*i);
    }
    m_currentChar = m_pushedChar1 ? &m_pushedChar1 : m_currentString.m_current;
}
开发者ID:pk-codebox-evo,项目名称:remixos-usb-tool,代码行数:12,代码来源:SegmentedString.cpp

示例11: ASSERT

void XMLDocumentParser::resumeParsing()
{
    ASSERT(m_parserPaused);

    m_parserPaused = false;

    // First, execute any pending callbacks
    parse();
    if (m_parserPaused)
        return;

    // Then, write any pending data
    SegmentedString rest = m_pendingSrc;
    m_pendingSrc.clear();
    append(rest.toString().impl());

    // Finally, if finish() has been called and append() didn't result
    // in any further callbacks being queued, call end()
    if (m_finishCalled && !m_parserPaused && !m_pendingScript)
        end();
}
开发者ID:,项目名称:,代码行数:21,代码来源:

示例12: prepend

void SegmentedString::prepend(const SegmentedString& s, PrependType type) {
  if (s.isComposite()) {
    Deque<SegmentedSubstring>::const_reverse_iterator it =
        s.m_substrings.rbegin();
    Deque<SegmentedSubstring>::const_reverse_iterator e = s.m_substrings.rend();
    for (; it != e; ++it)
      prepend(*it, type);
  }
  prepend(s.m_currentString, type);
  m_currentChar =
      m_currentString.length() ? m_currentString.getCurrentChar() : 0;
}
开发者ID:ollie314,项目名称:chromium,代码行数:12,代码来源:SegmentedString.cpp

示例13: append

void SegmentedString::append(const SegmentedString &s)
{
    ASSERT(!m_closed);
    ASSERT(!s.escaped());
    append(s.m_currentString);
    if (s.m_composite) {
        Deque<SegmentedSubstring>::const_iterator it = s.m_substrings.begin();
        Deque<SegmentedSubstring>::const_iterator e = s.m_substrings.end();
        for (; it != e; ++it)
            append(*it);
    }
    m_currentChar = m_pushedChar1 ? &m_pushedChar1 : m_currentString.m_current;
}
开发者ID:mcgrawp,项目名称:webkit-webcl,代码行数:13,代码来源:SegmentedString.cpp

示例14: append

void SegmentedString::append(const SegmentedString& s) {
  ASSERT(!m_closed);

  append(s.m_currentString);
  if (s.isComposite()) {
    Deque<SegmentedSubstring>::const_iterator it = s.m_substrings.begin();
    Deque<SegmentedSubstring>::const_iterator e = s.m_substrings.end();
    for (; it != e; ++it)
      append(*it);
  }
  m_currentChar =
      m_currentString.length() ? m_currentString.getCurrentChar() : 0;
}
开发者ID:ollie314,项目名称:chromium,代码行数:13,代码来源:SegmentedString.cpp

示例15: prepend

void SegmentedString::prepend(const SegmentedString &s)
{
    ASSERT(!escaped());
    ASSERT(!s.escaped());
    if (s.m_composite) {
        DeprecatedValueListConstIterator<SegmentedSubstring> i = s.m_substrings.fromLast();
        DeprecatedValueListConstIterator<SegmentedSubstring> e = s.m_substrings.end();
        for (; i != e; --i)
            prepend(*i);
    }
    prepend(s.m_currentString);
    m_currentChar = m_pushedChar1 ? &m_pushedChar1 : m_currentString.m_current;
}
开发者ID:pk-codebox-evo,项目名称:remixos-usb-tool,代码行数:13,代码来源:SegmentedString.cpp


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