1

Topic: Enum - class

Greetings in application on sales are essence an order state. And so there is table OrderState. Also it would be desirable to get enum that in the logician of application to check not so if (OrderState! = 2) and on enum as you do such things?

2

Re: Enum - class

Hello, busk, you wrote: B> in application on sales there is an essence an order state. B> and so there is table OrderState. Also it would be desirable to get enum that in the logician of application to check not so if (OrderState! = 2) and on enum Well so enum for such cases also it is invented, what confuses?

3

Re: Enum - class

Hello, busk, you wrote: B> Greetings B> in application on sales are essence an order state. B> and so there is table OrderState. Also it would be desirable to get enum that in the logician of application to check not so if (OrderState! = 2) and on enum B> as you do such things? In a C ++ 11 is enum class. And I do somehow so (attention, a C ++ 98/03!): struct State {enum t {Pending, Approved, Completed, Rejected};}; void checkOrder (State:: t state) {if (State:: Completed == state) {//...}}

4

Re: Enum - class

Hello, jazzer, you wrote: J> Hello, busk, you wrote: B>> in application on sales there is an essence an order state. B>> and so there is table OrderState. Also it would be desirable to get enum that in the logician of application to check not so if (OrderState! = 2) and on enum J> Well so enum for such cases also it is invented, what confuses? Confuses, what there is class OrderState which  on a class class OrderState {id, name} and there is enum OrderState {states} it normally? Is then the rule  can for ?

5

Re: Enum - class

Hello, okman, you wrote: O> Hello, busk, you wrote: B>> Greetings B>> in application on sales are essence an order state. B>> and so there is table OrderState. Also it would be desirable to get enum that in the logician of application to check not so if (OrderState! = 2) and on enum B>> as you do such things? O> in a C ++ 11 is enum class. O> And I do somehow so (attention, a C ++ 98/03!): O> O> struct State O> {O> enum t O> {O> Pending, O> Approved, O> Completed, O> Rejected O>}; O>}; O> void checkOrder (State:: t state) O> {O> if (State:: Completed == state) O> {O>//... O>} O>} O> the interesting approach

6

Re: Enum - class

Hello, busk, you wrote: B> as you do such things? If values enum' can be received from the DB table we under such tables generate enum' by means of T4.

7

Re: Enum - class

Hello, busk, you wrote: B> as you do such things? I do hierarchy: OrderState - - - StateAccept | | | State pending and a method handle (xxx) That as a result it is possible to tear in  necessarily. Though if something is necessary idle time I do as okman speaks - nested enum.

8

Re: Enum - class

Hello, busk, you wrote: B> confuses, what there is class OrderState which  on class B> class OrderState B> {B> id, name B>} B> and there is B> enum OrderState B> {B> states B>} B> it normally? B> is then the rule  can for ? And whether it is necessary  in code OrderState? I earlier , but then appeared? That it normally is not necessary. If it is simple to itself the list of possible values in a DB for integrity check - well let there and lives, and in the code to operate only enum th Nevertheless if nevertheless there is such coincidence it is simple enum is called somehow differently, for example OrderStateValue or somehow so, the main thing that is uniform under all project.

9

Re: Enum - class

Hello, fmiracle, you wrote: F> Hello, busk, you wrote: B>> confuses, what there is class OrderState which  on class B>> class OrderState B>> {B>> id, name B>>} B>> and there is B>> enum OrderState B>> {B>> states B>>} B>> it normally? B>> is then the rule  can for ? F> And whether it is necessary  in code OrderState? It is necessary to deduce in filters  - the text for

10

Re: Enum - class

B> confuses, what there is class OrderState which  on class B> class OrderState B> {B> id, name B>} B> and there is B> enum OrderState B> {B> states B>} B> it normally? B> is then the rule  can for ? If language we build in the declaration enum in  allows. It is possible to name  STATES. C the code  the such: if (this.state == STATES.NEW) {...} or if (order.getState () == OrderState. STATES.NEW) {...}