Exemplo n.º 1
0
	void Any::beforeRead() const {
		if (isPlaceholder()) {
			// Tried to read from a placeholder--throw an exception as if
			// the original operator[] had failed.
			KeyNotFound e;
			alwaysAssertM(m_data, "Corrupt placeholder");

			e.filename = m_data->source.filename;
			e.line = m_data->source.line;
			e.character = m_data->source.character;
			e.key = m_placeholderName;
			e.message =
				"This exception may have been thrown later than "
				"the actual operator[] invocation.";

			throw e;
		}
	}
Exemplo n.º 2
0
std::string PlaceHolders::getInternal(std::string&& placeHolder) const  {
	auto receivedElem =  pathReceived.begin() ;
	auto pathElemen = restPath.begin() ;

	std::cout << "placeHolder = " << placeHolder << std::endl;

	while (pathElemen != restPath.end()) {
		if (pathElemen->isPlaceholder()) {
			if (pathElemen->getValue() == placeHolder){
				return *receivedElem;
			}
		}
		receivedElem++;
		pathElemen++;

	}
	throw PlaceholderNotFound {};
}
Exemplo n.º 3
0
bool RestPath::operator ==(const PathReceived& pathReceived) const noexcept {
	if (pathReceived.getSize() == elements.size()) {
		auto receivedElem = pathReceived.begin();
		auto pathElemen = elements.begin();
		while (pathElemen != elements.end()) {
			if (!pathElemen->isPlaceholder()) {
				if (pathElemen->getValue() != *receivedElem) {
					return false;
				}
			}
			receivedElem++;
			pathElemen++;

		}
		return true;
	} else {
		return false;
	}
}
Exemplo n.º 4
0
	void Any::beforeWrite() {
		if (isPlaceholder()) {
			// This is no longer a placeholder
			m_placeholderName = "";
		}
	}