Aspose.Tasks for C++
License.h
1 #pragma once
2 //-----------------------------------------------------------------------
3 // <copyright file="License.cs" company="Aspose Pty Ltd">
4 // Copyright (c) 2002-2025 Aspose Pty Ltd. All Rights Reserved.
5 // </copyright>
6 //-----------------------------------------------------------------------
7 
8 /// Aspose
9 
10 #include <system/object.h>
11 
12 #include "aspose.tasks.cpp/aspose_tasks_api_defs.h"
13 
14 namespace Aspose
15 {
16 namespace LicenseV2
17 {
18 class LicenseInternal;
19 } // namespace LicenseV2
20 } // namespace Aspose
21 namespace System
22 {
23 namespace IO
24 {
25 class Stream;
26 } // namespace IO
27 class String;
28 } // namespace System
29 
30 namespace Aspose {
31 
32 namespace Tasks {
33 
34 /// <summary>
35 /// Provides methods to license the component.
36 /// </summary>
37 /// <example>
38 /// In this example, an attempt will be made to find a license file named MyLicense.lic
39 /// in the folder that contains
40 /// <ms>
41 /// the component, in the folder that contains the calling assembly,
42 /// in the folder of the entry assembly and then in the embedded resources of the calling assembly.
43 /// <code>
44 /// [C#]
45 ///
46 /// License license = new License();
47 /// license.SetLicense("MyLicense.lic");
48 ///
49 ///
50 /// [Visual Basic]
51 ///
52 /// Dim license As license = New license
53 /// License.SetLicense("MyLicense.lic")
54 /// </code>
55 /// </ms>
56 /// <java>
57 /// the component jar file:
58 /// <code>
59 /// License license = new License();
60 /// license.setLicense("MyLicense.lic");
61 /// </code>
62 /// </java>
63 /// </example>
64 class ASPOSE_TASKS_SHARED_CLASS License final : public System::Object
65 {
66  typedef License ThisType;
67  typedef System::Object BaseType;
68 
69  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
70  ASPOSE_TASKS_SHARED_RTTI_INFO_DECL();
71 
72 public:
73 
74  /// <summary>
75  /// Initializes a new instance of the <see cref="License"></see> class.
76  /// </summary>
77  /// <example>
78  /// In this example, an attempt will be made to find a license file named MyLicense.lic
79  /// in the folder that contains
80  /// <ms>
81  /// the component, in the folder that contains the calling assembly,
82  /// in the folder of the entry assembly and then in the embedded resources of the calling assembly.
83  /// <code>
84  /// [C#]
85  ///
86  /// License license = new License();
87  /// license.SetLicense("MyLicense.lic");
88  ///
89  ///
90  /// [Visual Basic]
91  ///
92  /// Dim license As license = New license
93  /// License.SetLicense("MyLicense.lic")
94  /// </code>
95  /// </ms>
96  /// <java>
97  /// the component jar file:
98  /// <code>
99  /// License license = new License();
100  /// license.setLicense("MyLicense.lic");
101  /// </code>
102  /// </java>
103  /// </example>
104  ASPOSE_TASKS_SHARED_API License();
105 
106  /// <summary>
107  /// Licenses the component.
108  /// </summary>
109  /// <param name="licenseName">Can be a full or short file name or name of an embedded resource.
110  /// Use an empty string to switch to evaluation mode.</param>
111  /// <remarks>
112  /// <p>Tries to find the license in the following locations:</p>
113  /// <p>1. Explicit path.</p>
114  /// <ms>
115  /// <p>2. The folder that contains the Aspose component assembly.</p>
116  /// <p>3. The folder that contains the client's calling assembly.</p>
117  /// <p>4. The folder that contains the entry (startup) assembly.</p>
118  /// <p>5. An embedded resource in the client's calling assembly.</p>
119  /// <p><b>Note:</b>On the .NET Compact Framework, tries to find the license only in these locations:</p>
120  /// <p>1. Explicit path.</p>
121  /// <p>2. An embedded resource in the client's calling assembly.</p>
122  /// </ms>
123  /// <java>
124  /// <p>2. The folder that contains the Aspose component JAR file.</p>
125  /// <p>3. The folder that contains the client's calling JAR file.</p>
126  /// </java>
127  /// </remarks>
128  /// <example>
129  /// In this example, an attempt will be made to find a license file named MyLicense.lic
130  /// in the folder that contains
131  /// <ms>
132  /// the component, in the folder that contains the calling assembly,
133  /// in the folder of the entry assembly and then in the embedded resources of the calling assembly.
134  /// <code>
135  /// [C#]
136  ///
137  /// License license = new License();
138  /// license.SetLicense("MyLicense.lic");
139  /// </code>
140  /// </ms>
141  /// <java>
142  /// the component jar file:
143  /// <code>
144  /// License license = new License();
145  /// license.setLicense("MyLicense.lic");
146  /// </code>
147  /// </java>
148  /// </example>
149  ASPOSE_TASKS_SHARED_API void SetLicense(const System::String& licenseName);
150  /// <summary>
151  /// Licenses the component.
152  /// </summary>
153  /// <param name="stream">A stream that contains the license.</param>
154  /// <remarks>
155  /// <p>Use this method to load a license from a stream.</p>
156  /// </remarks>
157  /// <example>
158  /// <code>
159  /// <ms>
160  /// [C#]
161  ///
162  /// License license = new License();
163  /// license.SetLicense(myStream);
164  ///
165  ///
166  /// [Visual Basic]
167  ///
168  /// Dim license as License = new License
169  /// license.SetLicense(myStream)
170  /// </ms>
171  /// <java>
172  /// License license = new License();
173  /// license.setLicense(myStream);
174  /// </java>
175  /// </code>
176  /// </example>
177  /// <javaName>void setLicense(java.io.InputStream stream)</javaName>
178  ASPOSE_TASKS_SHARED_API void SetLicense(const System::SharedPtr<System::IO::Stream>& stream);
179 
180 protected:
181 
182  #ifdef ASPOSE_GET_SHARED_MEMBERS
183  ASPOSE_TASKS_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
184  #endif
185 
186 
187 private:
188 
189  System::SharedPtr<LicenseV2::LicenseInternal> licenseInternal;
190 
191 };
192 
193 } // namespace Tasks
194 } // namespace Aspose
195 
196 
197 
Provides methods to license the component.
Definition: License.h:65
License()
Initializes a new instance of the License class.
void SetLicense(const System::SharedPtr< System::IO::Stream > &stream)
Licenses the component.
void SetLicense(const System::String &licenseName)
Licenses the component.
Aspose.
Definition: Asn.h:13