Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
config_license.cpp

Read in the mascot.license file.

/*
##############################################################################
# file: config_license.cpp #
# 'msparser' toolkit example code #
##############################################################################
# COPYRIGHT NOTICE #
# Copyright 1998-2005 Matrix Science Limited All Rights Reserved. #
# #
##############################################################################
# $Source: parser/examples/test_cxx/config_license.cpp $ #
# $Author: villek@matrixscience.com $ #
# $Date: 2018-07-30 16:23:53 +0100 $ #
# $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_3_0_0-2024-09-24-0-g93ebaeb4f4 $ #
# $NoKeywords:: $ #
##############################################################################
*/
#include "msparser.hpp"
#include <iostream>
// All the classes are part of the matrix_science namespace
using namespace matrix_science;
int main(int argc, char * argv[])
{
if ( argc < 2 )
{
std::cout << "Location of 'mascot.license'-file has to be specified as a parameter" << std::endl;
return 0;
}
ms_license file(argv[1]);
if ( !file.isValid() )
{
std::cout << "There are errors. Cannot continue. The last error description:" << std::endl;
std::cout << file.getLastErrorString() << std::endl;
return 1;
}
if ( file.isLicenseValid() )
{
std::cout << "Mascot license is still valid. Other information:" << std::endl;
std::cout << file.getLicenseString() << std::endl;
}
else
{
std::cout << "Mascot license has either expired or been corrupted" << std::endl;
}
return 0;
}
/*
will give the output, for instance:
# config_license ../config/mascot.license
Mascot license has either expired or been corrupted
*/
std::string getLastErrorString() const
Return the error description of the last error that occurred.
Definition: ms_errors.cpp:1488
bool isValid() const
Call this function to determine if there have been any errors.
Definition: ms_errors.cpp:1472
The class provides access license details in read-only mode.
Definition: ms_license.hpp:52
bool isLicenseValid() const
Returns TRUE if the license has been sucessfully read, parsed and checked.
Definition: ms_license.cpp:267
std::string getLicenseString() const
Returns a compound license string that can be used for displaying license information.
Definition: ms_license.cpp:285