Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Proper understanding of namespaces
 New Topic  Reply to Topic
 Printer Friendly
Author  Topic Next Topic  

KRG
Senior Member

USA
41 Posts

Posted - Oct 15 2025 :  1:20:01 PM  Show Profile  Reply with Quote
I filed a ticket on this around 3+ years ago and I'm still waiting. It would be great if VAX could understand namespaces and nested namespaces.

if I have something like this:


namespace Some::Nested::Namespace
{
    struct Foo
    {
        enum class Bar
        {
            A,
            B,
            C
        };

        Bar GetBar() const;
    };
}


then if I generate an implementation for GetBar, I end up with this mess:


namespace Some::Nested::Namespace
{
    Some::Nested::Namespace::Foo::Bar Foo::GetBar() const
    {

    }
}


If I try to autogenerate a switch statement for the enum, then I get this mess:


namespace Some::Nested::Namespace
{
    Some::Nested::Namespace::Foo::Bar Foo::GetBar() const
    {
        Bar varBar;

        switch ( varBar )
        {
            case Some::Nested::Namespace::Foo::Bar::A:
            break;
            case Some::Nested::Namespace::Foo::Bar::B:
            break;
            case Some::Nested::Namespace::Foo::Bar::C:
            break;
            default:
            break;
        }
    }
}


VAX obviously has some understanding of namespaces as it will create the definition of the function in the correct namespace block but it seems to fail when generating the types within those blocks.

what I would like is this:


namespace Some::Nested::Namespace
{
    Foo::Bar Foo::GetBar() const
    {
        Bar varBar;

        switch ( varBar )
        {
            case Bar::A:
            break;
            case Bar::B:
            break;
            case Bar::C:
            break;
            default:
            break;
        }
    }
}

feline
Whole Tomato Software

United Kingdom
19232 Posts

Posted - Oct 16 2025 :  11:48:01 AM  Show Profile  Reply with Quote
Which IDE and version of VA are you using?

Just starting with the first bit, I am assuming you are triggering Create Implementation on the class member function "GetBar" in the header file, and the cpp file already contains the empty nested namespace block. In this situation, VA is generating the expected code:

namespace Some::Nested::Namespace
{

	Bar Foo::GetBar() const
	{

	}

}

for me. This is testing using VS2022 and VA 2568.0

zen is the art of being at one with the two'ness
Go to Top of Page
   Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000