Skip to content

Commit 369ac09

Browse files
committed
Add API reference documentation for 23 Bold classes
New class documentation covering 7 categories: - Attribute Types: TBAString, TBAInteger, TBAFloat, TBACurrency, TBAMoment, TBABoolean, TBABlob - Subscription: TBoldPublisher, TBoldSubscriber, TBoldPassthroughSubscriber, TBoldAbstractDeriver - Runtime Type Info: TBoldSystemTypeInfo, TBoldClassTypeInfo, TBoldMemberRTInfo - Persistence: TBoldPersistenceHandle - Identity: TBoldObjectId - Utility: TBoldGuard - GUI Components: TBoldGrid, TBoldEdit, TBoldLabel, TBoldComboBox, TBoldCheckBox, TBoldNavigator Updated mkdocs.yml with expanded 9-section API Reference nav, strict mode, and Mermaid click link support. Added cross-reference links in diagrams and tables for TBoldAttribute, TBoldMember, and TBoldObjectList.
1 parent d6f4f10 commit 369ac09

29 files changed

Lines changed: 2795 additions & 8 deletions

docs/classes/TBABlob.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# TBABlob
2+
3+
`TBABlob` stores binary large object data using `TBoldBlobStream`. Suitable for files, images, documents, and any binary content.
4+
5+
## Class Hierarchy
6+
7+
```mermaid
8+
classDiagram
9+
class TBoldAttribute {
10+
<<abstract>>
11+
}
12+
TBoldAttribute <|-- TBABlob
13+
TBABlob <|-- TBATypedBlob
14+
TBABlob <|-- TBABlobImageJPEG
15+
TBABlob <|-- TBABlobImageBMP
16+
17+
class TBABlob {
18+
+AsStream TBoldBlobStream
19+
+BlobSize Int64
20+
+LoadFromFile()
21+
+SaveToFile()
22+
}
23+
class TBATypedBlob {
24+
+ContentType string
25+
}
26+
27+
click TBoldAttribute href "../TBoldAttribute/" "TBoldAttribute documentation"
28+
```
29+
30+
## Class Definition
31+
32+
```pascal
33+
TBABlob = class(TBoldAttribute)
34+
public
35+
destructor Destroy; override;
36+
procedure SetToNull; override;
37+
procedure Assign(Source: TBoldElement); override;
38+
procedure SetEmptyValue; override;
39+
procedure LoadFromStream(Stream: TStream);
40+
procedure LoadFromFile(const aFileName: string; aMode: Word = fmShareDenyNone);
41+
procedure SaveToStream(Stream: TStream);
42+
procedure SaveToFile(const FileName: string);
43+
function CompareToAs(CompareType: TBoldCompareType; BoldElement: TBoldElement): Integer; override;
44+
property AsStream: TBoldBlobStream read GetAsStream;
45+
property BlobSize: Int64 read GetBlobSize;
46+
property ContentType: string; // via StringRepresentation
47+
end;
48+
49+
TBATypedBlob = class(TBABlob)
50+
public
51+
// Adds explicit ContentType property
52+
function CanSetContentType(Value: string; Subscriber: TBoldSubscriber): Boolean;
53+
end;
54+
```
55+
56+
## TBoldBlobStream
57+
58+
The blob's data is accessed through `TBoldBlobStream`, which extends `TStream`:
59+
60+
```pascal
61+
TBoldBlobStream = class(TStream)
62+
public
63+
procedure Clear;
64+
procedure Truncate;
65+
procedure LoadFromStream(Stream: TStream);
66+
procedure LoadFromFile(const aFileName: string);
67+
procedure SaveToStream(Stream: TStream);
68+
procedure SaveToFile(const FileName: string);
69+
function IsDataSame(AData: Pointer; ASize: Int64): Boolean;
70+
end;
71+
```
72+
73+
## Working with TBABlob
74+
75+
### Loading and Saving Files
76+
77+
```pascal
78+
// Load a file into a blob attribute
79+
Document.M_Attachment.LoadFromFile('C:\Reports\annual.pdf');
80+
81+
// Save blob to file
82+
Document.M_Attachment.SaveToFile('C:\Temp\export.pdf');
83+
```
84+
85+
### Working with Streams
86+
87+
```pascal
88+
// Load from stream
89+
var MemStream: TMemoryStream;
90+
MemStream := TMemoryStream.Create;
91+
try
92+
MemStream.LoadFromFile('image.jpg');
93+
Product.M_Photo.LoadFromStream(MemStream);
94+
finally
95+
MemStream.Free;
96+
end;
97+
98+
// Read via stream
99+
Product.M_Photo.AsStream.SaveToFile('output.jpg');
100+
```
101+
102+
### Checking Size and Content
103+
104+
```pascal
105+
// Check if blob has data
106+
if Product.M_Photo.IsNull then
107+
ShowMessage('No photo');
108+
109+
// Check size
110+
ShowMessage(Format('Size: %d bytes', [Product.M_Photo.BlobSize]));
111+
```
112+
113+
### Typed Blobs
114+
115+
`TBATypedBlob` adds a MIME-type content type:
116+
117+
```pascal
118+
// Set content type for a typed blob
119+
Document.M_Attachment.ContentType := 'application/pdf';
120+
```
121+
122+
## Blob Subtypes
123+
124+
| Type | Purpose | Content Type |
125+
|------|---------|-------------|
126+
| `TBABlob` | Generic binary data | None |
127+
| `TBATypedBlob` | Binary with MIME type | User-defined |
128+
| `TBABlobImageJPEG` | JPEG images | image/jpeg |
129+
| `TBABlobImageBMP` | BMP images | image/bmp |
130+
131+
## See Also
132+
133+
- [TBoldAttribute](TBoldAttribute.md) - Base class
134+
- [TBAString](TBAString.md) - For text data, use string attributes

