Skip to content

Commit 1624f21

Browse files
authored
Merge pull request #65 from KubaO/staging
Improve Attributes documentation.
2 parents ef5ea26 + 2f752c7 commit 1624f21

File tree

2 files changed

+79
-52
lines changed

2 files changed

+79
-52
lines changed

docs/Miscellaneous/Documentation Development.md

Lines changed: 12 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -81,56 +81,20 @@ These are modules within VBA and VBRUN:
8181
>
8282
> All non-alphabetic characters, as well as parameters, are removed from the links. All attribute names are in lowercase in the links. E.g. `ArrayBoundsChecks(Bool)` is referenced as `/tB/Core/Attributes#arrayboundschecks`.
8383
84-
- [AppObject](../tB/Core/Attributes#appobject)
85-
- [ArrayBoundsChecks](../tB/Core/Attributes#arrayboundschecks)
86-
- [BindOnlyIfNoArguments](../tB/Core/Attributes#bindonlyifnoarguments)
87-
- [BindOnlyIfStringSuffix](../tB/Core/Attributes#bindonlyifstringsuffix)
88-
- [ClassId](../tB/Core/Attributes#classid)
89-
- [CoClassCustomConstructor](../tB/Core/Attributes#coclasscustomconstructor)
90-
- [CoClassId](../tB/Core/Attributes#coclassid)
91-
- [COMControl](../tB/Core/Attributes#comcontrol)
92-
- [COMCreatable](../tB/Core/Attributes#comcreatable)
93-
- [COMExtensible](../tB/Core/Attributes#comextensible)
94-
- [ComImport](../tB/Core/Attributes#comimport)
95-
- [CompileIf](../tB/Core/Attributes#compileif)
96-
- [CompilerOptions](../tB/Core/Attributes#compileroptions)
97-
- [ConstantFoldable](../tB/Core/Attributes#constantfoldable)
98-
- [ConstantFoldableNumericsOnly](../tB/Core/Attributes#constantfoldablenumericsonly)
99-
- [Debuggable](../tB/Core/Attributes#debuggable)
100-
- [DebugOnly](../tB/Core/Attributes#debugonly)
101-
- [Description](../tB/Core/Attributes#description)
102-
- [DispId](../tB/Core/Attributes#dispid)
103-
- [DllExport](../tB/Core/Attributes#dllexport)
104-
- [DLLStackCheck](../tB/Core/Attributes#dllstackcheck)
105-
- [EnforceErrors](../tB/Core/Attributes#enforceerrors)
106-
- [EnforceWarnings](../tB/Core/Attributes#enforcewarnings)
107-
- [EnumId](../tB/Core/Attributes#enumid)
108-
- [EventInterfaceId](../tB/Core/Attributes#eventinterfaceid)
109-
- [EventsUseDispInterface](../tB/Core/Attributes#eventsusedispinterface)
110-
- [Flags](../tB/Core/Attributes#flags)
111-
- [FloatingPointErrorChecks](../tB/Core/Attributes#floatingpointerrorchecks)
112-
- [FormDesignerId](../tB/Core/Attributes#formdesignerid)
113-
- [Hidden](../tB/Core/Attributes#hidden)
114-
- [IdeButton](../tB/Core/Attributes#idebutton)
115-
- [IntegerOverflowChecks](../tB/Core/Attributes#integeroverflowchecks)
116-
- [InterfaceId](../tB/Core/Attributes#interfaceid)
84+
- [AppObject](../tB/Core/Attributes#appobject), [ArrayBoundsChecks](../tB/Core/Attributes#arrayboundschecks)
85+
- [BindOnlyIfNoArguments](../tB/Core/Attributes#bindonlyifnoarguments), [BindOnlyIfStringSuffix](../tB/Core/Attributes#bindonlyifstringsuffix)
86+
- [ClassId](../tB/Core/Attributes#classid), [ClassInterface](../tB/Core/Attributes#classinterface), [CoClassCustomConstructor](../tB/Core/Attributes#coclasscustomconstructor), [CoClassId](../tB/Core/Attributes#coclassid), [COMControl](../tB/Core/Attributes#comcontrol), [COMCreatable](../tB/Core/Attributes#comcreatable), [COMExtensible](../tB/Core/Attributes#comextensible), [ComImport](../tB/Core/Attributes#comimport), [CompileIf](../tB/Core/Attributes#compileif), [CompilerOptions](../tB/Core/Attributes#compileroptions), [ConstantFoldable](../tB/Core/Attributes#constantfoldable), [ConstantFoldableNumericsOnly](../tB/Core/Attributes#constantfoldablenumericsonly)
87+
- [Debuggable](../tB/Core/Attributes#debuggable), [DebugOnly](../tB/Core/Attributes#debugonly), [DefaultMember](../tB/Core/Attributes#defaultmember), [Description](../tB/Core/Attributes#description), [DispId](../tB/Core/Attributes#dispid), [DispInterface](../tB/Core/Attributes#dispinterface), [DllExport](../tB/Core/Attributes#dllexport), [DLLStackCheck](../tB/Core/Attributes#dllstackcheck), [DualInterface](../tB/Core/Attributes#dualinterface)
88+
- [EnforceErrors](../tB/Core/Attributes#enforceerrors), [EnforceWarnings](../tB/Core/Attributes#enforcewarnings), [EnumId](../tB/Core/Attributes#enumid), [EventInterfaceId](../tB/Core/Attributes#eventinterfaceid), [EventsUseDispInterface](../tB/Core/Attributes#eventsusedispinterface)
89+
- [Flags](../tB/Core/Attributes#flags), [FloatingPointErrorChecks](../tB/Core/Attributes#floatingpointerrorchecks), [FormDesignerId](../tB/Core/Attributes#formdesignerid), [Hidden](../tB/Core/Attributes#hidden)
90+
- [IdeButton](../tB/Core/Attributes#idebutton), [IgnoreWarnings](../tB/Core/Attributes#ignorewarnings), [IntegerOverflowChecks](../tB/Core/Attributes#integeroverflowchecks), [InterfaceId](../tB/Core/Attributes#interfaceid)
11791
- [MustBeQualified](../tB/Core/Attributes#mustbequalified)
11892
- [OleAutomation](../tB/Core/Attributes#oleautomation)
119-
- [PackingAlignment](../tB/Core/Attributes#packingalignment)
120-
- [PopulateFrom](../tB/Core/Attributes#populatefrom)
121-
- [PredeclaredID](../tB/Core/Attributes#predeclaredid)
122-
- [PreserveSig](../tB/Core/Attributes#preservesig)
123-
- [Restricted](../tB/Core/Attributes#restricted)
124-
- [RunAfterBuild](../tB/Core/Attributes#runafterbuild)
125-
- [Serialize](../tB/Core/Attributes#serialize)
126-
- [SetDllDirectory](../tB/Core/Attributes#setdlldirectory)
127-
- [SimplerByVals](../tB/Core/Attributes#simplerbyvals)
128-
- [TestCase](../tB/Core/Attributes#testcase)
129-
- [TestFixture](../tB/Core/Attributes#testfixture)
130-
- [TypeHint](../tB/Core/Attributes#typehint)
131-
- [Unimplemented](../tB/Core/Attributes#unimplemented)
132-
- [UseGetLastError](../tB/Core/Attributes#usegetlasterror)
133-
- [UserDefinedTypeIsAnAlias](../tB/Core/Attributes#userdefinedtypeisanalias)
93+
- [PackingAlignment](../tB/Core/Attributes#packingalignment), [PopulateFrom](../tB/Core/Attributes#populatefrom), [PredeclaredID](../tB/Core/Attributes#predeclaredid), [PreserveSig](../tB/Core/Attributes#preservesig)
94+
- [Restricted](../tB/Core/Attributes#restricted), [RunAfterBuild](../tB/Core/Attributes#runafterbuild)
95+
- [Serialize](../tB/Core/Attributes#serialize), [SetDllDirectory](../tB/Core/Attributes#setdlldirectory), [SimplerByVals](../tB/Core/Attributes#simplerbyvals)
96+
- [TestCase](../tB/Core/Attributes#testcase), [TestFixture](../tB/Core/Attributes#testfixture), [TypeHint](../tB/Core/Attributes#typehint)
97+
- [Unimplemented](../tB/Core/Attributes#unimplemented), [UseGetLastError](../tB/Core/Attributes#usegetlasterror), [UserDefinedTypeIsAnAlias](../tB/Core/Attributes#userdefinedtypeisanalias)
13498
- [WindowsControl](../tB/Core/Attributes#windowscontrol)
13599

136100
## Development Environment

docs/Reference/Attributes.md

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ Applicable to: [**Class**](Class)
7676

7777
Assigns a COM CLSID to a class. For details, [see this COM documentation page](https://learn.microsoft.com/en-us/windows/win32/com/com-class-objects-and-clsids).
7878

79+
## ClassInterface
80+
81+
twinBASIC doesn't supports this attribute directly. It supports its values under different names. See:
82+
83+
* [DualInterface](#dualinterface)
84+
* [DispInterface](#dispinterface)
85+
86+
7987
## CoClassCustomConstructor (String)
8088
{: #coclasscustomconstructor }
8189

@@ -208,7 +216,7 @@ Applicable to: [**Class**](Class)
208216

209217
Syntax: **[Debuggable** [ **( True** \| **False )** ] **]**
210218

211-
Applicable to: [**Module**](Module), [procedure in a Class or Module](../Gloss#procedure)
219+
Applicable to: [**Module**](Module), [procedure in a **Class** or **Module**](../Gloss#procedure)
212220

213221
When false, turns of breakpoints and stepping for the method or module. The default value is **True**.
214222

@@ -221,6 +229,36 @@ Applicable to: [procedure definitions](../Gloss#procedure)
221229

222230
Excludes calls to this procedure from the Build. They are only available when running from the IDE, i.e. debugging.
223231

232+
## DefaultMember (optional Bool)
233+
234+
{: #defaultmember }
235+
236+
Syntax: **[DefaultMember** [ **(** **True** \| **False** **)** ] **]**
237+
238+
Applicable to: [procedure in a **Class**](../Gloss#procedure)
239+
240+
Default members are accessed under the instance of the object itself, without specifying their name. For example, a class that offers indexable elements may have an **Item** property that is the default member:
241+
242+
```vb
243+
Class MyCollection
244+
[DefaultMember]
245+
Property Get Item(ByVal index&) As String
246+
' ...
247+
End Property
248+
249+
[DefaultMember]
250+
Property Let Item(ByVal index&, ByVal value$)
251+
' ...
252+
End Property
253+
End Class
254+
255+
Sub Example()
256+
Dim coll As New MyCollection
257+
Debug.Print "Item #3: ", coll(3) ' Property Get Item is invoked
258+
coll(4) = "Item 4" ' Property Let Item is invoked
259+
End Sub
260+
```
261+
224262
## Description (String)
225263
{: #description }
226264

@@ -237,7 +275,18 @@ Syntax: **[DispId(** 123 **)]**
237275

238276
Applicable to: [procedure in an Interface](../Gloss#procedure)
239277

240-
Defines a dispatch ID associated with the procedure.
278+
Defines a dispatch ID associated with the procedure when exposed via **IDispatch**.
279+
280+
## DispInterface
281+
282+
Syntax: **[DispInterface]**
283+
284+
Applicable to: [**Interface**](Interface) in a **Library**
285+
286+
> [!NOTE]
287+
> This attribute is generated in the **Library** modules that twinBASIC generates for COM references in a project. It cannot be manually created.
288+
289+
Indicates that the interface exposes methods via **IDispatch** late-binding. This is the default. Note that [**DualInterface**](#dualinterface) can also be specified, giving much improved performance over that of **IDispatch**-based interfaces.
241290

242291
## DllExport (optional Bool)
243292
{: #dllexport }
@@ -262,6 +311,18 @@ Applicable to: [**Declare** (API declaration)](Declare)
262311

263312
Gives minor codegen size reduction on 32-bit API calls on the Intel platform. Has no effect on other platforms.
264313

314+
## DualInterface
315+
316+
Syntax: **[DualInterface]**
317+
318+
Applicable to: [**Interface**](Interface) in a **Library**
319+
320+
> [!NOTE]
321+
>
322+
> This attribute is generated in the **Library** modules that twinBASIC generates for COM references in a project. It cannot be manually created.
323+
324+
Indicates that the interface exposes methods through the OLE VTable binding. The latter has much improved performance over that of **IDispatch**-based interfaces.
325+
265326
## EnforceErrors (optional Bool)
266327
{: #enforceerrors }
267328

@@ -341,10 +402,12 @@ Syntax: **[IdeButton("** caption **")]**
341402

342403
Applicable to: [procedure](../Gloss#procedure) definition in a module.
343404

344-
## IgnoreWarnings (optional Bool)
405+
## IgnoreWarnings (String List)
345406
{: #ignorewarnings }
346407

347-
Syntax: **[IgnoreWarnings** [ **( True** \| **False )** ] **]**
408+
Syntax: **[IgnoreWarnings** **(** **TBnnnn** [ **,** **TBmmmm** ]... **)** **]**
409+
410+
Disables certain warnings. The list of strings should enumerate the warnings that are to be suppressed.
348411

349412
## IntegerOverflowChecks (optional Bool)
350413
{: #integeroverflowchecks }

0 commit comments

Comments
 (0)