This page describes the DumpEnumValues RefactorScript shipped with VisualGDB.


This script generates a function for translating an enum value to a string.
In order to run this script, first select an enum in Code Explorer -> Outline.


generator GenerateEnumDump(Enum enum)
>const char *Dump$enum.ShortName($enum.ShortName value)
>    switch(value)
>    {
    foreach(val in enum.Values)
>    case $val.ShortName:
>        return "$val.ShortName";
>    default:
>        return NULL;
>    }

Sample Input

enum TestEnum

Sample Output

const char *DumpTestEnum(TestEnum value)
    case Value1:
        return "Value1";
    case Value2:
        return "Value2";
    case Value3:
        return "Value3";
        return NULL;
A detailed reference on RefactorScript syntax and data model is available here.
See this page for a full list of RefactorScripts shipped with VisualGDB.