HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_OptionsHolder Class Reference

#include <UT_Options.h>

+ Inheritance diagram for UT_OptionsHolder:

Public Types

enum  UT_OptionsReferenceType { REFERENCE }
 
- Public Types inherited from UT_OptionsRef
typedef UT_Options value_type
 
enum  UT_OptionsSentinelType { SENTINEL }
 

Public Member Functions

SYS_FORCE_INLINE UT_OptionsHolder ()
 
SYS_FORCE_INLINE UT_OptionsHolder (const UT_Options *opt)
 Will make a copy of the provided options. More...
 
SYS_FORCE_INLINE UT_OptionsHolder (UT_UniquePtr< UT_Options > opts)
 
SYS_FORCE_INLINE UT_OptionsHolder (UT_OptionsReferenceType, const UT_Options *opt)
 Will make a shallow reference. More...
 
SYS_FORCE_INLINE UT_OptionsHolder (UT_OptionsReferenceType, const UT_OptionsRef &ref)
 Makes a shallow reference to the contents of the UT_OptionsRef. More...
 
 UT_OptionsHolder (const UT_OptionsRef &ref)
 
SYS_FORCE_INLINE UT_OptionsHolder (UT_OptionsSentinelType sentinel)
 Construct as a sentinel value. More...
 
SYS_FORCE_INLINE UT_OptionsHolder (const UT_OptionsHolder &str)
 Makes a copy of the provided options. More...
 
SYS_FORCE_INLINE UT_OptionsHolder (UT_OptionsHolder &&a) noexcept
 Move constructor. Steals the working data from the original. More...
 
SYS_FORCE_INLINE UT_OptionsHolderoperator= (const UT_OptionsHolder &s)
 Makes a bit-wise copy of the options and adjust the reference count. More...
 
SYS_FORCE_INLINE UT_OptionsHolderoperator= (UT_OptionsHolder &&s)
 
SYS_FORCE_INLINE void swap (UT_OptionsHolder &other)
 
SYS_FORCE_INLINE void swap (UT_OptionsRef &other)
 
UT_OptionsmakeUnique ()
 
template<typename OP >
void update (const OP &op)
 
- Public Member Functions inherited from UT_OptionsRef
SYS_FORCE_INLINE UT_OptionsRef ()
 
SYS_FORCE_INLINE UT_OptionsRef (const UT_Options *opt)
 Will make a shallow reference. More...
 
SYS_FORCE_INLINE UT_OptionsRef (const UT_OptionsRef &s)
 Shares a reference with the source. More...
 
SYS_FORCE_INLINE UT_OptionsRef (UT_OptionsRef &&s) noexcept
 Move constructor. Steals the working data from the original. More...
 
SYS_FORCE_INLINE ~UT_OptionsRef ()
 
bool isUnique () const
 Returns true this object is the sole owner of the underlying options. More...
 
int use_count () const
 
UT_OptionsRefoperator= (const UT_OptionsRef &s)
 Shares a reference with the source. More...
 
SYS_FORCE_INLINE UT_OptionsRefoperator= (UT_OptionsRef &&s)
 
SYS_FORCE_INLINE const UT_OptionsoptionsOrNull () const
 
SYS_FORCE_INLINE const UT_Optionsoptions () const
 
bool operator== (const UT_OptionsRef &s) const
 
bool operator== (const UT_Options *b) const
 
bool operator!= (const UT_OptionsRef &s) const
 
bool operator!= (const UT_Options *s) const
 
bool isEqual (const UT_OptionsRef &s, fpreal64 tol) const
 Comparison operator with a tolerance for float values. More...
 
SYS_FORCE_INLINE const UT_Optionsoperator-> () const
 
SYS_FORCE_INLINE const UT_Optionsoperator* () const
 
SYS_FORCE_INLINE void swap (UT_OptionsRef &other)
 
SYS_FORCE_INLINE void clear ()
 
bool isEmpty () const
 
 operator bool () const
 
unsigned hash () const
 
void reference (const UT_Options *src)
 
int64 getMemoryUsage (bool inclusive) const
 
SYS_FORCE_INLINE UT_OptionsRef (UT_OptionsSentinelType)
 
SYS_FORCE_INLINE bool isSentinel () const
 
SYS_FORCE_INLINE void makeSentinel ()
 

Static Public Attributes

static const UT_OptionsHolder theEmptyOptions
 
static const UT_OptionsHolder theSentinel
 

Friends

void swap (UT_OptionsHolder &a, UT_OptionsRef &b)
 
void swap (UT_OptionsHolder &a, UT_OptionsHolder &b)
 

Additional Inherited Members

- Static Public Member Functions inherited from UT_OptionsRef
static const UT_OptionsemptyOptions ()
 

Detailed Description

Definition at line 1016 of file UT_Options.h.

Member Enumeration Documentation

UT_OptionsHolder can be constructed with UT_OptionsHolder::REFERENCE to create a shallow reference to the const char *.

