Detailed Description

Provides methods to license the component.

Examples

Shows how initialize a license for Aspose.Words using a license file in the local file system.

// Set the license for our Aspose.Words product by passing the local file system filename of a valid license file.
String licenseFileName = System::IO::Path::Combine(LicenseDir, u"Aspose.Words.Cpp.lic");
auto license = MakeObject<License>();
license->SetLicense(licenseFileName);
// Create a copy of our license file in the binaries folder of our application.
String licenseCopyFileName = System::IO::Path::Combine(AssemblyDir, u"Aspose.Words.Cpp.lic");
System::IO::File::Copy(licenseFileName, licenseCopyFileName);
// If we pass a file's name without a path,
// the SetLicense will search several local file system locations for this file.
// One of those locations will be the "bin" folder, which contains a copy of our license file.
license->SetLicense(u"Aspose.Words.Cpp.lic");

#include <Aspose.Words.Cpp/License.h>

+ Inheritance diagram for Aspose::Words::License:

Public Member Functions

 License ()
 Initializes a new instance of this class. More...
 
virtual const TypeInfoGetType () const override
 
virtual bool Is (const TypeInfo &target) const override
 
void SetLicense (const SharedPtr< Stream > &stream)
 Licenses the component. More...
 
void SetLicense (const String &licenseName)
 Licenses the component. More...
 
template<typename CharType , typename Traits >
void SetLicense (std::basic_istream< CharType, Traits > &stream)
 

Static Public Member Functions

static const TypeInfoType ()
 

Constructor & Destructor Documentation

◆ License()

Aspose::Words::License::License ( )

Initializes a new instance of this class.

Examples

Shows how initialize a license for Aspose.Words using a license file in the local file system.

// Set the license for our Aspose.Words product by passing the local file system filename of a valid license file.
String licenseFileName = System::IO::Path::Combine(LicenseDir, u"Aspose.Words.Cpp.lic");
auto license = MakeObject<License>();
license->SetLicense(licenseFileName);
// Create a copy of our license file in the binaries folder of our application.
String licenseCopyFileName = System::IO::Path::Combine(AssemblyDir, u"Aspose.Words.Cpp.lic");
System::IO::File::Copy(licenseFileName, licenseCopyFileName);
// If we pass a file's name without a path,
// the SetLicense will search several local file system locations for this file.
// One of those locations will be the "bin" folder, which contains a copy of our license file.
license->SetLicense(u"Aspose.Words.Cpp.lic");

Member Function Documentation

◆ GetType()

virtual const System::TypeInfo & Aspose::Words::License::GetType ( ) const
overridevirtual

Reimplemented from System::Object.

◆ Is()

virtual bool Aspose::Words::License::Is ( const System::TypeInfo target) const
overridevirtual

Reimplemented from System::Object.

◆ SetLicense() [1/3]

void Aspose::Words::License::SetLicense ( const System::SharedPtr< System::IO::Stream > &  stream)

Licenses the component.

Use this method to load a license from a stream.

Parameters
streamA stream that contains the license.
Examples

Shows how to initialize a license for Aspose.Words from a stream.

// Set the license for our Aspose.Words product by passing a stream for a valid license file in our local file system.
{
SharedPtr<System::IO::Stream> myStream = System::IO::File::OpenRead(System::IO::Path::Combine(LicenseDir, u"Aspose.Words.Cpp.lic"));
auto license = MakeObject<License>();
license->SetLicense(myStream);
}

◆ SetLicense() [2/3]

void Aspose::Words::License::SetLicense ( const System::String licenseName)

Licenses the component.

Tries to find the license in the following locations:

  1. Explicit path.
  2. The folder that contains the Aspose.Words library.
  3. The folder that contains the client's application.
Parameters
licenseNameCan be a full or short file name. Use an empty string to switch to evaluation mode.
Examples

Shows how initialize a license for Aspose.Words using a license file in the local file system.

// Set the license for our Aspose.Words product by passing the local file system filename of a valid license file.
String licenseFileName = System::IO::Path::Combine(LicenseDir, u"Aspose.Words.Cpp.lic");
auto license = MakeObject<License>();
license->SetLicense(licenseFileName);
// Create a copy of our license file in the binaries folder of our application.
String licenseCopyFileName = System::IO::Path::Combine(AssemblyDir, u"Aspose.Words.Cpp.lic");
System::IO::File::Copy(licenseFileName, licenseCopyFileName);
// If we pass a file's name without a path,
// the SetLicense will search several local file system locations for this file.
// One of those locations will be the "bin" folder, which contains a copy of our license file.
license->SetLicense(u"Aspose.Words.Cpp.lic");

◆ SetLicense() [3/3]

template<typename CharType , typename Traits >
void Aspose::Words::License::SetLicense ( std::basic_istream< CharType, Traits > &  stream)
inline

◆ Type()

static const System::TypeInfo & Aspose::Words::License::Type ( )
static