Any& Any::next() { beforeRead(); verifyType(ARRAY); int n = size(); resize(n + 1); return (*this)[n]; }
void Any::verifySize(int s) const { beforeRead(); verifyType(ARRAY, TABLE); if (size() != s) { verify(false, format("Size must be %d", s)); } }
Any& Any::operator[](int i) { beforeRead(); verifyType(ARRAY); debugAssert(m_data != NULL); Array<Any>& array = *(m_data->value.a); return array[i]; }
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)); } }
void RTCSessionDescription::setType(const String& type, ExceptionState& exceptionState) { if (verifyType(type)) m_webSessionDescription.setType(type); else exceptionState.throwDOMException(TypeMismatchError, constructIllegalTypeExceptionMessage(type)); }
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); }
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++; }
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) }
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))); }
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:; } }
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; }
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; }
double Any::number() const { beforeRead(); verifyType(NUMBER); return m_simpleValue.n; }
const Table<std::string, Any>& Any::table() const { beforeRead(); verifyType(TABLE); debugAssert(m_data != NULL); return *(m_data->value.t); }
void Any::append(const Any& x0) { beforeRead(); verifyType(ARRAY); debugAssert(m_data != NULL); m_data->value.a->append(x0); }
const Array<Any>& Any::array() const { beforeRead(); verifyType(ARRAY); debugAssert(m_data != NULL); return *(m_data->value.a); }
const std::string& Any::string() const { beforeRead(); verifyType(STRING); return *(m_data->value.s); }
bool Any::boolean() const { beforeRead(); verifyType(BOOLEAN); return m_simpleValue.b; }
void Any::resize(int n) { beforeRead(); alwaysAssertM(n >= 0, "Cannot resize less than 0."); verifyType(ARRAY); m_data->value.a->resize(n); }