コード例 #1
0
ファイル: Name.cpp プロジェクト: mydw/mydw
xsd__Name Name::getName()
{
	#ifdef ENABLE_AXISTRACE
		if (axiscpp::AxisTrace::isTraceOn())
			axiscpp::AxisTrace::traceEntry("Name", "getName", this, 0);	  /* AUTOINSERTED TRACE */
	#endif

    if (isNil())
    {
        	{
		#ifdef ENABLE_AXISTRACE
			xsd__Name traceRet = (NULL);
			if (axiscpp::AxisTrace::isTraceOn())
				axiscpp::AxisTrace::traceExit("Name", "getName", this, 1,
					TRACETYPE_DATA, sizeof(xsd__Name), ((void*)&traceRet));	  /* AUTOINSERTED TRACE */
			return traceRet;
		#else
			return NULL;
		#endif
	}

    }
    else
    {
        	{
		#ifdef ENABLE_AXISTRACE
			xsd__Name traceRet = (deserializeName(m_Buf));
			if (axiscpp::AxisTrace::isTraceOn())
				axiscpp::AxisTrace::traceExit("Name", "getName", this, 2,
					TRACETYPE_DATA, sizeof(xsd__Name), ((void*)&traceRet));	  /* AUTOINSERTED TRACE */
			return traceRet;
		#else
			return deserializeName(m_Buf);
		#endif
	}

    }
}
コード例 #2
0
ファイル: Any.cpp プロジェクト: lev1976g/easywow
	void Any::deserialize(TextInput& ti, Token& token) {
		// Deallocate old data
		dropReference();
		m_type = NONE;
		m_simpleValue.b = false;

		// Skip leading newlines
		while (token.type() == Token::NEWLINE) {
			token = ti.read();
		}

		std::string comment;
		if (token.type() == Token::COMMENT) {
			deserializeComment(ti, token, comment);
		}

		if (token.type() == Token::END) {
			// There should never be a comment without an Any following it; even
			// if the file ends with some commented out stuff,
			// that should not happen after a comma, so we'd never read that
			// far in a proper file.
			throw ParseError(ti.filename(), token.line(), token.character(),
				"File ended without a properly formed Any");
		}

		switch (token.type()) {
		case Token::STRING:
			m_type = STRING;
			ensureData();
			*(m_data->value.s) = token.string();
			m_data->source.set(ti, token);
			break;

		case Token::NUMBER:
			m_type = NUMBER;
			m_simpleValue.n = token.number();
			ensureData();
			m_data->source.set(ti, token);
			break;

		case Token::BOOLEAN:
			m_type = BOOLEAN;
			m_simpleValue.b = token.boolean();
			ensureData();
			m_data->source.set(ti, token);
			break;

		case Token::SYMBOL:
			// Named Array, Named Table, Array, Table, or NONE
			if (toUpper(token.string()) == "NONE") {
				// Nothing left to do; we initialized to NONE originally
				ensureData();
				m_data->source.set(ti, token);
			}
			else {
				// Array or Table

				// Parse the name

				// s must have at least one element or this would not have
				// been parsed as a symbol
				std::string name;
				deserializeName(ti, token, name);
				if (token.type() != Token::SYMBOL) {
					throw ParseError(ti.filename(), token.line(), token.character(),
						"Malformed Any TABLE or ARRAY; must start with [, (, or {");
				}

				if (isOpen(token.string()[0])) {
					// Array or table
					deserializeBody(ti, token);
				}
				else {
					throw ParseError(ti.filename(), token.line(), token.character(),
						"Malformed Any TABLE or ARRAY; must start with [, (, or {");
				}

				if (!name.empty()) {
					ensureData();
					m_data->name = name;
				}
			} // if NONE
			break;

		default:
			throw ParseError(ti.filename(), token.line(), token.character(),
				"Unexpected token");
		} // switch

		if (!comment.empty()) {
			ensureData();
			m_data->comment = comment;
		}

		if (m_type != ARRAY && m_type != TABLE) {
			// Array and table already consumed their last token
			token = ti.read();
		}
	}
