Archived

This forum has been archived. Please start a new discussion on GitHub.

Identity Constructor

Hi,

I'd like to see a ctor for Ice::Identity that just takes a couple of strings. I know that there is stringToIdentity(), but it has to do a bunch of parsing for a '/' to separate the components and look for escaped characters.

If this isn't good for some reason, how about a version of stringToIdentity() that takes two arguments (one for category and one for name) to avoid the trouble of assembling the special string with a "/" in it, only to have it ripped apart again by the utility function.

I'd be happy to submit as a patch.

-- Andrew Bell
andrew.bell.ia@gmail.com

Comments

  • bernard
    bernard Jupiter, FL
    In the next Ice release, classes and exceptions will have a "one-shot" constructor to initialize all their members. We did not add such a constructor for structs (such as Ice::Identity) because we want to keep simple structs POD.

    You can use the aggregate-initialization syntax to initialize Ice-generated structs, for example:
    Ice::Identity id = {"foo", "bar"};

    Cheers,
    Bernard