libs-base/Headers/Foundation/NSUnit.h

422 lines
9.8 KiB
C
Raw Normal View History

2019-09-30 19:59:50 +00:00
/* Definition of class NSUnit
Copyright (C) 2019 Free Software Foundation, Inc.
By: heron
Date: Mon Sep 30 15:58:21 EDT 2019
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#ifndef _NSUnit_h_GNUSTEP_BASE_INCLUDE
#define _NSUnit_h_GNUSTEP_BASE_INCLUDE
#include <Foundation/NSObject.h>
#if defined(__cplusplus)
extern "C" {
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_12, GS_API_LATEST)
2019-09-30 19:59:50 +00:00
2019-10-02 09:08:37 +00:00
// Unit converter
@interface NSUnitConverter : NSObject
- (double)baseUnitValueFromValue:(double)value;
- (double)valueFromBaseUnitValue:(double)baseUnitValue;
@end
2019-10-02 09:08:37 +00:00
// Linea converter... for things like C <-> F conversion...
2019-10-02 06:05:18 +00:00
@interface NSUnitConverterLinear : NSUnitConverter <NSCoding>
{
double _coefficient;
double _constant;
}
- (instancetype) initWithCoefficient: (double)coefficient;
- (instancetype) initWithCoefficient: (double)coefficient
constant: (double)constant;
- (double) coefficient;
- (double) constant;
@end
2019-10-02 09:08:37 +00:00
// Units... abstract...
@interface NSUnit : NSObject <NSCopying, NSCoding>
{
NSString *_symbol;
}
+ (instancetype)new;
- (instancetype)init;
2019-10-02 11:09:32 +00:00
- (instancetype)initWithSymbol:(NSString *) symbol;
- (NSString *) symbol;
2019-09-30 19:59:50 +00:00
@end
2019-10-02 09:08:37 +00:00
// Dimension using units....
@interface NSDimension : NSUnit <NSCoding>
{
NSUInteger _reserved;
NSUnitConverter *_converter;
}
- (NSUnitConverter *) converter;
2019-10-02 11:09:32 +00:00
- (instancetype) initWithSymbol: (NSString *) symbol converter: (NSUnitConverter *) converter ;
2019-10-02 09:08:37 +00:00
+ (instancetype) baseUnit;
@end
2019-10-02 09:47:03 +00:00
// Predefined....
@interface NSUnitAcceleration : NSDimension <NSSecureCoding>
/*
Base unit - metersPerSecondSquared
*/
2019-10-02 11:09:32 +00:00
- (NSUnitAcceleration *) metersPerSecondSquared;
- (NSUnitAcceleration *) gravity;
2019-10-02 09:47:03 +00:00
@end
@interface NSUnitAngle : NSDimension <NSSecureCoding>
/*
Base unit - degrees
*/
2019-10-02 11:09:32 +00:00
- (NSUnitAngle *) degrees;
- (NSUnitAngle *) arcMinutes;
- (NSUnitAngle *) arcSeconds;
- (NSUnitAngle *) radians;
- (NSUnitAngle *) gradians;
- (NSUnitAngle *) revolutions;
2019-10-02 09:47:03 +00:00
@end
@interface NSUnitArea : NSDimension <NSSecureCoding>
/*
Base unit - squareMeters
*/
2019-10-02 11:09:32 +00:00
- (NSUnitArea *) squareMegameters;
- (NSUnitArea *) squareKilometers;
- (NSUnitArea *) squareMeters;
- (NSUnitArea *) squareCentimeters;
- (NSUnitArea *) squareMillimeters;
- (NSUnitArea *) squareMicrometers;
- (NSUnitArea *) squareNanometers;
- (NSUnitArea *) squareInches;
- (NSUnitArea *) squareFeet;
- (NSUnitArea *) squareYards;
- (NSUnitArea *) squareMiles;
- (NSUnitArea *) acres;
- (NSUnitArea *) ares;
- (NSUnitArea *) hectares;
2019-10-02 09:47:03 +00:00
@end
@interface NSUnitConcentrationMass : NSDimension <NSSecureCoding>
/*
Base unit - gramsPerLiter
*/
2019-10-02 11:09:32 +00:00
- (NSUnitConcentrationMass *) gramsPerLiter;
- (NSUnitConcentrationMass *) milligramsPerDeciliter;
2019-10-02 09:47:03 +00:00
2019-10-02 11:09:32 +00:00
+ (NSUnitConcentrationMass *) millimolesPerLiterWithGramsPerMole:(double)gramsPerMole;
2019-10-02 09:47:03 +00:00
@end
@interface NSUnitDispersion : NSDimension <NSSecureCoding>
/*
Base unit - partsPerMillion
*/
2019-10-02 11:09:32 +00:00
- (NSUnitDispersion *) partsPerMillion;
2019-10-02 09:47:03 +00:00
@end
@interface NSUnitDuration : NSDimension <NSSecureCoding>
/*
Base unit - seconds
*/
2019-10-02 11:09:32 +00:00
- (NSUnitDuration *) seconds;
- (NSUnitDuration *) minutes;
- (NSUnitDuration *) hours;
2019-10-02 09:47:03 +00:00
@end
@interface NSUnitElectricCharge : NSDimension <NSSecureCoding>
/*
Base unit - coulombs
*/
2019-10-02 11:09:32 +00:00
- (NSUnitElectricCharge *) coulombs;
- (NSUnitElectricCharge *) megaampereHours;
- (NSUnitElectricCharge *) kiloampereHours;
- (NSUnitElectricCharge *) ampereHours;
- (NSUnitElectricCharge *) milliampereHours;
- (NSUnitElectricCharge *) microampereHours;
2019-10-02 09:47:03 +00:00
@end
@interface NSUnitElectricCurrent : NSDimension <NSSecureCoding>
/*
Base unit - amperes
*/
2019-10-02 11:09:32 +00:00
- (NSUnitElectricCurrent *) megaamperes;
- (NSUnitElectricCurrent *) kiloamperes;
- (NSUnitElectricCurrent *) amperes;
- (NSUnitElectricCurrent *) milliamperes;
- (NSUnitElectricCurrent *) microamperes;
2019-10-02 09:47:03 +00:00
@end
@interface NSUnitElectricPotentialDifference : NSDimension <NSSecureCoding>
/*
Base unit - volts
*/
2019-10-02 11:09:32 +00:00
- (NSUnitElectricPotentialDifference *) megavolts;
- (NSUnitElectricPotentialDifference *) kilovolts;
- (NSUnitElectricPotentialDifference *) volts;
- (NSUnitElectricPotentialDifference *) millivolts;
- (NSUnitElectricPotentialDifference *) microvolts;
2019-10-02 09:47:03 +00:00
@end
@interface NSUnitElectricResistance : NSDimension <NSSecureCoding>
/*
Base unit - ohms
*/
2019-10-02 11:09:32 +00:00
- (NSUnitElectricResistance *) megaohms;
- (NSUnitElectricResistance *) kiloohms;
- (NSUnitElectricResistance *) ohms;
- (NSUnitElectricResistance *) milliohms;
- (NSUnitElectricResistance *) microohms;
2019-10-02 09:47:03 +00:00
@end
@interface NSUnitEnergy : NSDimension <NSSecureCoding>
/*
Base unit - joules
*/
2019-10-02 11:09:32 +00:00
- (NSUnitEnergy *) kilojoules;
- (NSUnitEnergy *) joules;
- (NSUnitEnergy *) kilocalories;
- (NSUnitEnergy *) calories;
- (NSUnitEnergy *) kilowattHours;
2019-10-02 09:47:03 +00:00
@end
@interface NSUnitFrequency : NSDimension <NSSecureCoding>
/*
Base unit - hertz
*/
2019-10-02 11:09:32 +00:00
- (NSUnitFrequency *) terahertz;
- (NSUnitFrequency *) gigahertz;
- (NSUnitFrequency *) megahertz;
- (NSUnitFrequency *) kilohertz;
- (NSUnitFrequency *) hertz;
- (NSUnitFrequency *) millihertz;
- (NSUnitFrequency *) microhertz;
- (NSUnitFrequency *) nanohertz;
2019-10-02 09:47:03 +00:00
@end
@interface NSUnitFuelEfficiency : NSDimension <NSSecureCoding>
/*
Base unit - litersPer100Kilometers
*/
2019-10-02 11:09:32 +00:00
- (NSUnitFuelEfficiency *) litersPer100Kilometers;
- (NSUnitFuelEfficiency *) milesPerImperialGallon;
- (NSUnitFuelEfficiency *) milesPerGallon;
2019-10-02 09:47:03 +00:00
@end
@interface NSUnitLength : NSDimension <NSSecureCoding>
/*
Base unit - meters
*/
2019-10-02 11:09:32 +00:00
- (NSUnitLength *) megameters;
- (NSUnitLength *) kilometers;
- (NSUnitLength *) hectometers;
- (NSUnitLength *) decameters;
- (NSUnitLength *) meters;
- (NSUnitLength *) decimeters;
- (NSUnitLength *) centimeters;
- (NSUnitLength *) millimeters;
- (NSUnitLength *) micrometers;
- (NSUnitLength *) nanometers;
- (NSUnitLength *) picometers;
- (NSUnitLength *) inches;
- (NSUnitLength *) feet;
- (NSUnitLength *) yards;
- (NSUnitLength *) miles;
- (NSUnitLength *) scandinavianMiles;
- (NSUnitLength *) lightyears;
- (NSUnitLength *) nauticalMiles;
- (NSUnitLength *) fathoms;
- (NSUnitLength *) furlongs;
- (NSUnitLength *) astronomicalUnits;
- (NSUnitLength *) parsecs;
2019-10-02 09:47:03 +00:00
@end
@interface NSUnitIlluminance : NSDimension <NSSecureCoding>
/*
Base unit - lux
*/
2019-10-02 11:09:32 +00:00
- (NSUnitIlluminance *) lux;
2019-10-02 09:47:03 +00:00
@end
@interface NSUnitMass : NSDimension <NSSecureCoding>
/*
Base unit - kilograms
*/
2019-10-02 11:09:32 +00:00
- (NSUnitMass *) kilograms;
- (NSUnitMass *) grams;
- (NSUnitMass *) decigrams;
- (NSUnitMass *) centigrams;
- (NSUnitMass *) milligrams;
- (NSUnitMass *) micrograms;
- (NSUnitMass *) nanograms;
- (NSUnitMass *) picograms;
- (NSUnitMass *) ounces;
- (NSUnitMass *) poundsMass;
- (NSUnitMass *) stones;
- (NSUnitMass *) metricTons;
- (NSUnitMass *) shortTons;
- (NSUnitMass *) carats;
- (NSUnitMass *) ouncesTroy;
- (NSUnitMass *) slugs;
2019-10-02 09:47:03 +00:00
@end
@interface NSUnitPower : NSDimension <NSSecureCoding>
/*
Base unit - watts
*/
2019-10-02 11:09:32 +00:00
- (NSUnitPower *) terawatts;
- (NSUnitPower *) gigawatts;
- (NSUnitPower *) megawatts;
- (NSUnitPower *) kilowatts;
- (NSUnitPower *) watts;
- (NSUnitPower *) milliwatts;
- (NSUnitPower *) microwatts;
- (NSUnitPower *) nanowatts;
- (NSUnitPower *) picowatts;
- (NSUnitPower *) femtowatts;
- (NSUnitPower *) horsepower;
2019-10-02 09:47:03 +00:00
@end
@interface NSUnitPressure : NSDimension <NSSecureCoding>
/*
Base unit - newtonsPerMetersSquared (equivalent to 1 pascal)
*/
2019-10-02 11:09:32 +00:00
- (NSUnitPressure *) newtonsPerMetersSquared;
- (NSUnitPressure *) gigapascals;
- (NSUnitPressure *) megapascals;
- (NSUnitPressure *) kilopascals;
- (NSUnitPressure *) hectopascals;
- (NSUnitPressure *) inchesOfMercury;
- (NSUnitPressure *) bars;
- (NSUnitPressure *) millibars;
- (NSUnitPressure *) millimetersOfMercury;
- (NSUnitPressure *) poundsForcePerSquareInch;
2019-10-02 09:47:03 +00:00
@end
@interface NSUnitSpeed : NSDimension <NSSecureCoding>
/*
Base unit - metersPerSecond
*/
2019-10-02 11:09:32 +00:00
- (NSUnitSpeed *) metersPerSecond;
- (NSUnitSpeed *) kilometersPerHour;
- (NSUnitSpeed *) milesPerHour;
- (NSUnitSpeed *) knots;
2019-10-02 09:47:03 +00:00
@end
@interface NSUnitTemperature : NSDimension <NSSecureCoding>
/*
Base unit - kelvin
*/
2019-10-02 11:09:32 +00:00
- (NSUnitTemperature *) kelvin;
- (NSUnitTemperature *) celsius;
- (NSUnitTemperature *) fahrenheit;
2019-10-02 09:47:03 +00:00
@end
@interface NSUnitVolume : NSDimension <NSSecureCoding>
/*
Base unit - liters
*/
2019-10-02 11:09:32 +00:00
- (NSUnitVolume *) megaliters;
- (NSUnitVolume *) kiloliters;
- (NSUnitVolume *) liters;
- (NSUnitVolume *) deciliters;
- (NSUnitVolume *) centiliters;
- (NSUnitVolume *) milliliters;
- (NSUnitVolume *) cubicKilometers;
- (NSUnitVolume *) cubicMeters;
- (NSUnitVolume *) cubicDecimeters;
- (NSUnitVolume *) cubicCentimeters;
- (NSUnitVolume *) cubicMillimeters;
- (NSUnitVolume *) cubicInches;
- (NSUnitVolume *) cubicFeet;
- (NSUnitVolume *) cubicYards;
- (NSUnitVolume *) cubicMiles;
- (NSUnitVolume *) acreFeet;
- (NSUnitVolume *) bushels;
- (NSUnitVolume *) teaspoons;
- (NSUnitVolume *) tablespoons;
- (NSUnitVolume *) fluidOunces;
- (NSUnitVolume *) cups;
- (NSUnitVolume *) pints;
- (NSUnitVolume *) quarts;
- (NSUnitVolume *) gallons;
- (NSUnitVolume *) imperialTeaspoons;
- (NSUnitVolume *) imperialTablespoons;
- (NSUnitVolume *) imperialFluidOunces;
- (NSUnitVolume *) imperialPints;
- (NSUnitVolume *) imperialQuarts;
- (NSUnitVolume *) imperialGallons;
- (NSUnitVolume *) metricCups;
2019-10-02 09:47:03 +00:00
@end
2019-09-30 19:59:50 +00:00
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */
#endif /* _NSUnit_h_GNUSTEP_BASE_INCLUDE */