コード例 #3
0
v8::Local<v8::Object> TaggedBinaryReader::read(std::istream& istream)
{
	Poco::RemotingNG::BinaryDeserializer deserializer;
	deserializer.setup(istream);

	std::vector<std::string> names;
	
	std::string messageName;
	Poco::RemotingNG::SerializerBase::MessageType messageType = deserializer.findMessage(messageName);
	deserializer.deserializeMessageBegin(messageName, messageType);
	_serializer.serializeMessageBegin(messageName, messageType);
	names.push_back(messageName);
	_containerStack.push_back(TaggedBinarySerializer::CONT_MESSAGE);

	std::string name;
	std::string unused;
	Poco::UInt8 tag = deserializeTypeTag(deserializer);
	while (istream.good() && tag != TaggedBinarySerializer::TYPE_TAG_MESSAGE_END)
	{
		switch (tag)
		{
		case TaggedBinarySerializer::TYPE_TAG_STRUCT_BEGIN:
			{
				name = deserializeName(deserializer);
				names.push_back(name);
				check(deserializer.deserializeStructBegin(name, true));
				_serializer.serializeStructBegin(name);
				_containerStack.push_back(TaggedBinarySerializer::CONT_STRUCT);
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_STRUCT_END:
			{
				_containerStack.pop_back();
				deserializer.deserializeStructEnd(names.back());
				_serializer.serializeStructEnd(names.back());
				names.pop_back();
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_SEQUENCE_BEGIN:
			{
				name = deserializeName(deserializer);
				names.push_back(name);
				Poco::UInt32 lengthHint;
				check(deserializer.deserializeSequenceBegin(name, true, lengthHint));
				_serializer.serializeSequenceBegin(name, lengthHint);
				_containerStack.push_back(TaggedBinarySerializer::CONT_SEQUENCE);
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_SEQUENCE_END:
			{
				_containerStack.pop_back();
				deserializer.deserializeSequenceEnd(names.back());
				_serializer.serializeSequenceEnd(names.back());
				names.pop_back();
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_NULLABLE_BEGIN:
			{
				name = deserializeName(deserializer);
				names.push_back(name);
				bool isNull;
				check(deserializer.deserializeNullableBegin(name, true, isNull));
				_serializer.serializeNullableBegin(name, isNull);
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_NULLABLE_END:
			{
				deserializer.deserializeNullableEnd(names.back());
				_serializer.serializeNullableEnd(names.back());
				names.pop_back();
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_OPTIONAL_BEGIN:
			{
				name = deserializeName(deserializer);
				names.push_back(name);
				bool isSpecified;
				check(deserializer.deserializeOptionalBegin(name, true, isSpecified));
				_serializer.serializeOptionalBegin(name, isSpecified);
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_OPTIONAL_END:
			{
				deserializer.deserializeOptionalEnd(names.back());
				_serializer.serializeOptionalEnd(names.back());
				names.pop_back();
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_INT8:
			{
				read<Poco::Int8>(deserializer);
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_UINT8:
			{
				read<Poco::UInt8>(deserializer);
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_INT16:
			{
				read<Poco::Int16>(deserializer);
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_UINT16:
			{
				read<Poco::UInt16>(deserializer);
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_INT32:
			{
				read<Poco::Int32>(deserializer);
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_UINT32:
			{
				read<Poco::UInt32>(deserializer);
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_LONG:
			{
				read<long>(deserializer);
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_ULONG:
			{
				read<unsigned long>(deserializer);
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_INT64:
			{
				read<Poco::Int64>(deserializer);
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_UINT64:
			{
				read<Poco::UInt64>(deserializer);
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_FLOAT:
			{
				read<float>(deserializer);
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_DOUBLE:
			{
				read<double>(deserializer);
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_BOOL:
			{
				read<bool>(deserializer);
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_CHAR:
			{
				read<char>(deserializer);
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_STRING:
			{
				read<std::string>(deserializer);
			}
			break;
		case TaggedBinarySerializer::TYPE_TAG_BUFFER:
			{
				read<std::vector<char> >(deserializer);
			}
			break;
		default:
			throw Poco::RemotingNG::DeserializerException("Invalid type tag encountered during deserialization of", names.back());
		}
		tag = deserializeTypeTag(deserializer);
	}
	if (istream.good())
	{
		_serializer.serializeMessageEnd(messageName, messageType);
		_containerStack.pop_back();
		poco_assert (_containerStack.empty());
		return _serializer.jsValue();
	}
	else throw Poco::RemotingNG::DeserializerException("Unexpected end of stream");
}