示例#1
0
文件: protobuf.hpp 项目: edwardt/loom
inline bool operator== (
        const google::protobuf::RepeatedField<T> & x,
        const google::protobuf::RepeatedField<T> & y)
{
    if (LOOM_UNLIKELY(x.size() != y.size())) {
        return false;
    }
    for (size_t i = 0, size = x.size(); i < size; ++i) {
        if (LOOM_UNLIKELY(x.Get(i) != y.Get(i))) {
            return false;
        }
    }
    return true;
}
示例#2
0
	// Get an OSM tag for a given key (or return empty string if none)
	// Called from Lua
	string Find(const string& key) const {
		// First, convert the string into a number
		if (tagMap.find(key) == tagMap.end()) { return ""; }
		uint keyNum = tagMap.at(key);
		if (isWay) {
			// Then see if this number is in the way tags, and return its value if so
			for (uint n=0; n < tagLength; n++) {
				if (keysPtr->Get(n)==keyNum) { return stringTable[valsPtr->Get(n)]; }
			}
		} else {
			for (uint n=denseStart; n<denseEnd; n+=2) {
				if (densePtr->keys_vals(n)==keyNum) { return stringTable[densePtr->keys_vals(n+1)]; }
			}
		}
		return "";
	}
示例#3
0
	// Check if there's a value for a given key
	// Called from Lua
	bool Holds(const string& key) const {
		if (tagMap.find(key) == tagMap.end()) { return false; }
		uint keyNum = tagMap.at(key);
		if (isWay) {
			for (uint n=0; n > tagLength; n++) {
				if (keysPtr->Get(n)==keyNum) { return true; }
			}
		} else {
			for (uint n=denseStart; n<denseEnd; n+=2) {
				if (densePtr->keys_vals(n)==keyNum) { return true; }
			}
		}
		return false;
	}