util namespace

namespace util

A set of base types from ISO 19103, GeoAPI and other PROJ specific classes.

osgeo.proj.util namespace.

Typedefs

using BaseObjectPtr = std::shared_ptr<BaseObject>

Shared pointer of BaseObject.

using BoxedValuePtr = std::shared_ptr<BoxedValue>

Shared pointer of BoxedValue.

using BoxedValueNNPtr = util::nn<BoxedValuePtr>

Non-null shared pointer of BoxedValue.

using ArrayOfBaseObjectPtr = std::shared_ptr<ArrayOfBaseObject>

Shared pointer of ArrayOfBaseObject.

using ArrayOfBaseObjectNNPtr = util::nn<ArrayOfBaseObjectPtr>

Non-null shared pointer of ArrayOfBaseObject.

using LocalNamePtr = std::shared_ptr<LocalName>

Shared pointer of LocalName.

using LocalNameNNPtr = util::nn<LocalNamePtr>

Non-null shared pointer of LocalName.

using NameSpacePtr = std::shared_ptr<NameSpace>

Shared pointer of NameSpace.

using NameSpaceNNPtr = util::nn<NameSpacePtr>

Non-null shared pointer of NameSpace.

using GenericNamePtr = std::shared_ptr<GenericName>

Shared pointer of GenericName.

using GenericNameNNPtr = util::nn<GenericNamePtr>

Non-null shared pointer of GenericName.

template<class T>
class optional
#include <util.hpp>

Loose transposition of std::optional available from C++17.

Public Functions

inline const T *operator->() const

Returns a pointer to the contained value.

inline const T &operator*() const

Returns a reference to the contained value.

inline explicit operator bool() const noexcept

Return whether the optional has a value

inline bool has_value() const noexcept

Return whether the optional has a value

struct BaseObjectNNPtr : public util::nn<BaseObjectPtr>
#include <util.hpp>

Non-null shared pointer of BaseObject.

class BaseObject
#include <util.hpp>

Class that can be derived from, to emulate Java's Object behavior.

Subclassed by osgeo::proj::common::IdentifiedObject, osgeo::proj::common::Measure, osgeo::proj::common::ObjectDomain, osgeo::proj::common::UnitOfMeasure, osgeo::proj::coordinates::CoordinateMetadata, osgeo::proj::metadata::Citation, osgeo::proj::metadata::Extent, osgeo::proj::metadata::GeographicExtent, osgeo::proj::metadata::Identifier, osgeo::proj::metadata::PositionalAccuracy, osgeo::proj::metadata::TemporalExtent, osgeo::proj::metadata::VerticalExtent, osgeo::proj::operation::GeneralParameterValue, osgeo::proj::operation::ParameterValue, osgeo::proj::util::ArrayOfBaseObject, osgeo::proj::util::BoxedValue, osgeo::proj::util::GenericName

class IComparable
#include <util.hpp>

Interface for an object that can be compared to another.

Subclassed by osgeo::proj::common::IdentifiedObject, osgeo::proj::common::ObjectDomain, osgeo::proj::metadata::Extent, osgeo::proj::metadata::GeographicExtent, osgeo::proj::metadata::TemporalExtent, osgeo::proj::metadata::VerticalExtent, osgeo::proj::operation::GeneralParameterValue, osgeo::proj::operation::ParameterValue

Public Types

enum class Criterion

Comparison criterion.

Values:

enumerator STRICT

All properties are identical.

enumerator EQUIVALENT

The objects are equivalent for the purpose of coordinate operations. They can differ by the name of their objects, identifiers, other metadata. Parameters may be expressed in different units, provided that the value is (with some tolerance) the same once expressed in a common unit.

enumerator EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS

Same as EQUIVALENT, relaxed with an exception that the axis order of the base CRS of a DerivedCRS/ProjectedCRS or the axis order of a GeographicCRS is ignored. Only to be used with DerivedCRS/ProjectedCRS/GeographicCRS

Public Functions

bool isEquivalentTo(const IComparable *other, Criterion criterion = Criterion::STRICT, const io::DatabaseContextPtr &dbContext = nullptr) const

Returns whether an object is equivalent to another one.

Parameters:
  • other -- other object to compare to

  • criterion -- comparison criterion.

  • dbContext -- Database context, or nullptr.

Returns:

true if objects are equivalent.

class BoxedValue : public osgeo::proj::util::BaseObject
#include <util.hpp>

Encapsulate standard datatypes in an object.

Public Functions

BoxedValue(const char *stringValueIn)

Constructs a BoxedValue from a string.

BoxedValue(const std::string &stringValueIn)

Constructs a BoxedValue from a string.

BoxedValue(int integerValueIn)

Constructs a BoxedValue from an integer.

BoxedValue(bool booleanValueIn)

