uCalc API Version: 2.1.3-preview.2 Released: 6/17/2026
Warning
uCalc API Preview Release Notice:The documentation describes the intended behavior of the API. The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.
ItemOf(int64, int, string, bool)
Method
Product:
Class:
Retrieves an item by iterating through a filtered list of all symbols defined within the uCalc instance.
Syntax
Parameters
Return
Item
The Item object at the specified index in the filtered list. Returns an empty item (where IsEmpty() is true) if the index is out of bounds or no items match the filter.
Remarks
The ItemOf method provides a powerful way to query and iterate through all symbols (functions, variables, operators, etc.) defined within a uCalc instance. By specifying filter criteria, you can create a virtual list of matching items and retrieve a specific one by its index.
This is one of two overloads for ItemOf. This version iterates through a list of items based on their properties, while the other overload finds a specific item by name.
🔍 Filtering by Property
The properties parameter accepts a bitmask that specifies which types of items to include. This mask is typically generated using one of two approaches:
- Single Property: Pass a single member of the ItemIs enum (e.g.,
ItemIs::Functionto find only functions). - Multiple Properties: Use the static Properties() method to combine multiple
ItemIsflags. You can specify whether to match any (ItemIs::SelectAny, default) or all (ItemIs::SelectAll) of the provided properties.
Use 0 to create a list of all items without any property filtering.
🔢 Iteration and Indexing
The index parameter is a zero-based index into the filtered list. To iterate through all matching items, start at index 0 and increment until ItemOf returns an empty item (which you can check with item.IsEmpty() or item.IsProperty(ItemIs::NotFound)).
⛓️ Handling Overloads
It's possible for multiple items (like overloaded functions or operators) to share the same name. The includeOverloads parameter controls how these are handled:
false(default): Only the first or primary item for a given name is included in the list.true: All overloads are included as separate entries in the list.
Comparative Analysis: Why uCalc?
In languages like C# or Java, runtime introspection is typically handled by a Reflection API. While extremely powerful, reflection can be complex to use and often carries a performance penalty.
- vs. Reflection: uCalc's
ItemOfprovides a more focused and efficient alternative. It is designed specifically for inspecting the uCalc engine's internal state. Instead of navigating complexTypeandMemberInfoobjects, you get a direct, streamlinedItemobject that contains all the relevant metadata (name, data type, precedence, etc.) for that symbol.
This makes ItemOf the ideal tool for building dynamic applications on top of uCalc, such as:
- Debuggers and Inspectors: Programmatically list all defined variables and their current values.
- Dynamic UI: Populate an autocomplete or IntelliSense list with available functions and their parameters.
- Documentation Generators: Automatically generate documentation for a library of custom uCalc functions.
Examples
ItemOf based on properties
using uCalcSoftware;
var uc = new uCalc();
var Item = new uCalc.Item();
var x = 0;
// Lists the first few funcions defined in uCalc
// For the full list, loop until Item.IsEmpty() or while Item.NotEmpty()
for ( x = 0; x <= 15; x++) {
Item = uc.ItemOf(ItemIs.Function, x);
Console.WriteLine(Item.Name);
}
Console.WriteLine("---");
// List only Prefix and Postfix (operators)
x = 0;
do {
Item = uc.ItemOf(uCalc.Properties(ItemIs.Prefix, ItemIs.Postfix), x);
x = x + 1;
Console.WriteLine(Item.Name);
} while (Item.NotEmpty());
abs
acos
acosh
addptr
addressof
anytype
append
append_copy
arg
argcount
asc
asin
asinh
atan
atan2
atanh
---
!
+
-
not
~ using uCalcSoftware; var uc = new uCalc(); var Item = new uCalc.Item(); var x = 0; // Lists the first few funcions defined in uCalc // For the full list, loop until Item.IsEmpty() or while Item.NotEmpty() for ( x = 0; x <= 15; x++) { Item = uc.ItemOf(ItemIs.Function, x); Console.WriteLine(Item.Name); } Console.WriteLine("---"); // List only Prefix and Postfix (operators) x = 0; do { Item = uc.ItemOf(uCalc.Properties(ItemIs.Prefix, ItemIs.Postfix), x); x = x + 1; Console.WriteLine(Item.Name); } while (Item.NotEmpty());
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
uCalc::Item Item;
auto x = 0;
// Lists the first few funcions defined in uCalc
// For the full list, loop until Item.IsEmpty() or while Item.NotEmpty()
for ( x = 0; x <= 15; x++) {
Item = uc.ItemOf(ItemIs::Function, x);
cout << Item.Name() << endl;
}
cout << "---" << endl;
// List only Prefix and Postfix (operators)
x = 0;
do {
Item = uc.ItemOf(uCalc::Properties(ItemIs::Prefix, ItemIs::Postfix), x);
x = x + 1;
cout << Item.Name() << endl;
} while (Item.NotEmpty());
}
abs
acos
acosh
addptr
addressof
anytype
append
append_copy
arg
argcount
asc
asin
asinh
atan
atan2
atanh
---
!
+
-
not
~ #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; uCalc::Item Item; auto x = 0; // Lists the first few funcions defined in uCalc // For the full list, loop until Item.IsEmpty() or while Item.NotEmpty() for ( x = 0; x <= 15; x++) { Item = uc.ItemOf(ItemIs::Function, x); cout << Item.Name() << endl; } cout << "---" << endl; // List only Prefix and Postfix (operators) x = 0; do { Item = uc.ItemOf(uCalc::Properties(ItemIs::Prefix, ItemIs::Postfix), x); x = x + 1; cout << Item.Name() << endl; } while (Item.NotEmpty()); }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim Item As New uCalc.Item()
Dim x = 0
'// Lists the first few funcions defined in uCalc
'// For the full list, loop until Item.IsEmpty() or while Item.NotEmpty()
For x = 0 To 15
Item = uc.ItemOf(ItemIs.Function , x)
Console.WriteLine(Item.Name)
Next
Console.WriteLine("---")
'// List only Prefix and Postfix (operators)
x = 0
Do
Item = uc.ItemOf(uCalc.Properties(ItemIs.Prefix, ItemIs.Postfix), x)
x = x + 1
Console.WriteLine(Item.Name)
Loop While Item.NotEmpty()
End Sub
End Module
abs
acos
acosh
addptr
addressof
anytype
append
append_copy
arg
argcount
asc
asin
asinh
atan
atan2
atanh
---
!
+
-
not
~ Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim Item As New uCalc.Item() Dim x = 0 '// Lists the first few funcions defined in uCalc '// For the full list, loop until Item.IsEmpty() or while Item.NotEmpty() For x = 0 To 15 Item = uc.ItemOf(ItemIs.Function , x) Console.WriteLine(Item.Name) Next Console.WriteLine("---") '// List only Prefix and Postfix (operators) x = 0 Do Item = uc.ItemOf(uCalc.Properties(ItemIs.Prefix, ItemIs.Postfix), x) x = x + 1 Console.WriteLine(Item.Name) Loop While Item.NotEmpty() End Sub End Module