本文整理汇总了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);
}
}
}
}
示例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);
}
}
}
}
示例3: getColourFromVar
static Colour getColourFromVar (const var& col)
{
return col.isString() ? Colour::fromString (col.toString())
: Colours::transparentBlack;
}
示例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;
}