Example #1
0
		const std::string oclTypeToString(const core::lang::BasicGenerator& basic, const core::TypePtr& type){
			if (type->getNodeType() == core::NT_VectorType){
				core::VectorTypePtr vecType = static_pointer_cast<const core::VectorType>(type);
				auto elType = vecType->getElementType();
				std::string strType = oclTypeToString(basic, elType);
				if(!strType.empty()){
					int size = core::static_pointer_cast<const core::ConcreteIntTypeParam>(vecType->getSize())->getValue();
					switch (size) {
						case 2: return strType + "2";
						case 3: return strType + "3";
						case 4: return strType + "4";
						case 8: return strType + "8";
						case 16:return strType + "16";
						default: return "";
					}
				}
				return "";
			}

			if (basic.isBool(type))		return "bool";
			if (basic.isChar(type))		return "char";
			if (basic.isUInt1(type))	return "uchar";
			if (basic.isInt2(type))		return "short";
			if (basic.isUInt2(type))	return "ushort";
			if (basic.isInt4(type))		return "int";
			if (basic.isUInt4(type))	return "uint";
			if (basic.isInt8(type))		return "long";
			if (basic.isUInt8(type))	return "ulong";
			if (basic.isFloat(type))	return "float";
			if (basic.isDouble(type))	return "double";
			return "";
		}
Example #2
0
	bool isListType(const core::TypePtr& type) {
		if (type->getNodeType() != NT_GenericType) {
			return false;
		}

		// check generic type properties
		core::GenericTypePtr genType = static_pointer_cast<const GenericType>(type);
		return genType->getName()->getValue() == ListExtension::LIST_TYPE_NAME &&
				genType->getTypeParameter().size() == static_cast<std::size_t>(1) &&
				genType->getIntTypeParameter().empty();
	}
Example #3
0
		const std::string oclRefTypeToString(const core::lang::BasicGenerator& basic, const core::TypePtr& type){
			if (type->getNodeType() == core::NT_RefType)
				return oclTypeToString(basic, static_pointer_cast<const core::RefType>(type)->getElementType());
			return oclTypeToString(basic, type);
		}