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


C++ MediaQueryToken类代码示例

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


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

示例1: consumeNumber

// http://www.w3.org/TR/css3-syntax/#consume-a-numeric-token
MediaQueryToken MediaQueryTokenizer::consumeNumericToken()
{
    MediaQueryToken token = consumeNumber();
    if (nextCharsAreIdentifier())
        token.convertToDimensionWithUnit(consumeName());
    else if (consumeIfNext('%'))
        token.convertToPercentage();
    return token;
}
开发者ID:Miaque,项目名称:mojo,代码行数:10,代码来源:MediaQueryTokenizer.cpp

示例2: if

void MediaQueryBlockWatcher::handleToken(const MediaQueryToken& token)
{
    if (token.blockType() == MediaQueryToken::BlockStart) {
        ++m_blockLevel;
    } else if (token.blockType() == MediaQueryToken::BlockEnd) {
        ASSERT(m_blockLevel);
        --m_blockLevel;
    }
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:9,代码来源:MediaQueryBlockWatcher.cpp

示例3: readFeatureValue

void MediaQueryParser::readFeatureValue(MediaQueryTokenType type, const MediaQueryToken& token)
{
    if (type == DimensionToken && token.unitType() == CSSPrimitiveValue::CSS_UNKNOWN) {
        m_state = SkipUntilComma;
    } else {
        m_mediaQueryData.addParserValue(type, token);
        m_state = ReadFeatureEnd;
    }
}
开发者ID:jeremyroman,项目名称:blink,代码行数:9,代码来源:MediaQueryParser.cpp

示例4: readFeature

void MediaQueryParser::readFeature(MediaQueryTokenType type, const MediaQueryToken& token)
{
    if (type == IdentToken) {
        m_mediaQueryData.setMediaFeature(token.value());
        m_state = ReadFeatureColon;
    } else {
        m_state = SkipUntilComma;
    }
}
开发者ID:jeremyroman,项目名称:blink,代码行数:9,代码来源:MediaQueryParser.cpp

示例5: processToken

void MediaQueryParser::processToken(const MediaQueryToken& token)
{
    MediaQueryTokenType type = token.type();

    handleBlocks(token);
    m_blockWatcher.handleToken(token);

    // Call the function that handles current state
    if (type != WhitespaceToken && type != CommentToken)
        ((this)->*(m_state))(type, token);
}
开发者ID:jeremyroman,项目名称:blink,代码行数:11,代码来源:MediaQueryParser.cpp

示例6: readMediaType

void MediaQueryParser::readMediaType(MediaQueryTokenType type, const MediaQueryToken& token)
{
    if (type == LeftParenthesisToken) {
        m_state = ReadFeature;
    } else if (type == IdentToken) {
        if (m_state == ReadRestrictor && equalIgnoringCase(token.value(), "not")) {
            setStateAndRestrict(ReadMediaType, MediaQuery::Not);
        } else if (m_state == ReadRestrictor && equalIgnoringCase(token.value(), "only")) {
            setStateAndRestrict(ReadMediaType, MediaQuery::Only);
        } else {
            m_mediaQueryData.setMediaType(token.value());
            m_state = ReadAnd;
        }
    } else if (type == EOFToken && (!m_querySet->queryVector().size() || m_state != ReadRestrictor)) {
        m_state = Done;
    } else {
        m_state = SkipUntilComma;
        if (type == CommaToken)
            skipUntilComma(type, token);
    }
}
开发者ID:jeremyroman,项目名称:blink,代码行数:21,代码来源:MediaQueryParser.cpp

示例7: addParserValue

void MediaQueryData::addParserValue(MediaQueryTokenType type, const MediaQueryToken& token)
{
    CSSParserValue value;
    if (type == NumberToken || type == PercentageToken || type == DimensionToken) {
        value.setFromNumber(token.numericValue(), token.unitType());
        value.isInt = (token.numericValueType() == IntegerValueType);
    } else if (type == DelimiterToken) {
        value.unit = CSSParserValue::Operator;
        value.iValue = token.delimiter();
        value.id = CSSValueInvalid;
        value.isInt = false;
    } else {
        CSSParserString tokenValue;
        tokenValue.init(token.value());
        value.unit = CSSPrimitiveValue::CSS_IDENT;
        value.string = tokenValue;
        value.id = cssValueKeywordID(tokenValue);
        value.isInt = false;
    }
    m_valueList.addValue(value);
}
开发者ID:335969568,项目名称:Blink-1,代码行数:21,代码来源:MediaQueryParser.cpp

示例8: input

void MediaQueryTokenizer::tokenize(String string, Vector<MediaQueryToken>& outTokens)
{
    // According to the spec, we should perform preprocessing here.
    // See: http://dev.w3.org/csswg/css-syntax/#input-preprocessing
    //
    // However, we can skip this step since:
    // * We're using HTML spaces (which accept \r and \f as a valid white space)
    // * Do not count white spaces
    // * consumeEscape replaces NULLs for replacement characters

    if (string.isEmpty())
        return;

    MediaQueryInputStream input(string);
    MediaQueryTokenizer tokenizer(input);
    while (true) {
        MediaQueryToken token = tokenizer.nextToken();
        outTokens.append(token);
        if (token.type() == EOFToken)
            return;
    }
}
开发者ID:Miaque,项目名称:mojo,代码行数:22,代码来源:MediaQueryTokenizer.cpp

示例9: readAnd

void MediaQueryParser::readAnd(MediaQueryTokenType type, const MediaQueryToken& token)
{
    if (type == IdentToken && equalIgnoringCase(token.value(), "and")) {
        m_state = ReadFeatureStart;
    } else if (type == CommaToken) {
        m_querySet->addMediaQuery(m_mediaQueryData.takeMediaQuery());
        m_state = ReadRestrictor;
    } else if (type == EOFToken) {
        m_state = Done;
    } else {
        m_state = SkipUntilComma;
    }
}
开发者ID:jeremyroman,项目名称:blink,代码行数:13,代码来源:MediaQueryParser.cpp

示例10: readFeatureEnd

void MediaQueryParser::readFeatureEnd(MediaQueryTokenType type, const MediaQueryToken& token)
{
    if (type == RightParenthesisToken || type == EOFToken) {
        if (m_mediaQueryData.addExpression())
            m_state = ReadAnd;
        else
            m_state = SkipUntilComma;
    } else if (type == DelimiterToken && token.delimiter() == '/') {
        m_mediaQueryData.addParserValue(type, token);
        m_state = ReadFeatureValue;
    } else {
        m_state = SkipUntilBlockEnd;
    }
}
开发者ID:jeremyroman,项目名称:blink,代码行数:14,代码来源:MediaQueryParser.cpp

示例11: addParserValue

void MediaQueryData::addParserValue(MediaQueryTokenType type, const MediaQueryToken& token)
{
    CSSParserValue value;
    if (type == NumberToken || type == PercentageToken || type == DimensionToken) {
        value.setFromNumber(token.numericValue(), token.unitType());
        value.isInt = (token.numericValueType() == IntegerValueType);
    } else if (type == DelimiterToken) {
        value.unit = CSSParserValue::Operator;
        value.iValue = token.delimiter();
    } else {
        CSSParserFunction* function = new CSSParserFunction;
        function->name.init(token.value());
        value.setFromFunction(function);
        CSSParserString tokenValue;
        tokenValue.init(token.value());
        value.id = cssValueKeywordID(tokenValue);
    }
    m_valueList.addValue(value);
}
开发者ID:jeremyroman,项目名称:blink,代码行数:19,代码来源:MediaQueryParser.cpp

示例12: handleBlocks

void MediaQueryParser::handleBlocks(const MediaQueryToken& token)
{
    if (token.blockType() == MediaQueryToken::BlockStart
        && (token.type() != LeftParenthesisToken || m_blockWatcher.blockLevel()))
            m_state = SkipUntilBlockEnd;
}
开发者ID:jeremyroman,项目名称:blink,代码行数:6,代码来源:MediaQueryParser.cpp

示例13: skipUntilBlockEnd

void MediaQueryParser::skipUntilBlockEnd(MediaQueryTokenType type, const MediaQueryToken& token)
{
    if (token.blockType() == MediaQueryToken::BlockEnd && !m_blockWatcher.blockLevel())
        m_state = SkipUntilComma;
}
开发者ID:jeremyroman,项目名称:blink,代码行数:5,代码来源:MediaQueryParser.cpp


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