Example #1
0
LargestInt 
Value::asLargestInt() const
{
#if defined(JSON_NO_INT64)
    return asInt();
#else
    return asInt64();
#endif
}
Example #2
0
ValueKey Value::key() const
{
    switch (opcode()) {
    case FramePointer:
        return ValueKey(opcode(), type());
    case Identity:
    case SExt8:
    case SExt16:
    case SExt32:
    case ZExt32:
    case Trunc:
    case FRound:
    case IToD:
    case DToI32:
    case Check:
        return ValueKey(opcode(), type(), child(0));
    case Add:
    case Sub:
    case Mul:
    case ChillDiv:
    case Mod:
    case BitAnd:
    case BitOr:
    case BitXor:
    case Shl:
    case SShr:
    case ZShr:
    case Equal:
    case NotEqual:
    case LessThan:
    case GreaterThan:
    case Above:
    case Below:
    case AboveEqual:
    case BelowEqual:
    case Div:
    case CheckAdd:
    case CheckSub:
    case CheckMul:
        return ValueKey(opcode(), type(), child(0), child(1));
    case Const32:
        return ValueKey(Const32, type(), static_cast<int64_t>(asInt32()));
    case Const64:
        return ValueKey(Const64, type(), asInt64());
    case ConstDouble:
        return ValueKey(ConstDouble, type(), asDouble());
    case ArgumentReg:
        return ValueKey(
            ArgumentReg, type(),
            static_cast<int64_t>(as<ArgumentRegValue>()->argumentReg().index()));
    default:
        return ValueKey();
    }
}
Example #3
0
TriState Value::asTriState() const
{
    switch (opcode()) {
    case Const32:
        return triState(!!asInt32());
    case Const64:
        return triState(!!asInt64());
    case ConstDouble:
        // Use "!= 0" to really emphasize what this mean with respect to NaN and such.
        return triState(asDouble() != 0);
    default:
        return MixedTriState;
    }
}
Example #4
0
    void AttributeWriter::addElement(NwkAddr nwkAddr, EndpointID endpointID, std::shared_ptr<zigbee::Cluster> cluster, Json::Value &&value,
                                     AttributeWriterResult &results) {
        auto jsonId = value["id"];
        if (!jsonId.isInt()) {
            return;
        }
        int id = jsonId.asInt();
        auto jsonType = value["type"];
        if (!jsonType.isString()) {
            return;
        }
        auto jsonData = value["data"];
        auto type = jsonType.asString();
        auto zigbeeDevice = singletons.getZigbeeDevice();
        auto attribute = cluster->getAttribute(id);
        auto &rawValue = attribute->getAttributeRawValue();
        if (type == "string") {
            if (!jsonData.isString()) {
                return;
            }
            rawValue(jsonData.asString());
        } else  if (type == "int" && jsonData.isInt64()){
            rawValue(jsonData.asInt64());
        } else  if (type == "raw" && jsonData.isArray()){
            std::vector<uint8_t > rawData;
            for (Json::Value::ArrayIndex i = 0; i < jsonData.size(); i++) {
                rawData.push_back(jsonData[i].asInt());
            }

            rawValue(rawData);
        } else {
            return;
        }
        zigbeeDevice->writeAttribute(nwkAddr, endpointID, cluster->getId(), id, rawValue.type, rawValue.rawData.size(), &rawValue.rawData[0]);
        results.add(id);
    }
Example #5
0
 long long ProcessId::asLongLong() const {
     return static_cast<long long>(asInt64());
 }
Example #6
0
Variant::operator int64_t() const { return asInt64(); }
Example #7
0
	inline operator 			int64_t() const 		{ return asInt64(); 	}