Crossfire Resources Editor
LicenseManager Class Reference

Contains all information about licenses for faces. More...

#include <LicenseManager.h>

+ Collaboration diagram for LicenseManager:

Public Types

typedef std::pair< std::string, std::string > LicenseItem
 One line in a license file. More...
 
typedef std::map< std::string, std::vector< LicenseItem > > LicenseItems
 For a single face, map between a faceset's prefix and the license items. More...
 

Public Member Functions

std::map< std::string, LicenseItemsgetAll () const
 Get all known license information. More...
 
LicenseItems getForFace (const std::string &face)
 Get license information for a face. More...
 
 LicenseManager ()
 Standard constructor. More...
 
void readLicense (BufferReader *reader, const char *filename)
 Process a license file. More...
 
void reset ()
 Reset license information, before a reloading. More...
 
virtual ~LicenseManager ()
 Standard destructor. More...
 

Static Public Member Functions

static std::string licenseNameFromFaceName (const std::string &face, bool tryWall)
 Get the expected license name from a face name. More...
 
static void parseLicenseFile (BufferReader *reader, const char *filename, std::vector< LicenseItem > &items)
 

Private Attributes

std::map< std::string, LicenseItemsm_licenses
 License information for all faces. More...
 

Detailed Description

Contains all information about licenses for faces.

Definition at line 25 of file LicenseManager.h.

Member Typedef Documentation

◆ LicenseItem

typedef std::pair<std::string, std::string> LicenseManager::LicenseItem

One line in a license file.

Definition at line 28 of file LicenseManager.h.

◆ LicenseItems

typedef std::map<std::string, std::vector<LicenseItem> > LicenseManager::LicenseItems

For a single face, map between a faceset's prefix and the license items.

Definition at line 29 of file LicenseManager.h.

Constructor & Destructor Documentation

◆ LicenseManager()

LicenseManager::LicenseManager ( )

Standard constructor.

Definition at line 19 of file LicenseManager.cpp.

◆ ~LicenseManager()

LicenseManager::~LicenseManager ( )
virtual

Standard destructor.

Definition at line 22 of file LicenseManager.cpp.

Member Function Documentation

◆ getAll()

std::map<std::string, LicenseItems> LicenseManager::getAll ( ) const
inline

Get all known license information.

Returns
map between face names without prefix and license information.

Definition at line 47 of file LicenseManager.h.

References m_licenses.

Referenced by CREMainWindow::onReportLicenses().

+ Here is the caller graph for this function:

◆ getForFace()

LicenseManager::LicenseItems LicenseManager::getForFace ( const std::string &  face)

Get license information for a face.

Parameters
faceface name, with the suffix.
Returns
license information.

Definition at line 75 of file LicenseManager.cpp.

References licenseNameFromFaceName(), and m_licenses.

Referenced by CREFacePanel::updateItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ licenseNameFromFaceName()

std::string LicenseManager::licenseNameFromFaceName ( const std::string &  face,
bool  tryWall 
)
static

Get the expected license name from a face name.

Parameters
faceface name, with the suffix.
tryWallif true, then a trailing _[0-9A-F] from the name will be removed.
Returns
expected license file name, empty if face is invalid.

Definition at line 85 of file LicenseManager.cpp.

Referenced by getForFace(), and CREMainWindow::onReportLicenses().

+ Here is the caller graph for this function:

◆ parseLicenseFile()

void LicenseManager::parseLicenseFile ( BufferReader *  reader,
const char *  filename,
std::vector< LicenseItem > &  items 
)
static

Definition at line 57 of file LicenseManager.cpp.

Referenced by readLicense(), and SoundFiles::refreshSounds().

+ Here is the caller graph for this function:

◆ readLicense()

void LicenseManager::readLicense ( BufferReader *  reader,
const char *  filename 
)

Process a license file.

Parameters
readersource.
filenamefull file name.

Definition at line 25 of file LicenseManager.cpp.

References m_licenses, and parseLicenseFile().

Referenced by ResourcesManager::load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset()

void LicenseManager::reset ( )
inline

Reset license information, before a reloading.

Definition at line 52 of file LicenseManager.h.

References m_licenses.

Referenced by CREMainWindow::onToolReloadAssets().

+ Here is the caller graph for this function:

Field Documentation

◆ m_licenses

std::map<std::string, LicenseItems> LicenseManager::m_licenses
private

License information for all faces.

Definition at line 72 of file LicenseManager.h.

Referenced by getAll(), getForFace(), readLicense(), and reset().


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