docs/classes/TBABoolean.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# TBABoolean
2+
3+
`TBABoolean` stores boolean attribute values. Unusually, it inherits from `TBAValueSet` (the enumeration base class) rather than directly from `TBoldAttribute`, because a boolean is modeled as a two-value set.
4+
5+
## Class Hierarchy
6+
7+
```mermaid
8+
classDiagram
9+
class TBoldAttribute {
10+
<<abstract>>
11+
}
12+
TBoldAttribute <|-- TBAValueSet
13+
TBAValueSet <|-- TBABoolean
14+
TBABoolean <|-- TBAConstraint
15+
16+
class TBABoolean {
17+
+AsBoolean Boolean
18+
+CreateWithValue()
19+
+GetValues()
20+
}
21+
class TBAConstraint {
22+
+ConstraintExpression
23+
}
24+
25+
click TBoldAttribute href "../TBoldAttribute/" "TBoldAttribute documentation"
26+
```
27+
28+
## Class Definition
29+
30+
```pascal
31+
TBAValueSet = class(TBoldAttribute)
32+
public
33+
class function GetValues: TBAValueSetValueList; virtual; abstract;
34+
function GetContentAsInteger: Integer; virtual;
35+
procedure SetContentAsInteger(NewValue: Integer); virtual;
36+
end;
37+
38+
TBABoolean = class(TBAValueSet)
39+
public
40+
constructor CreateWithValue(Value: Boolean);
41+
class function GetValues: TBAValueSetValueList; override;
42+
property AsBoolean: Boolean read GetAsBoolean write SetAsBoolean;
43+
end;
44+
```
45+
46+
## Working with TBABoolean
47+
48+
### Reading and Writing
49+
50+
```pascal
51+
// Direct property access
52+
IsActive := Customer.Active;
53+
Customer.Active := True;
54+
55+
// Raw member access
56+
Customer.M_Active.AsBoolean := False;
57+
```
58+
59+
### Null Handling (Three-State)
60+
61+
Boolean attributes can be null (unknown/unset):
62+
63+
```pascal
64+
// Check for null
65+
if Customer.M_Active.IsNull then
66+
ShowMessage('Active status unknown');
67+
68+
// Set to null (unknown)
69+
Customer.M_Active.SetToNull;
70+
```
71+
72+
### TBAConstraint
73+
74+
`TBAConstraint` is a special derived boolean that evaluates an OCL constraint expression:
75+
76+
```pascal
77+
// Constraints are defined in the UML model
78+
// They automatically evaluate and return True/False
79+
if not Order.M_IsValid.AsBoolean then
80+
ShowMessage('Order constraint violated: ' + Order.M_IsValid.AsString);
81+
```
82+
83+
## Common Patterns
84+
85+
### Binding to TBoldCheckBox
86+
87+
```pascal
88+
// In form designer:
89+
// BoldCheckBox1.BoldHandle := ExpressionHandle pointing to boolean attr
90+
// AllowGrayed := True for nullable booleans
91+
```
92+
93+
### OCL Boolean Operations
94+
95+
```
96+
// Filter by boolean attribute
97+
Customer.allInstances->select(active = true)
98+
Customer.allInstances->reject(active)
99+
100+
// Boolean logic
101+
self.active and self.verified
102+
self.active or self.verified
103+
not self.active
104+
```
105+
106+
## See Also
107+
108+
- [TBoldAttribute](TBoldAttribute.md) - Grandparent class
109+
- [TBoldCheckBox](TBoldCheckBox.md) - UI component for boolean display
110+
- [TBAString](TBAString.md) - String attribute sibling

