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