An SBTypeList contains a list of SBType objects. It would not be very useful
since SBType objects do not contain a values.
We should probably make an SBTypeEnumerator. Something like:
class SBTypeEnumerator
{
bool
IsSigned();
// Get the enumerator value as a signed integer
int64_t
GetValueAsSigned();
// Get the enumerator value as an unsigned integer
uint64_t
GetValueAsUnsigned();
// Return the exact integer type for this enumerator
SBType
GetType();
const char *
GetName();
};
Then we would need to add a SBTypeEnumeratorList class as well:
class SBTypeEnumeratorList
{
SBTypeEnumerator
GetEnumeratorAtIndex (uint32_t idx);
SBTypeEnumerator
GetEnumeratorByName (const char *name);
SBTypeEnumeratorList
GetEnumeratorsByValue (int64_t value);
SBTypeEnumeratorList
GetEnumeratorsByValue (uint64_t value);
};
Then we would need to add functions to SBType:
class SBType
{
SBTypeEnumeratorList
GetEnumerators();
}
This would return a valid SBTypeEnumeratorList only if the SBType it was run on
is an enumeration type.
On Oct 13, 2013, at 5:14 PM, Russell Harmon <[email protected]> wrote:
> According to the C11 standard, N1570, §6.7.2.2.3, "The identifiers in an
> enumerator list are declared as constants that have type int". Based on this,
> wouldn't it make most sense to have a function that returns an SBTypeList of
> ints?
>
> Is there an easy work around for this missing bit of API, or shall I add the
> necessary pieces?
>
> --
> Russell Harmon
>
>
> On Mon, Oct 7, 2013 at 10:45 AM, Enrico Granata <[email protected]> wrote:
> As far as I can tell/remember, this is missing API
>
> Technically, it would not be an SBTypeList since the entries in an enumerator
> are *NOT* types.
>
> We would probably have to come up with a new class like an SBEnumeratorEntry
> (I am sure better names are possible :-) that wraps the notion of a
> (numeric_value,string_name) pair
>
> Enrico Granata
> 📩 egranata@.com
> ☎️ 27683
>
> On Oct 7, 2013, at 12:23 AM, Russell Harmon <[email protected]> wrote:
>
>> Is there a way to enumerate the fields of an enum (e.x. get an SBTypeList
>> from an enum), or is that missing API?
>>
>> Thanks
>> Russell Harmon
>> _______________________________________________
>> lldb-dev mailing list
>> [email protected]
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
>
>
> _______________________________________________
> lldb-dev mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev