hydrogen 1.2.3
License Class Reference

Wrapper class to help Hydrogen deal with the license information specified in a drumkit. More...

#include <License.h>

Inheritance diagram for License:
Object< License > Base

Public Types

enum  LicenseType {
  CC_0 = 0 , CC_BY = 1 , CC_BY_NC = 2 , CC_BY_SA = 3 ,
  CC_BY_NC_SA = 4 , CC_BY_ND = 5 , CC_BY_NC_ND = 6 , GPL = 7 ,
  AllRightsReserved = 8 , Other = 9 , Unspecified = 10
}
 A couple of recognized licenses. More...
 

Public Member Functions

 License (const License *pOther)
 
 License (const QString &sLicenseString="", const QString &sCopyrightHolder="")
 
 ~License ()
 
QString getCopyrightHolder () const
 
QString getLicenseString () const
 
LicenseType getType () const
 
bool hasAttribution () const
 
bool isCopyleft () const
 
bool operator!= (const License &other) const
 
bool operator== (const License &other) const
 
void parse (const QString &sLicenseString)
 
void setCopyrightHolder (const QString &sCopyrightHolder)
 
void setType (LicenseType license)
 
QString toQString (const QString &sPrefix="", bool bShort=true) const override
 Formatted string version for debugging purposes.
 
- Public Member Functions inherited from Object< License >
 Object ()
 
 Object (const Object< License > &other)
 
- Public Member Functions inherited from Base
 Base ()
 
 Base (const Base &other)
 
virtual const char * class_name () const
 
void Print (bool bShort=true) const
 Prints content of toQString() via DEBUGLOG.
 

Static Public Member Functions

static QString getGPLLicenseNotice (const QString &sAuthor)
 
static QString LicenseTypeToQString (LicenseType license)
 
- Static Public Member Functions inherited from Base
static const char * _class_name ()
 return the class name
 
static QString base_clock (const QString &sMsg)
 Measures the current time and stores it in __last_clock.
 
static QString base_clock_in (const QString &sMsg)
 
static int bootstrap (Logger *logger, bool count=false)
 must be called before any Object instantiation !
 
static bool count_active ()
 
static int getAliveObjectCount ()
 
static object_map_t getObjectMap ()
 
static Loggerlogger ()
 return the logger instance
 
static int objects_count ()
 
static void printObjectMapDiff (object_map_t map)
 Creates the difference between a snapshot of the object map and its current state and prints it to std::cout.
 
static void set_count (bool flag)
 enable/disable class instances counting
 
static void write_objects_map_to (std::ostream &out, object_map_t *map=nullptr)
 output the full objects map to a given ostream
 
static void write_objects_map_to_cerr ()
 output objects map to stderr
 

Private Attributes

LicenseType m_license
 
QString m_sCopyrightHolder
 This variable will not be written to disk.
 
QString m_sLicenseString
 

Additional Inherited Members

- Static Public Attributes inherited from Base
static QString sPrintIndention = " "
 String used to format the debugging string output of some core classes.
 
- Protected Member Functions inherited from Object< License >
 ~Object ()
 
- Protected Member Functions inherited from Base
 ~Base ()
 
- Static Protected Member Functions inherited from Base
static void registerClass (const char *name, const atomic_obj_cpt_t *counters)
 
- Static Protected Attributes inherited from Base
static bool __count = false
 should we count class instances
 
static timeval __last_clock = { 0, 0 }
 
static Logger__logger = nullptr
 

Detailed Description

Wrapper class to help Hydrogen deal with the license information specified in a drumkit.

In order support the user in assigning the right license when creating a new drumkit or song, Hydrogen will keep track of the license information of each individual sample and checks whether any copyleft ones are included or credit must be given due to a CC BY* license.

The license string contained in the XML file is parsed and Hydrogen tries to map it to one of its supported LicenseType.

Definition at line 47 of file License.h.

Member Enumeration Documentation

◆ LicenseType

A couple of recognized licenses.

The ones supplied by Creative Commons are the most desired ones.

Enumerator
CC_0 
CC_BY 
CC_BY_NC 
CC_BY_SA 
CC_BY_NC_SA 
CC_BY_ND 
CC_BY_NC_ND 
GPL 

Not a desirable license for audio data but introduced here specifically since it is already used by a number of kits.

AllRightsReserved 

User decides with withhold all rights.

Other 

All other licenses not specified above.

Unspecified 

No license set yet.

Definition at line 58 of file License.h.

Constructor & Destructor Documentation

◆ License() [1/2]

License ( const QString & sLicenseString = "",
const QString & sCopyrightHolder = "" )

Definition at line 28 of file License.cpp.

◆ License() [2/2]

License ( const License * pOther)

Definition at line 35 of file License.cpp.

◆ ~License()

~License ( )

Definition at line 41 of file License.cpp.

Member Function Documentation

◆ getCopyrightHolder()

QString getCopyrightHolder ( ) const
inline

Definition at line 149 of file License.h.

◆ getGPLLicenseNotice()

QString getGPLLicenseNotice ( const QString & sAuthor)
inlinestatic

Definition at line 194 of file License.h.

◆ getLicenseString()

QString getLicenseString ( ) const
inline

Definition at line 146 of file License.h.

◆ getType()

License::LicenseType getType ( ) const
inline

Definition at line 143 of file License.h.

◆ hasAttribution()

bool hasAttribution ( ) const

Definition at line 138 of file License.cpp.

◆ isCopyleft()

bool isCopyleft ( ) const

Definition at line 128 of file License.cpp.

◆ LicenseTypeToQString()

QString LicenseTypeToQString ( License::LicenseType license)
inlinestatic

Definition at line 155 of file License.h.

◆ operator!=()

bool operator!= ( const License & other) const
inline

Definition at line 107 of file License.h.

◆ operator==()

bool operator== ( const License & other) const
inline

Definition at line 92 of file License.h.

◆ parse()

void parse ( const QString & sLicenseString)

Definition at line 49 of file License.cpp.

◆ setCopyrightHolder()

void setCopyrightHolder ( const QString & sCopyrightHolder)
inline

Definition at line 152 of file License.h.

◆ setType()

void setType ( LicenseType license)

Definition at line 44 of file License.cpp.

◆ toQString()

QString toQString ( const QString & sPrefix = "",
bool bShort = true ) const
overridevirtual

Formatted string version for debugging purposes.

Parameters
sPrefixString prefix which will be added in front of every new line
bShortInstead of the whole content of all classes stored as members just a single unique identifier will be displayed without line breaks.
Returns
String presentation of current object.

Reimplemented from Base.

Definition at line 151 of file License.cpp.

Field Documentation

◆ m_license

LicenseType m_license
private

Definition at line 133 of file License.h.

◆ m_sCopyrightHolder

QString m_sCopyrightHolder
private

This variable will not be written to disk.

It just serves as a temporary vessel for the e.g. drumkit's or song's author. Storing it would lead to additional effort for keeping it in sync with the former.

Definition at line 140 of file License.h.

◆ m_sLicenseString

QString m_sLicenseString
private

Definition at line 134 of file License.h.