InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IDType< T > Class Template Reference

#include <OMTypes.h>

Public Types

typedef base_type data_type
 
typedef int32 difference_type
 
typedef uint32 value_type
 

Public Member Functions

constexpr IDType (const IDType &) noexcept=default
 
IDTypeoperator= (const IDType &) noexcept=default
 
constexpr IDType (IDType &&) noexcept=default
 
IDTypeoperator= (IDType &&) noexcept=default
 
constexpr IDType (value_type sourceInt) noexcept
 
IDTypeoperator= (const value_type &sourceInt) noexcept
 
bool operator> (const IDType &rhs) const noexcept
 
bool operator> (const value_type &rhs) const noexcept
 
bool operator< (const IDType &rhs) const noexcept
 
bool operator< (const value_type &rhs) const noexcept
 
bool operator<= (const IDType &rhs) const noexcept
 
bool operator<= (const value_type &rhs) const noexcept
 
bool operator>= (const IDType &rhs) const noexcept
 
bool operator>= (const value_type &rhs) const noexcept
 
bool operator== (const IDType &rhs) const noexcept
 
bool operator!= (const IDType &rhs) const noexcept
 
bool operator!= (const value_type &rhs) const noexcept
 
IDTypeoperator+= (const difference_type &rhs)
 
IDTypeoperator++ ()
 
const IDType operator++ (int)
 
IDTypeoperator-= (const IDType &rhs)
 
IDTypeoperator-= (const difference_type &rhs)
 
IDTypeoperator-- ()
 
const IDType operator-- (int)
 
value_type operator>> (const int &rhs) const
 
value_type operator<< (const int &rhs) const
 
value_type operator& (const value_type &rhs) const
 
value_type operator| (const value_type &rhs)
 
IDTypeoperator|= (const value_type &rhs)
 
value_type & Get () noexcept
 
const value_type & Get () const noexcept
 
bool IsValid () const noexcept
 

Static Public Member Functions

static bool less_IDType (IDType< T > &lhs, IDType< T > &rhs)
 

Friends

bool operator> (const value_type &lhs, const IDType< T > &rhs) noexcept
 
bool operator< (const value_type &lhs, const IDType< T > &rhs) noexcept
 
bool operator<= (const value_type &lhs, const IDType< T > &rhs) noexcept
 
bool operator>= (const value_type &lhs, const IDType< T > &rhs) noexcept
 
bool operator== (const value_type &lhs, const IDType< T > &rhs) noexcept
 
bool operator!= (const value_type &lhs, const IDType< T > &rhs) noexcept
 
IDType< T > operator+ (const IDType< T > &lhs, const difference_type &rhs)
 
IDType< T > operator+ (const IDType< T > &lhs, const IDType< T > &rhs)
 
IDType< T > operator+ (const difference_type &lhs, const IDType< T > rhs)
 
IDType< T > operator- (const difference_type &lhs, IDType< T > rhs)
 
difference_type operator- (const IDType< T > &lhs, const difference_type &rhs)
 
difference_type operator- (const IDType< T > &lhs, const IDType< T > &rhs)
 
value_type operator& (const value_type &lhs, const IDType< T > &rhs)
 
value_type operator| (const value_type &lhs, const IDType< T > &rhs)
 

Detailed Description

template<class T>
class IDType< T >

IDType is the underlying base type used for representing any type that is an InDesign ID-space. An ID-space is an integer composed of a plug-in prefix, plus a one-byte offset. Each identifier within the id-space is unique. We use IDType as a base class in order to detect mismatches between them at runtime. For instance, if you pass a ClassID to something that expects an IID, that will cause a compile time error instead of a (relatively more costly to fix) runtime error.

IDTypes can be used pretty much interchangeably as if they were integers. The exceptions to this rule are if they are being used in a switch statement, and when you are reading them in or out of resources. For cases where you simply must have an integer, we supply the Get() function.