lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Drill-down census editor observations


From: Greg Chicares
Subject: Re: [lmi] Drill-down census editor observations
Date: Sat, 12 Dec 2015 14:13:13 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.3.0

On 2013-11-07 14:06, Václav Slavík wrote:
> On 1 Nov 2013, at 15:00, Václav Slavík <address@hidden> wrote:
>>> A. While testing various controls (i.e., textbox, radiobutton, spin 
>>>  control, etc.), I observed that the Product Name is text and not 
>>>  a drop-down list (as on the Plan tab in the GUI). This may be 
>>>  problematic to some users having to remember a products exact 
>>>  spelling and naming convention.
>> 
>> This is strange. If the Product Name is declared as an mc_enum in the model
> (which it seems to be to me), then it should be picked as such by CensusView.
> I'll investigate.
> 
> Turns out that ce_product_name (why is this the only enum that doesn't start
> with "mce_", BTW?)

To emphasize its uniqueness:

/// This class encapsulates product names. Being derived from class
/// mc_enum_base, it presents an interface compatible with other
/// enumerative classes. It differs from most enumerative classes in
/// that its valid values are knowable only at run time, so that it
/// cannot associate an enum with each value; and in that all its
/// valid values are always allowable. Otherwise, its implementation
/// is similar to that of template class mc_enum.

> was missing from reconstitutor<mc_enum_base, Input> and so the type wasn't
> recognized as  an enum, even though it derives from mc_enum_base. This patch
> fixes it:
> 
> diff --git a/input.hpp b/input.hpp
> index 495f0c0..c3a748e 100644
> --- a/input.hpp
> +++ b/input.hpp
> @@ -512,6 +512,7 @@ template<> struct reconstitutor<mc_enum_base, Input>
>      static DesiredType* reconstitute(any_member<Input>& m)
>          {
>          DesiredType* z = 0;
> +        z = exact_cast<ce_product_name         >(m); if(z) return z;
>          z = exact_cast<mce_class               >(m); if(z) return z;
>          z = exact_cast<mce_country             >(m); if(z) return z;
>          z = exact_cast<mce_dbopt               >(m); if(z) return z;

'ce_product_name' was already added nearby on 20110805T0028Z, but
this is a better place for it, so I'll apply this patch--and also
remove the corresponding line from 20110805T0028Z:

 template<> struct reconstitutor<datum_base, Input>
 {
     typedef datum_base DesiredType;
     static DesiredType* reconstitute(any_member<Input>& m)
         {
         DesiredType* z = 0;
-        z = exact_cast<ce_product_name         >(m); if(z) return z;
         z = exact_cast<datum_string            >(m); if(z) return z;
         z = reconstitutor<datum_sequence,Input>::reconstitute(m); if(z) return 
z;
         z = reconstitutor<mc_enum_base  ,Input>::reconstitute(m); if(z) return 
z;

which would otherwise become a latent defect (it would be handled
by exact_cast() before attempting conversion to mc_enum_base).

With this change, product name becomes a drop-down list in the
census manager.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]