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


C++ var::isString方法代码示例

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


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

示例1: mouseDrag

    void mouseDrag (const MouseEvent& e)
    {
        if (isEnabled() && owner.getModel() != nullptr && ! (e.mouseWasClicked() || isDragging))
        {
            const SparseSet<int> selectedRows (owner.getSelectedRows());

            if (selectedRows.size() > 0)
            {
                const var dragDescription (owner.getModel()->getDragSourceDescription (selectedRows));

                if (! (dragDescription.isVoid() || (dragDescription.isString() && dragDescription.toString().isEmpty())))
                {
                    isDragging = true;
                    owner.startDragAndDrop (e, dragDescription);
                }
            }
        }
    }
开发者ID:sonic59,项目名称:JuceEditor,代码行数:18,代码来源:juce_ListBox.cpp

示例2: mouseDrag

    void mouseDrag (const MouseEvent& e) override
    {
        if (isEnabled() && owner.getModel() != nullptr && ! (e.mouseWasClicked() || isDragging))
        {
            SparseSet<int> rowsToDrag;

            if (owner.selectOnMouseDown || owner.isRowSelected (row))
                rowsToDrag = owner.getSelectedRows();
            else
                rowsToDrag.addRange (Range<int>::withStartAndLength (row, 1));

            if (rowsToDrag.size() > 0)
            {
                const var dragDescription (owner.getModel()->getDragSourceDescription (rowsToDrag));

                if (! (dragDescription.isVoid() || (dragDescription.isString() && dragDescription.toString().isEmpty())))
                {
                    isDragging = true;
                    owner.startDragAndDrop (e, rowsToDrag, dragDescription, true);
                }
            }
        }
    }
开发者ID:AlessandroGiacomini,项目名称:pyplasm,代码行数:23,代码来源:juce_TableListBox.cpp

示例3: getColourFromVar

 static Colour getColourFromVar (const var& col)
 {
     return col.isString() ? Colour::fromString (col.toString())
                           : Colours::transparentBlack;
 }
开发者ID:Emisense,项目名称:S3Test,代码行数:5,代码来源:juce_ImageButton.cpp

示例4: equality

bool compare::equality(var& x, var& y) {

  // 1. If Type(x) is the same as Type(y), then
  if (x.adapter->type == y.adapter->type) {

    // 1. If Type(x) is Undefined, return true.
    if (x.isUndefined())
      return true;

    // 2. If Type(x) is Null, return true.
    if (x.isNull())
      return true;

    // 3. If Type(x) is Number, then
    if (x.isNumber()) {

      // 1. If x is NaN, return false.
      // 2. If y is NaN, return false.

      // (TODO: NaN checks?)

      // 3. If x is the same Number value as y, return true.
      if (x.numberValue == y.numberValue)
        return true;

      // 4. If x is +0 and y is -0, return true.
      if (x.numberValue == +0 && y.numberValue == -0)
        return true;

      // 5. If x is -0 and y is +0, return true.
      if (x.numberValue == -0 && y.numberValue == +0)
        return true;

      // 6. Return false.
      return false;

    }

    // 4. If Type(x) is String, then return true if x and y are exactly the same sequence of characters 
    //    (same length and same characters in corresponding positions). Otherwise, return false.
    if (x.isString())
      return x.stringValue == y.stringValue;

    // 5. If Type(x) is Boolean, return true if x and y are both true or both false. Otherwise, return false.
    if (x.isBoolean())
      return x.booleanValue == y.booleanValue;

    // 6. Return true if x and y refer to the same object. Otherwise, return false.
    if (x.isObject())
      return x.objectValue == y.objectValue;
    if (x.isArray())
      return x.arrayValue == y.arrayValue;

    return false;

  }
  // 2. If x is null and y is undefined, return true.
  if (x.isNull() && y.isUndefined())
    return true;

  // 3. If x is undefined and y is null, return true.
  if (x.isUndefined() && y.isNull())
    return true;

  // 4. If Type(x) is Number and Type(y) is String, 
  //    return the result of the comparison x == ToNumber(y).
  if (x.isNumber() && y.isString())
    return x == (number) y;

  // 5. If Type(x) is String and Type(y) is Number, 
  //    return the result of the comparison ToNumber(x) == y.
  if (x.isString() && y.isNumber())
    return (var) (number) x == y;

  // 6. If Type(x) is Boolean, 
  //    return the result of the comparison ToNumber(x) == y.
  if (x.isBoolean())
    return (var) (number) x == y;

  // 7. If Type(y) is Boolean, 
  //    return the result of the comparison x == ToNumber(y).
  if (y.isBoolean())
    return x == (number) y;

  // 8. If Type(x) is either String or Number and Type(y) is Object, 
  //    return the result of the comparison x == ToPrimitive(y).
  if ((x.isString() || x.isNumber()) && (y.isObject() || y.isArray()))
    return x == (string) y;

  // 9. If Type(x) is Object and Type(y) is either String or Number, 
  //    return the result of the comparison ToPrimitive(x) == y.
  if ((x.isObject() || x.isArray()) && (y.isString() || y.isNumber()))
    return (var) (string) x == y;

  // 10. Return false.
  return false;

}
开发者ID:gitbuh,项目名称:jsontool,代码行数:98,代码来源:compare.cpp


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