Crossfire Server, Trunk
LicenseManager Class Reference

#include <LicenseManager.h>

+ Collaboration diagram for LicenseManager:

Public Types

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

Public Member Functions

std::map< std::string, LicenseItemsgetAll () const
 
LicenseItems getForFace (const std::string &face)
 
 LicenseManager ()
 
void readLicense (BufferReader *reader, const char *filename)
 
void reset ()
 
virtual ~LicenseManager ()
 

Static Public Member Functions

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

Private Attributes

std::map< std::string, LicenseItemsm_licenses
 

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)
static

Get the expected license name from a face name.

Parameters
faceface name, with the suffix.
Returns
expected license file name, empty if face is invalid.

Definition at line 83 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.

References bufferreader_current_line(), bufferreader_next_line(), c, npc_dialog::filename, is_valid_types_gen::line, llevError, and LOG().

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

+ Here is the call graph for this function:
+ 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 c, npc_dialog::filename, llevError, LOG(), m_licenses, parseLicenseFile(), and nlohmann::detail::void().

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 71 of file LicenseManager.h.

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


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