docs/classes/TBACurrency.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# TBACurrency
2+
3+
`TBACurrency` stores Delphi's `Currency` type — a 64-bit fixed-point value with 4 decimal places. Ideal for financial calculations where floating-point rounding errors are unacceptable.
4+
5+
## Class Hierarchy
6+
7+
```mermaid
8+
classDiagram
9+
class TBANumeric {
10+
<<abstract>>
11+
+AsFloat: Double
12+
+IsNullOrZero()
13+
}
14+
TBANumeric <|-- TBACurrency
15+
TBANumeric <|-- TBAFloat
16+
17+
class TBACurrency {
18+
+AsCurrency Currency
19+
+AsFloat Double
20+
+CreateWithValue()
21+
}
22+
23+
click TBAFloat href "../TBAFloat/" "TBAFloat documentation"
24+
```
25+
26+
## Class Definition
27+
28+
```pascal
29+
TBACurrency = class(TBANumeric)
30+
public
31+
constructor CreateWithValue(Value: Currency);
32+
function ValidateString(const Value: string; Representation: TBoldRepresentation): Boolean; override;
33+
function ValidateCharacter(C: Char; Representation: TBoldRepresentation): Boolean; override;
34+
procedure SetEmptyValue; override;
35+
procedure Assign(Source: TBoldElement); override;
36+
function CompareToAs(CompType: TBoldCompareType; BoldElement: TBoldElement): Integer; override;
37+
function CanSetValue(NewValue: Currency; Subscriber: TBoldSubscriber): Boolean;
38+
property AsCurrency: Currency read GetAsCurrency write SetAsCurrency;
39+
property AsFloat: Double read GetAsFloat write SetAsFloat;
40+
property AsInteger: Integer write SetAsInteger;
41+
end;
42+
```
43+
44+
## Currency vs Float
45+
46+
| Feature | TBACurrency | TBAFloat |
47+
|---------|-------------|----------|
48+
| Delphi type | `Currency` (Int64 / 10000) | `Double` (IEEE 754) |
49+
| Precision | Exact to 4 decimal places | ~15 significant digits |
50+
| Range | ±922,337,203,685,477.5807 | ±1.7 × 10³⁰⁸ |
51+
| Best for | Money, invoices, accounting | Science, measurements |
52+
| Rounding | No rounding errors | Subject to IEEE rounding |
53+
54+
## Working with TBACurrency
55+
56+
### Reading and Writing
57+
58+
```pascal
59+
// Direct property access
60+
Total := Invoice.TotalAmount;
61+
Invoice.TotalAmount := 1500.50;
62+
63+
// Raw member access
64+
Invoice.M_TotalAmount.AsCurrency := 1500.50;
65+
66+
// Also accessible as Double
67+
Invoice.M_TotalAmount.AsFloat := 1500.50;
68+
```
69+
70+
### Financial Calculations
71+
72+
```pascal
73+
// Currency arithmetic is exact
74+
var Tax: Currency;
75+
Tax := Invoice.TotalAmount * 0.25; // exact to 4 decimals
76+
Invoice.TaxAmount := Tax;
77+
```
78+
79+
## See Also
80+
81+
- [TBAFloat](TBAFloat.md) - Floating-point alternative
82+
- [TBAInteger](TBAInteger.md) - Integer sibling
83+
- [TBoldAttribute](TBoldAttribute.md) - Base class

0 commit comments

Comments
 (0)