Enumerator
REFERENCE 

Definition at line 1021 of file UT_Options.h.

Constructor & Destructor Documentation

SYS_FORCE_INLINE UT_OptionsHolder::UT_OptionsHolder ( )
inline

Definition at line 1024 of file UT_Options.h.

SYS_FORCE_INLINE UT_OptionsHolder::UT_OptionsHolder ( const UT_Options opt)
inline

Will make a copy of the provided options.

Definition at line 1031 of file UT_Options.h.

SYS_FORCE_INLINE UT_OptionsHolder::UT_OptionsHolder ( UT_UniquePtr< UT_Options opts)
inline

Definition at line 1041 of file UT_Options.h.

SYS_FORCE_INLINE UT_OptionsHolder::UT_OptionsHolder ( UT_OptionsReferenceType  ,
const UT_Options opt 
)
inline

Will make a shallow reference.

Definition at line 1049 of file UT_Options.h.

SYS_FORCE_INLINE UT_OptionsHolder::UT_OptionsHolder ( UT_OptionsReferenceType  ,
const UT_OptionsRef ref 
)
inline

Makes a shallow reference to the contents of the UT_OptionsRef.

Definition at line 1056 of file UT_Options.h.

UT_OptionsHolder::UT_OptionsHolder ( const UT_OptionsRef ref)

Makes a deep copy of the provided UT_OptionsRef. This constructor is not marked explicit since we often want this conversion (e.g. when inserting a UT_OptionsRef into a UT_OptionsMap, as with the const char* constructor).

SYS_FORCE_INLINE UT_OptionsHolder::UT_OptionsHolder ( UT_OptionsSentinelType  sentinel)
inlineexplicit

Construct as a sentinel value.

Definition at line 1069 of file UT_Options.h.

SYS_FORCE_INLINE UT_OptionsHolder::UT_OptionsHolder ( const UT_OptionsHolder str)
inline

Makes a copy of the provided options.

Definition at line 1076 of file UT_Options.h.

SYS_FORCE_INLINE UT_OptionsHolder::UT_OptionsHolder ( UT_OptionsHolder &&  a)
inlinenoexcept

Move constructor. Steals the working data from the original.

Definition at line 1083 of file UT_Options.h.

Member Function Documentation

UT_Options* UT_OptionsHolder::makeUnique ( )
inline

Returns a writeable UT_Options which will modify the contents of this options holder. When this is copied or deleted, the returned pointer must not be used any more. (Ideally we could erase ourself and return a UniquePtr for correct life time, but we can't steal from a shared pointer)

Use update() whereever possible instead as it is much safer.

Definition at line 1129 of file UT_Options.h.

SYS_FORCE_INLINE UT_OptionsHolder& UT_OptionsHolder::operator= ( const UT_OptionsHolder s)
inline

Makes a bit-wise copy of the options and adjust the reference count.

Definition at line 1090 of file UT_Options.h.

SYS_FORCE_INLINE UT_OptionsHolder& UT_OptionsHolder::operator= ( UT_OptionsHolder &&  s)
inline

Move the contents of about-to-be-destructed options s to this options.

Definition at line 1099 of file UT_Options.h.

SYS_FORCE_INLINE void UT_OptionsHolder::swap ( UT_OptionsHolder other)
inline

Definition at line 1106 of file UT_Options.h.

SYS_FORCE_INLINE void UT_OptionsHolder::swap ( UT_OptionsRef other)
inline

Definition at line 1112 of file UT_Options.h.

template<typename OP >
void UT_OptionsHolder::update ( const OP &  op)
inline

Updates the contents of this option, first making sure it is unique. The provided operator should take a reference to a UT_Options that it will update. UT_OptionsHolder value; value.update([](UT_Options &opt) { opt.setOptionS("test", "bar"); });

Definition at line 1151 of file UT_Options.h.

Friends And Related Function Documentation

void swap ( UT_OptionsHolder a,
UT_OptionsRef b 
)
friend

Friend specialization of std::swap() to use UT_OptionsHolder::swap()

Definition at line 1159 of file UT_Options.h.

void swap ( UT_OptionsHolder a,
UT_OptionsHolder b 
)
friend

Friend specialization of std::swap() to use UT_OptionsHolder::swap()

Definition at line 1160 of file UT_Options.h.

Member Data Documentation

const UT_OptionsHolder UT_OptionsHolder::theEmptyOptions
static

In some functions it's nice to be able to return a const-reference to a UT_OptionsHolder. However, in error cases, you likely want to return an empty options. This would mean that you'd have to return a real UT_OptionsHolder (not a const reference). This static lets you return a reference to an empty options.

Definition at line 1168 of file UT_Options.h.

const UT_OptionsHolder UT_OptionsHolder::theSentinel
static

Definition at line 1170 of file UT_Options.h.


The documentation for this class was generated from the following file: