"if(hasProperty) getProperty else" is 2 trips, either which or try/catch
seems a Programming Model which could be further simplified such as

const Property _*_ getProperty (const std::string* propertyName) const

or

const Property _*_ getProperty (const QName& propertyName) const

On the other hand, getPropertyIndex also throws exception which could return
-1/MAX_INT instead.
The Java counterpart has specified less exception to make a easier
Programming Model, maybe C++ spec can consider that too.

On 1/11/07, Pete Robbins <[EMAIL PROTECTED]> wrote:

On 11/01/07, Adriano Crestani <[EMAIL PROTECTED]> wrote:
>
> Thanks Pete, I thought there would be an easier way to do this. But if
you
> say so, I think it's the only way. Thanks again!


That is what is in the spec. Maybe we could propose a bool
Type::hasProperty(std::string propertyName); method

Cheers,

Adriano Crestani
>
> On 1/10/07, Pete Robbins <[EMAIL PROTECTED]> wrote:
> >
> > On 10/01/07, Adriano Crestani <[EMAIL PROTECTED]> wrote:
> > >
> > > I'm begginer with C++ and I have one doubt about the function
defined
> in
> > > Type.h: "virtual SDO_API const Property& getProperty(const char*
> > > propertyName)  const = 0". It's supposed to return a reference to a
> > > Property
> > > object that has the name equal to the parameter propertyName, but if
> > there
> > > is no Property object with this name? What does this function
return?
> >
> >
> > It would through a SDOPropertyNotFoundException.
> >
> > I tried to do this...
> > >
> > > if (type.getProperty("ID") == NULL)
> > >
> > > ...but as long as far as I know it's not possible. Is there a way to
> > check
> > > if the function has found Property object with the specified name or
> > not.
> > >
> > > Adriano Crestani
> >
> >
> >
> > There is no easy way to do this. You would need to wrap the
getProperty
> in
> > a
> > try/catch block.
> >
> > Cheers,
> >
> > --
> > Pete
> >
> >
>
>


--
Pete




--

Yang ZHONG

Reply via email to