MaskSpecifier.h

Classes

MaskSpecifier -- Class to specify which mask to use in an image. (full description)

class MaskSpecifier

Interface

Public Members
MaskSpecifier (Bool useDefaultMask = True) : itsFlag(useDefaultMask)
MaskSpecifier (const Char* maskName) : itsFlag(False), itsName(maskName)
MaskSpecifier (const String& maskName) : itsFlag(False), itsName(maskName)
Bool useDefault() const
const String& name() const

Description

Review Status

Programs:
Tests:

Synopsis

The only purpose of MaskSpecifier is to reduce the number of constructors in PagedImage. It makes it possible to specify if no mask, the default mask, or another mask should be used when opening an existing PagedImage object.

Because the constructors automatically converts from a Bool or a String, the user does not need to be aware of MaskSpecifier.

Motivation

The number of constructors in PagedImage would be many more without this class. It would need one taking a Bool and a String. Because C++ converts a const char* to Bool instead of String, a const char* would also be needed multiple times.

Member Description

MaskSpecifier (Bool useDefaultMask = True) : itsFlag(useDefaultMask)

Default constructor. It tells if the default mask should or no mask be used.

MaskSpecifier (const Char* maskName) : itsFlag(False), itsName(maskName)
MaskSpecifier (const String& maskName) : itsFlag(False), itsName(maskName)

Construct from a string. It tells to use an alternative mask. An empty name means no mask.

Bool useDefault() const
const String& name() const

Give the flag or name.