Results 1 to 2 of 2

Thread: Identity Constructor

  1. #1
    acbell is offline Registered User
    Name: Andrew Bell
    Organization: Iowa State University
    Project: National Resources Inventory
    Join Date
    Jan 2005
    Location
    Ames, IA, USA
    Posts
    89

    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

  2. #2
    bernard's Avatar
    bernard is offline ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 7
    Last Post: 07-16-2007, 02:17 AM
  2. derived constructor generation bug in slice2cpp
    By bpolivka in forum Bug Reports
    Replies: 3
    Last Post: 03-02-2006, 09:42 AM
  3. Replies: 2
    Last Post: 02-13-2006, 11:45 AM
  4. Passing parameters to constructor
    By jacopo in forum Help Center
    Replies: 2
    Last Post: 05-12-2005, 12:47 PM
  5. Constructor and Default-Parameter
    By Mr.Freeze in forum Help Center
    Replies: 1
    Last Post: 08-13-2003, 07:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •