libxcks  0.1.0.1
libxcks::ChecksumFactory Class Referencefinal

Generates new instances of the subclasses of the Checksum class that the application knows. More...

#include <ckfactory.hpp>

Classes

class  ChecksumEntry
 Represents an entry of the checksum or hash algorithms that the application knows. More...
 

Public Member Functions

 ChecksumFactory (const ChecksumFactory &)=delete
 Deleted copy constructor. More...
 
ChecksumFactoryoperator= (const ChecksumFactory &)=delete
 Deleted assignment operator. More...
 

Static Public Member Functions

static void initialise ()
 Initializes the static members of the class. More...
 
static void cleanUp ()
 Cleans-up the static members of the class. More...
 
static ChecksumgetNewInstance (const ChecksumAlgoId id)
 Gives a pointer on a new instance of the specified checksum or hash identifier. More...
 
static ChecksumgetNewInstance (const std::string &name, const bool lookInAltNames=true)
 Gives a pointer on a new instance of the specified checksum or hash name. More...
 
static ChecksumValue getNullValue (const ChecksumAlgoId id)
 Gives null value of the specified checksum or hash identifier. More...
 
static ChecksumValue getNullValue (const std::string &name, const bool lookInAltNames=true)
 Gives null value of the specified checksum or hash name. More...
 
static size_t getSize (const ChecksumAlgoId id)
 Gets the size in bytes of the specified checksum or hash identifier. More...
 
static size_t getSize (const std::string &name, const bool lookInAltNames=true)
 Gets the size in bytes of the specified checksum or hash name. More...
 
static bool exists (const ChecksumAlgoId id)
 Returns true if the given identifier of the checksum or hash algorithm exists. More...
 
static bool exists (const std::string &name, const bool lookInAltNames=true)
 Returns true if the given name of the checksum or hash algorithm exists. More...
 
static bool existsNoCase (const std::string &name, const bool lookInAltNames=true)
 Returns true if the given name of the checksum or hash algorithm exists with no case comparison. More...
 
static ArrayChecksumAlgoId getAlgorithmsIds ()
 Returns all the identifiers of the available checksum or hash algorithms. More...
 
static ArrayString getAlgorithmsNames ()
 Returns all the names of the available checksum or hash algorithms. More...
 
static int getAlgorithmsCount ()
 Returns the number of available checksum or hash algorithms. More...
 
static bool getAlgorithmId (ChecksumAlgoId &id, const std::string &name, const bool lookInAltNames=true)
 Gets the identifier of a checksum or hash algorithm from its name. More...
 
static bool getAlgorithmIdNoCase (ChecksumAlgoId &id, const std::string &name, const bool lookInAltNames=true)
 Gets the identifier of a checksum or hash algorithm from its name with no case comparison. More...
 
static bool getAlgorithmName (std::string &name, const ChecksumAlgoId id)
 Gets the name of a checksum or hash algorithm from its identifier. More...
 
static bool getAlgorithmName (std::string &name, const std::string &altName)
 Gets the name of a checksum or hash algorithm from one of its alternatives names. More...
 
static bool getAlgorithmAltNames (ArrayString &altNames, const ChecksumAlgoId id, const bool giveName=false)
 Gets the alternatives names of a checksum or hash algorithm from its identifier. More...
 
static bool getAlgorithmAltNames (ArrayString &altNames, const std::string &name, const bool nameCouldBeAlt=true, const bool giveName=false)
 Gets the alternatives names of a checksum or hash algorithm from its name or one of its alternative names. More...
 
static std::string getAlgorithmDescription (const ChecksumAlgoId id)
 Returns the description of a checksum or hash algorithm from its identifier. More...
 
static std::string getAlgorithmDescription (const std::string &name, const bool lookInAltNames=true)
 Returns the description of a checksum or hash algorithm from its name. More...
 

Detailed Description

Generates new instances of the subclasses of the Checksum class that the application knows.

Known checksums and hashs classes are registered in the initialise() static member. Call it at the start of the program if LibXCKSInitialiser is not used.

Definition at line 46 of file ckfactory.hpp.

Constructor & Destructor Documentation

◆ ChecksumFactory()

libxcks::ChecksumFactory::ChecksumFactory ( const ChecksumFactory )
delete

Deleted copy constructor.

Member Function Documentation

◆ cleanUp()

void libxcks::ChecksumFactory::cleanUp ( )
static

Cleans-up the static members of the class.

Definition at line 263 of file ckfactory.cpp.

◆ exists() [1/2]

bool libxcks::ChecksumFactory::exists ( const ChecksumAlgoId  id)
static

Returns true if the given identifier of the checksum or hash algorithm exists.

Parameters
idIdentifier of the checksum or hash algorithm of which the caller wants to check its existence.
Returns
true if the given identifier of the checksum or hash algorithm exists, false otherwise.

Definition at line 409 of file ckfactory.cpp.

◆ exists() [2/2]

bool libxcks::ChecksumFactory::exists ( const std::string &  name,
const bool  lookInAltNames = true 
)
static

Returns true if the given name of the checksum or hash algorithm exists.

Parameters
nameName of the checksum or hash algorithm of which the caller wants to check its existence.
lookInAltNamesLooks for the name of the checksum or hash algorithm in the alternative names.
Returns
true if the given name of the checksum or hash algorithm exists, false otherwise.

Definition at line 430 of file ckfactory.cpp.

◆ existsNoCase()

bool libxcks::ChecksumFactory::existsNoCase ( const std::string &  name,
const bool  lookInAltNames = true 
)
static

Returns true if the given name of the checksum or hash algorithm exists with no case comparison.

Parameters
nameName of the checksum or hash algorithm of which the caller wants to check its existence.
lookInAltNamesLooks for the name of the checksum or hash algorithm in the alternative names.
Returns
true if the given name of the checksum or hash algorithm exists, false otherwise.

Definition at line 449 of file ckfactory.cpp.

◆ getAlgorithmAltNames() [1/2]

bool libxcks::ChecksumFactory::getAlgorithmAltNames ( ArrayString altNames,
const ChecksumAlgoId  id,
const bool  giveName = false 
)
static

Gets the alternatives names of a checksum or hash algorithm from its identifier.

Remarks
The altNames array isn't cleared before adding names into. It's the responsibility of the caller to do this.
Parameters
[out]altNamesAlternate names of the checksum or hash algorithm.
idIdentifier of the checksum or hash algorithm of which the caller wants the alternative names.
giveNameIf true gives also the name of the checksum or hash algorithm.
Returns
true if a checksum or hash algorithm with the given identifier has been found, false otherwise.

Definition at line 667 of file ckfactory.cpp.

◆ getAlgorithmAltNames() [2/2]

bool libxcks::ChecksumFactory::getAlgorithmAltNames ( ArrayString altNames,
const std::string &  name,
const bool  nameCouldBeAlt = true,
const bool  giveName = false 
)
static

Gets the alternatives names of a checksum or hash algorithm from its name or one of its alternative names.

Remarks
The altNames array isn't cleared before adding names into. It's the responsibility of the caller to do this.
Parameters
[out]altNamesAlternate names of the checksum or hash algorithm.
nameName (or one of the alternative names if nameCouldBeAlt is true) of the checksum or hash algorithm of which the caller wants the alternative names.
nameCouldBeAltIf true looks also in the alternative names list to find the checksum or hash algorithm.
giveNameIf true gives also the name of the checksum or hash algorithm.
Returns
true if a checksum or hash algorithm with the given identifier has been found, false otherwise.

Definition at line 703 of file ckfactory.cpp.

◆ getAlgorithmDescription() [1/2]

std::string libxcks::ChecksumFactory::getAlgorithmDescription ( const ChecksumAlgoId  id)
static

Returns the description of a checksum or hash algorithm from its identifier.

Parameters
idIdentifier of the checksum or hash algorithm of which the caller wants the description.
Returns
The description of a checksum or hash algorithm from its identifier or and empty string if there no checksum or hash algorithm that corresponds to the identifier.

Definition at line 726 of file ckfactory.cpp.

◆ getAlgorithmDescription() [2/2]

std::string libxcks::ChecksumFactory::getAlgorithmDescription ( const std::string &  name,
const bool  lookInAltNames = true 
)
static

Returns the description of a checksum or hash algorithm from its name.

Parameters
nameName of the checksum or hash algorithm of which the caller wants the description.
lookInAltNamesLooks for the name of the checksum or hash algorithm in the alternative names.
Returns
The description of a checksum or hash algorithm from its identifier or and empty string if there no checksum or hash algorithm that corresponds to the identifier.

Definition at line 747 of file ckfactory.cpp.

◆ getAlgorithmId()

bool libxcks::ChecksumFactory::getAlgorithmId ( ChecksumAlgoId id,
const std::string &  name,
const bool  lookInAltNames = true 
)
static

Gets the identifier of a checksum or hash algorithm from its name.

Parameters
[out]idIdentifier of the checksum or hash algorithm.
nameName of the checksum or hash algorithm of which the caller wants the identifier.
lookInAltNamesLooks for the name of the checksum or hash algorithm in the alternative names.
Returns
true if a checksum or hash algorithm with the given name has been found, false otherwise.

Definition at line 518 of file ckfactory.cpp.

◆ getAlgorithmIdNoCase()

bool libxcks::ChecksumFactory::getAlgorithmIdNoCase ( ChecksumAlgoId id,
const std::string &  name,
const bool  lookInAltNames = true 
)
static

Gets the identifier of a checksum or hash algorithm from its name with no case comparison.

Parameters
[out]idIdentifier of the checksum or hash algorithm.
nameName of the checksum or hash algorithm of which the caller wants the identifier.
lookInAltNamesLooks for the name of the checksum or hash algorithm in the alternative names.
Returns
true if a checksum or hash algorithm with the given name has been found, false otherwise.

Definition at line 569 of file ckfactory.cpp.

◆ getAlgorithmName() [1/2]

bool libxcks::ChecksumFactory::getAlgorithmName ( std::string &  name,
const ChecksumAlgoId  id 
)
static

Gets the name of a checksum or hash algorithm from its identifier.

Parameters
[out]nameName of the checksum or hash algorithm.
idIdentifier of the checksum or hash algorithm of which the caller wants the name.
Returns
true if a checksum or hash algorithm with the given identifier has been found, false otherwise.

Definition at line 617 of file ckfactory.cpp.

◆ getAlgorithmName() [2/2]

bool libxcks::ChecksumFactory::getAlgorithmName ( std::string &  name,
const std::string &  altName 
)
static

Gets the name of a checksum or hash algorithm from one of its alternatives names.

Parameters
[out]nameName of the checksum or hash algorithm.
altNameAlternative name (or name but it's stupid) of the checksum or hash algorithm of which the caller wants the name.
Returns
true if a checksum or hash algorithm with the given alternative name (or name) has been found, false otherwise.

Definition at line 641 of file ckfactory.cpp.

◆ getAlgorithmsCount()

int libxcks::ChecksumFactory::getAlgorithmsCount ( )
static

Returns the number of available checksum or hash algorithms.

Returns
The number of available checksum or hash algorithms.

Definition at line 500 of file ckfactory.cpp.

◆ getAlgorithmsIds()

ArrayChecksumAlgoId libxcks::ChecksumFactory::getAlgorithmsIds ( )
static

Returns all the identifiers of the available checksum or hash algorithms.

Returns
All the identifiers of the available checksum or hash algorithms.

Definition at line 462 of file ckfactory.cpp.

◆ getAlgorithmsNames()

ArrayString libxcks::ChecksumFactory::getAlgorithmsNames ( )
static

Returns all the names of the available checksum or hash algorithms.

Returns
All the names of the available checksum or hash algorithms.

Definition at line 481 of file ckfactory.cpp.

◆ getNewInstance() [1/2]

Checksum * libxcks::ChecksumFactory::getNewInstance ( const ChecksumAlgoId  id)
static

Gives a pointer on a new instance of the specified checksum or hash identifier.

The caller is responsible of the deletion of the instance with the delete operator.

Parameters
idIdentifier of the checksum or hash algorithm of which the caller wants a new instance.
Returns
A pointer on a new instance of the specified identifier of checksum or hash algorithm or nullptr if the specified identifier is invalid.

Definition at line 282 of file ckfactory.cpp.

◆ getNewInstance() [2/2]

Checksum * libxcks::ChecksumFactory::getNewInstance ( const std::string &  name,
const bool  lookInAltNames = true 
)
static

Gives a pointer on a new instance of the specified checksum or hash name.

The caller is responsible of the deletion of the instance with the delete operator.

Parameters
nameName of the checksum or hash algorithm of which the caller wants a new instance.
lookInAltNamesLooks for the name of the checksum or hash algorithm in the alternative names.
Returns
A pointer on a new instance of the specified identifier of checksum or hash algorithm or nullptr if the specified identifier is invalid.

Definition at line 306 of file ckfactory.cpp.

◆ getNullValue() [1/2]

ChecksumValue libxcks::ChecksumFactory::getNullValue ( const ChecksumAlgoId  id)
static

Gives null value of the specified checksum or hash identifier.

Parameters
idIdentifier of the checksum or hash algorithm of which the caller wants a null value.
Returns
A null value of the specified identifier of checksum or a checksum's value with a type of ChecksumAlgoId::Invalid if the specified identifier is invalid.

Definition at line 327 of file ckfactory.cpp.

◆ getNullValue() [2/2]

ChecksumValue libxcks::ChecksumFactory::getNullValue ( const std::string &  name,
const bool  lookInAltNames = true 
)
static

Gives null value of the specified checksum or hash name.

Parameters
nameName of the checksum or hash algorithm of which the caller wants a null value.
lookInAltNamesLooks for the name of the checksum or hash algorithm in the alternative names.
Returns
A null value of the specified identifier of checksum or a checksum's value with a type of ChecksumAlgoId::Invalid if the specified name is invalid.

Definition at line 348 of file ckfactory.cpp.

◆ getSize() [1/2]

size_t libxcks::ChecksumFactory::getSize ( const ChecksumAlgoId  id)
static

Gets the size in bytes of the specified checksum or hash identifier.

Parameters
idIdentifier of the checksum or hash algorithm of which the caller wants the size in bytes.
Returns
The size in bytes of the specified checksum or hash identifier or SIZE_MAX if the specified identifier is invalid.

Definition at line 368 of file ckfactory.cpp.

◆ getSize() [2/2]

size_t libxcks::ChecksumFactory::getSize ( const std::string &  name,
const bool  lookInAltNames = true 
)
static

Gets the size in bytes of the specified checksum or hash name.

Parameters
nameName of the checksum or hash algorithm of which the caller wants the size in bytes.
lookInAltNamesLooks for the name of the checksum or hash algorithm in the alternative names.
Returns
The size in bytes of the specified checksum or hash name or SIZE_MAX if the specified name is invalid.

Definition at line 388 of file ckfactory.cpp.

◆ initialise()

void libxcks::ChecksumFactory::initialise ( )
static

Initializes the static members of the class.

The name the type of the checksums' file should be the same as the one returned by checksums_file_type::getFileType().

Definition at line 183 of file ckfactory.cpp.

◆ operator=()

ChecksumFactory& libxcks::ChecksumFactory::operator= ( const ChecksumFactory )
delete

Deleted assignment operator.


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