Ejemplo n.º 1
0
	Any& Any::next() {
		beforeRead();
		verifyType(ARRAY);
		int n = size();
		resize(n + 1);
		return (*this)[n];
	}
Ejemplo n.º 2
0
	void Any::verifySize(int s) const {
		beforeRead();
		verifyType(ARRAY, TABLE);
		if (size() != s) {
			verify(false, format("Size must be %d", s));
		}
	}
Ejemplo n.º 3
0
	Any& Any::operator[](int i) {
		beforeRead();
		verifyType(ARRAY);
		debugAssert(m_data != NULL);
		Array<Any>& array = *(m_data->value.a);
		return array[i];
	}
Ejemplo n.º 4
0
	void Any::verifySize(int low, int high) const {
		beforeRead();
		verifyType(ARRAY, TABLE);
		if (size() < low || size() > high) {
			verify(false, format("Size must be between %d and %d", low, high));
		}
	}
Ejemplo n.º 5
0
void RTCSessionDescription::setType(const String& type, ExceptionState& exceptionState)
{
    if (verifyType(type))
        m_webSessionDescription.setType(type);
    else
        exceptionState.throwDOMException(TypeMismatchError, constructIllegalTypeExceptionMessage(type));
}
Ejemplo n.º 6
0
	void Any::set(const std::string& k, const Any& v) {
		beforeRead();
		v.beforeRead();
		verifyType(TABLE);
		debugAssert(m_data != NULL);
		Table<std::string, Any>& table = *(m_data->value.t);
		table.set(k, v);
	}
Ejemplo n.º 7
0
	bool Any::containsKey(const std::string& x) const {
		beforeRead();
		verifyType(TABLE);

		Any* a = m_data->value.t->getPointer(x);

		// Don't return true for placeholder objects
		return (a != NULL) && (!a->isPlaceholder());
	}
void tlvReceiveFSM(TLV_FSM *fsm, TLV_Buffer *tlvBuf, uint8 *ptr)
{
    ptr[fsm->i] = uartGetByte();

    switch(fsm->state)
    {
        case WAIT_FOR_TYPE:
            if(ptr[fsm->i] == PROGRAMMING_MODE)
            {
                setProgrammingMode();
				// while(Busy1USART());		//for debugging purpose
                resetTarget = 1;
            }
            else if(ptr[fsm->i] == START_RUNNING)
            {
                setStartRunningMode();
                resetTarget = 1;
            }
            else
                fsm->state = WAIT_FOR_LENGTH;
            break;
        case WAIT_FOR_LENGTH:
            fsm->length = ptr[fsm->i];
            fsm->state = WAIT_FOR_VALUE;
            break;
        case WAIT_FOR_VALUE:
            if((fsm->i - 1) < fsm->length)
                fsm->state = WAIT_FOR_VALUE;
            else
            {
                fsm->state = WAIT_FOR_TYPE;
                if(!verifyCheckSum(ptr))
                {
                    if(!verifyType(ptr))
                        uartSendByte(ERR_WRONG_TYPE);
                    else
                        uartSendByte(ERR_WRONG_CHECKSUM);
                }
                else
                    setTLVframe(tlvBuf, ptr);
            }
            break;
        default:
            break;
    }

    if(fsm->state == WAIT_FOR_TYPE)
        fsm->i = 0;
    else
        fsm->i++;
}
Ejemplo n.º 9
0
	int Any::size() const {
		beforeRead();
		verifyType(ARRAY, TABLE);
		switch (m_type) {
		case TABLE:
			return m_data->value.t->size();

		case ARRAY:
			return m_data->value.a->size();

		default:;
			return 0;
		} // switch (m_type)
	}
Ejemplo n.º 10
0
PassRefPtr<RTCSessionDescription> RTCSessionDescription::create(const Dictionary& descriptionInitDict, ExceptionState& exceptionState)
{
    String type;
    bool ok = descriptionInitDict.get("type", type);
    if (ok && !verifyType(type)) {
        exceptionState.throwDOMException(TypeMismatchError, constructIllegalTypeExceptionMessage(type));
        return nullptr;
    }

    String sdp;
    descriptionInitDict.get("sdp", sdp);

    return adoptRef(new RTCSessionDescription(blink::WebRTCSessionDescription(type, sdp)));
}
Ejemplo n.º 11
0
	void Any::clear() {
		beforeRead();
		verifyType(ARRAY, TABLE);
		switch (m_type) {
		case ARRAY:
			m_data->value.a->clear();
			break;

		case TABLE:
			m_data->value.t->clear();
			break;

		default:;
		}
	}
Ejemplo n.º 12
0
	const Any& Any::operator[](const std::string& x) const {
		beforeRead();
		verifyType(TABLE);
		debugAssert(m_data != NULL);
		const Table<std::string, Any>& table = *(m_data->value.t);
		Any* value = table.getPointer(x);
		if (value == NULL) {
			KeyNotFound e;
			if (m_data) {
				e.filename = m_data->source.filename;
				e.line = m_data->source.line;
				e.character = m_data->source.character;
			}
			e.key = x;
			throw e;
		}
		return *value;
	}
Ejemplo n.º 13
0
	Any& Any::operator[](const std::string& key) {
		beforeRead();
		verifyType(TABLE);

		bool created = false;
		Any& value = m_data->value.t->getCreate(key, created);

		if (created) {
			// The entry was created by this method; do not allow it to be
			// read before it is written.
			value.m_placeholderName = key;

			// Write source data for the value
			value.ensureData();
			value.m_data->source = source();
		}

		return value;
	}
Ejemplo n.º 14
0
	double Any::number() const {
		beforeRead();
		verifyType(NUMBER);
		return m_simpleValue.n;
	}
Ejemplo n.º 15
0
	const Table<std::string, Any>& Any::table() const {
		beforeRead();
		verifyType(TABLE);
		debugAssert(m_data != NULL);
		return *(m_data->value.t);
	}
Ejemplo n.º 16
0
	void Any::append(const Any& x0) {
		beforeRead();
		verifyType(ARRAY);
		debugAssert(m_data != NULL);
		m_data->value.a->append(x0);
	}
Ejemplo n.º 17
0
	const Array<Any>& Any::array() const {
		beforeRead();
		verifyType(ARRAY);
		debugAssert(m_data != NULL);
		return *(m_data->value.a);
	}
Ejemplo n.º 18
0
	const std::string& Any::string() const {
		beforeRead();
		verifyType(STRING);
		return *(m_data->value.s);
	}
Ejemplo n.º 19
0
	bool Any::boolean() const {
		beforeRead();
		verifyType(BOOLEAN);
		return m_simpleValue.b;
	}
Ejemplo n.º 20
0
	void Any::resize(int n) {
		beforeRead();
		alwaysAssertM(n >= 0, "Cannot resize less than 0.");
		verifyType(ARRAY);
		m_data->value.a->resize(n);
	}