1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package com.sun.star.lib.uno.typedesc; 25 26 import com.sun.star.uno.ITypeDescription; 27 import com.sun.star.uno.TypeClass; 28 29 final class MemberDescriptionHelper { isUnsigned(ITypeDescription desc)30 public static boolean isUnsigned(ITypeDescription desc) { 31 switch (getElementTypeClass(desc).getValue()) { 32 case TypeClass.UNSIGNED_SHORT_value: 33 case TypeClass.UNSIGNED_LONG_value: 34 case TypeClass.UNSIGNED_HYPER_value: 35 return true; 36 37 default: 38 return false; 39 } 40 } 41 isAny(ITypeDescription desc)42 public static boolean isAny(ITypeDescription desc) { 43 return getElementTypeClass(desc) == TypeClass.ANY; 44 } 45 isInterface(ITypeDescription desc)46 public static boolean isInterface(ITypeDescription desc) { 47 return getElementTypeClass(desc) == TypeClass.INTERFACE; 48 } 49 getElementTypeClass(ITypeDescription desc)50 private static TypeClass getElementTypeClass(ITypeDescription desc) { 51 for (;; desc = desc.getComponentType()) { 52 TypeClass tc = desc.getTypeClass(); 53 if (tc != TypeClass.SEQUENCE) { 54 return tc; 55 } 56 } 57 } 58 MemberDescriptionHelper()59 private MemberDescriptionHelper() {} // do not instantiate 60 } 61