Constructs a BoxedValue from a boolean.

class ArrayOfBaseObject : public osgeo::proj::util::BaseObject
#include <util.hpp>

Array of BaseObject.

Public Functions

void add(const BaseObjectNNPtr &obj)

Adds an object to the array.

Parameters:

obj -- the object to add.

Public Static Functions

static ArrayOfBaseObjectNNPtr create()

Instantiate a ArrayOfBaseObject.

Returns:

a new ArrayOfBaseObject.

class PropertyMap
#include <util.hpp>

Wrapper of a std::map<std::string, BaseObjectNNPtr>

Public Functions

PropertyMap &set(const std::string &key, const BaseObjectNNPtr &val)

Set a BaseObjectNNPtr as the value of a key.

PropertyMap &set(const std::string &key, const char *val)

Set a string as the value of a key.

PropertyMap &set(const std::string &key, const std::string &val)

Set a string as the value of a key.

PropertyMap &set(const std::string &key, int val)

Set a integer as the value of a key.

PropertyMap &set(const std::string &key, bool val)

Set a boolean as the value of a key.

PropertyMap &set(const std::string &key, const std::vector<std::string> &array)

Set a vector of strings as the value of a key.

class GenericName : public osgeo::proj::util::BaseObject
#include <util.hpp>

A sequence of identifiers rooted within the context of a namespace.

Remark

Simplified version of GenericName from GeoAPI

Subclassed by osgeo::proj::util::LocalName

Public Functions

virtual const NameSpacePtr scope() const = 0

Return the scope of the object, possibly a global one.

virtual std::string toString() const = 0

Return the LocalName as a string.

virtual GenericNameNNPtr toFullyQualifiedName() const = 0

Return a fully qualified name corresponding to the local name.

The namespace of the resulting name is a global one.

class NameSpace
#include <util.hpp>

A domain in which names given by strings are defined.

Remark

Simplified version of NameSpace from GeoAPI

Public Functions

bool isGlobal() const

Returns whether this is a global namespace.

const GenericNamePtr &name() const

Returns the name of this namespace.

class LocalName : public osgeo::proj::util::GenericName
#include <util.hpp>

Identifier within a NameSpace for a local object.

Local names are names which are directly accessible to and maintained by a NameSpace within which they are local, indicated by the scope.

Remark

Simplified version of LocalName from GeoAPI

Public Functions

virtual const NameSpacePtr scope() const override

Return the scope of the object, possibly a global one.

virtual std::string toString() const override

Return the LocalName as a string.

virtual GenericNameNNPtr toFullyQualifiedName() const override

Return a fully qualified name corresponding to the local name.

The namespace of the resulting name is a global one.

class NameFactory
#include <util.hpp>

Factory for generic names.

Remark

Simplified version of NameFactory from GeoAPI

Public Static Functions

static NameSpaceNNPtr createNameSpace(const GenericNameNNPtr &name, const PropertyMap &properties)

Instantiate a NameSpace.

Parameters:
  • name -- name of the namespace.

  • properties -- Properties. Allowed keys are "separator" and "separator.head".

Returns:

a new NameFactory.

static LocalNameNNPtr createLocalName(const NameSpacePtr &scope, const std::string &name)

Instantiate a LocalName.

Parameters:
  • scope -- scope.

  • name -- string of the local name.

Returns:

a new LocalName.

static GenericNameNNPtr createGenericName(const NameSpacePtr &scope, const std::vector<std::string> &parsedNames)

Instantiate a GenericName.

Parameters:
  • scope -- scope.

  • parsedNames -- the components of the name.

Returns:

a new GenericName.

class CodeList
#include <util.hpp>

Abstract class to define an enumeration of values.

Subclassed by osgeo::proj::cs::AxisDirection, osgeo::proj::cs::RangeMeaning, osgeo::proj::datum::RealizationMethod

Public Functions

inline const std::string &toString()

Return the CodeList item as a string.

inline operator std::string()

Return the CodeList item as a string.

class Exception : public std::exception
#include <util.hpp>

Root exception class.

Subclassed by osgeo::proj::crs::InvalidCompoundCRSException, osgeo::proj::io::FactoryException, osgeo::proj::io::FormattingException, osgeo::proj::io::ParsingException, osgeo::proj::operation::InvalidOperation, osgeo::proj::util::InvalidValueTypeException, osgeo::proj::util::UnsupportedOperationException

Public Functions

virtual const char *what() const noexcept override

Return the exception text.

class InvalidValueTypeException : public osgeo::proj::util::Exception
#include <util.hpp>

Exception thrown when an invalid value type is set as the value of a key of a PropertyMap.

class UnsupportedOperationException : public osgeo::proj::util::Exception
#include <util.hpp>

Exception Thrown to indicate that the requested operation is not supported.