2011-10-21 22:07:18 -04:00
|
|
|
/* ====================================================================
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
==================================================================== */
|
2011-10-21 19:45:01 -04:00
|
|
|
package org.apache.poi.hpsf;
|
|
|
|
|
|
|
|
import org.apache.poi.util.Internal;
|
2011-10-21 22:01:14 -04:00
|
|
|
import org.apache.poi.util.LittleEndian;
|
|
|
|
import org.apache.poi.util.POILogFactory;
|
|
|
|
import org.apache.poi.util.POILogger;
|
2011-10-21 19:45:01 -04:00
|
|
|
|
|
|
|
@Internal
|
2016-06-11 20:12:22 -04:00
|
|
|
class VariantBool {
|
|
|
|
private final static POILogger logger = POILogFactory.getLogger( VariantBool.class );
|
2011-10-21 22:07:18 -04:00
|
|
|
|
2011-10-21 19:45:01 -04:00
|
|
|
static final int SIZE = 2;
|
|
|
|
|
|
|
|
private boolean _value;
|
|
|
|
|
2016-06-11 20:12:22 -04:00
|
|
|
VariantBool( byte[] data, int offset ) {
|
2011-10-21 19:45:01 -04:00
|
|
|
short value = LittleEndian.getShort( data, offset );
|
2016-06-11 20:12:22 -04:00
|
|
|
switch (value) {
|
|
|
|
case 0:
|
|
|
|
_value = false;
|
|
|
|
break;
|
|
|
|
case -1:
|
|
|
|
_value = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
logger.log( POILogger.WARN, "VARIANT_BOOL value '"+value+"' is incorrect" );
|
|
|
|
_value = true;
|
|
|
|
break;
|
2011-10-21 19:45:01 -04:00
|
|
|
}
|
2011-10-21 22:01:14 -04:00
|
|
|
}
|
|
|
|
|
2016-06-11 20:12:22 -04:00
|
|
|
boolean getValue() {
|
2011-10-21 22:01:14 -04:00
|
|
|
return _value;
|
|
|
|
}
|
|
|
|
|
2016-06-11 20:12:22 -04:00
|
|
|
void setValue( boolean value ) {
|
2011-10-21 22:01:14 -04:00
|
|
|
this._value = value;
|
2011-10-21 19:45:01 -04:00
|
|
|
}
|
|
|
|
}
|