/* */ package quicktime.std.qtcomponents;
/* */
/* */ import quicktime.QTException;
/* */ import quicktime.QTObject;
/* */ import quicktime.QTSession;
/* */ import quicktime.qd.QDColor;
/* */ import quicktime.std.StdQTException;
/* */ import quicktime.util.QTUtils;
/* */ import quicktime.util.UtilException;
/* */
/* */ public final class XMLAttribute extends QTObject
/* */ {
/* 41 */ private static boolean apriori = QTSession.apriori();
/* */
/* 45 */ private static Object owner = new Object();
/* */ private static final boolean debug = false;
/* */ private static final int kXMLAttributeSize = 22;
/* */ private static final int kIdentifierOffset = 0;
/* */ private static final int kNameOffset = 4;
/* */ private static final int kValueKindOffset = 8;
/* */ private static final int kValueOffset = 12;
/* */ private static final int kValueStrOffset = 18;
/* */
/* */ XMLAttribute(int paramInt)
/* */ throws QTException
/* */ {
/* 64 */ super(paramInt, new Object());
/* */ }
/* */
/* */ XMLAttribute(int paramInt1, int paramInt2)
/* */ throws QTException
/* */ {
/* 72 */ super(paramInt1 + 22 * paramInt2, owner);
/* */ }
/* */
/* */ public boolean identifierUnrecognized()
/* */ {
/* 83 */ int i = getIntFromPointer(_ID(), 0);
/* 84 */ return i == -1;
/* */ }
/* */
/* */ public int getIdentifier()
/* */ throws StdQTException
/* */ {
/* 92 */ int i = getIntFromPointer(_ID(), 0);
/* 93 */ if (i != -1) {
/* 94 */ return i;
/* */ }
/* 96 */ throw new StdQTException(-50);
/* */ }
/* */
/* */ int getNthIdentifier(int paramInt)
/* */ {
/* 104 */ int i = getIntFromPointer(_ID(), 22 * paramInt);
/* 105 */ return i;
/* */ }
/* */
/* */ public String getName()
/* */ throws StdQTException, UtilException
/* */ {
/* 114 */ int i = getIntFromPointer(_ID(), 0);
/* 115 */ if (i == -1) {
/* 116 */ int j = getIntFromPointer(_ID(), 4);
/* 117 */ return getStringFromPointer(j);
/* */ }
/* */
/* 120 */ throw new StdQTException(-50);
/* */ }
/* */
/* */ public int getValueKind()
/* */ throws StdQTException
/* */ {
/* 128 */ int i = getIdentifier();
/* 129 */ int j = getIntFromPointer(_ID(), 8);
/* 130 */ return j;
/* */ }
/* */
/* */ public String getValueString()
/* */ throws StdQTException, UtilException
/* */ {
/* 138 */ int i = getIntFromPointer(_ID(), 18);
/* 139 */ return getStringFromPointer(i);
/* */ }
/* */
/* */ public String getCharString()
/* */ throws StdQTException
/* */ {
/* 147 */ int i = getValueKind();
/* 148 */ if (i == 0) {
/* 149 */ int j = getIntFromPointer(_ID(), 12);
/* 150 */ return getStringFromPointer(j);
/* */ }
/* 152 */ throw new StdQTException("XMLAttribute.getCharString() : kind not attributeValueKindCharString");
/* */ }
/* */
/* */ public int getInteger()
/* */ throws StdQTException
/* */ {
/* 160 */ int i = getValueKind();
/* 161 */ if (i == 1) {
/* 162 */ return getIntFromPointer(_ID(), 12);
/* */ }
/* 164 */ throw new StdQTException("XMLAttribute.getInteger() : kind not attributeValueKindInteger");
/* */ }
/* */
/* */ public int getPercent()
/* */ throws StdQTException
/* */ {
/* 173 */ int i = getValueKind();
/* 174 */ if (i == 2) {
/* 175 */ return getIntFromPointer(_ID(), 12);
/* */ }
/* 177 */ throw new StdQTException("XMLAttribute.getPercent() : kind not attributeValueKindPercent");
/* */ }
/* */
/* */ public boolean getBoolean()
/* */ throws StdQTException
/* */ {
/* 185 */ int i = getValueKind();
/* 186 */ if (i == 4) {
/* 187 */ return getIntFromPointer(_ID(), 12) != 0;
/* */ }
/* 189 */ throw new StdQTException("XMLAttribute.getBoolean() : kind not attributeValueKindBoolean");
/* */ }
/* */
/* */ public boolean getOnOff()
/* */ throws StdQTException
/* */ {
/* 197 */ int i = getValueKind();
/* 198 */ if (i == 8) {
/* 199 */ return getIntFromPointer(_ID(), 12) != 0;
/* */ }
/* 201 */ throw new StdQTException("XMLAttribute.getOnOff() : kind not attributeValueKindOnOff");
/* */ }
/* */
/* */ public QDColor getRGBColor()
/* */ throws StdQTException
/* */ {
/* 209 */ int i = getValueKind();
/* 210 */ if (i == 16) {
/* 211 */ byte[] arrayOfByte = new byte[12];
/* 212 */ for (int j = 0; j < 12; j++) {
/* 213 */ arrayOfByte[j] = getByteFromPointer(_ID(), 12 + j);
/* */ }
/* 215 */ return QDColor.fromArray(arrayOfByte, 6);
/* */ }
/* */
/* 218 */ throw new StdQTException(-50);
/* */ }
/* */
/* */ public int getEnum()
/* */ throws StdQTException
/* */ {
/* 226 */ int i = getValueKind();
/* 227 */ switch (i) {
/* */ case 32:
/* */ case 64:
/* 230 */ return getIntFromPointer(_ID(), 12);
/* */ }
/* */
/* 233 */ throw new StdQTException(-50);
/* */ }
/* */
/* */ private String getStringFromPointer(int paramInt)
/* */ {
/* 240 */ if (paramInt != 0) {
/* 241 */ int i = 0;
/* 242 */ int j = 0;
/* 243 */ while (getByteFromPointer(paramInt, j++) != 0)
/* 244 */ i++;
/* 245 */ byte[] arrayOfByte = new byte[i];
/* 246 */ copyPointerToArray(paramInt, 0, arrayOfByte, 0, i);
/* 247 */ return QTUtils.CString2String(arrayOfByte, 0);
/* */ }
/* 249 */ return "";
/* */ }
/* */
/* */ private static native byte getByteFromPointer(int paramInt1, int paramInt2);
/* */
/* */ private static native short getShortFromPointer(int paramInt1, int paramInt2);
/* */
/* */ private static native int getIntFromPointer(int paramInt1, int paramInt2);
/* */
/* */ private static native void copyPointerToArray(int paramInt1, int paramInt2, byte[] paramArrayOfByte, int paramInt3, int paramInt4);
/* */ }
/* Location: Z:\System\Library\Java\Extensions\QTJava.zip
* Qualified Name: quicktime.std.qtcomponents.XMLAttribute
* JD-Core Version: 0.6.2
*/