QUSIR / staff

Automatically exported from code.google.com/p/staff
Apache License 2.0
0 stars 0 forks source link

According to *.proto file, init the enum type is wrong in the interface file. #177

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Creating the protobuf file:
  message OnlineUserState {
    required uint64 user_id = 1;
    enum LoginType {
    OPT_CLIENT = 1; 
    CFG_CLIENT = 2; 
    EXT_CLIENT = 3; 
    MGR_CLIENT = 4; 
     }
    required LoginType login_type = 2 [default = OPT_CLIENT];
 }
2.Generate the staff interface:
  staff_codegen -tinterface -pprotobuf -drootns=test ProtoCalc.proto
3.The interface file ProtoCale.h as follow:
namespace cspws
{
namespace csp
{
namespace user
{
  struct OnlineUserState
  {
    enum LoginType
    {
      OPT_CLIENT = 1,
      CFG_CLIENT = 2,
      EXT_CLIENT = 3,
      MGR_CLIENT = 4
    };

    long user_id;
    LoginType login_type; 

    OnlineUserState():
      login_type(::cspws::csp::user::OPT_CLIENT)
    {
    }
  };
}
}
}

What is the expected output? What do you see instead?
The result of compile is wrong, becanse it can't find the "OPT_CLIENT", 
the right is "::cspws::csp::user::OnlineUserState::OPT_CLIENT";

What version of the product are you using? On what operating system?

staff_codegen version 1.99.1-r686 ; windows xp ;

Please provide any additional information below.

Original issue reported on code.google.com by bingqing...@gmail.com on 14 Aug 2012 at 5:46

GoogleCodeExporter commented 9 years ago
At the same time,the user_id type is wrong. In the *.proto, the user_id type 
is uint64, but in the interface file, the type is long.

Original comment by bingqing...@gmail.com on 14 Aug 2012 at 6:02

GoogleCodeExporter commented 9 years ago
Regarding uint64: Staff does not support it. In this case it should be 
{{{unsigned long long}}}.

Original comment by loentar on 14 Aug 2012 at 6:47

GoogleCodeExporter commented 9 years ago

Original comment by loentar on 14 Aug 2012 at 6:48

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r699.

Original comment by loentar on 14 Aug 2012 at 7:13

GoogleCodeExporter commented 9 years ago
Regarding issue 177:
If define the enum type "LoginType" in the struct "OnlineUserState" external.
The protobuf code as follow:
  enum LoginType {
    OPT_CLIENT = 1; 
    CFG_CLIENT = 2; 
    EXT_CLIENT = 3; 
    MGR_CLIENT = 4; 
     }
  message OnlineUserState {
    required uint64 user_id = 1;
    required LoginType login_type = 2 [default = OPT_CLIENT];
 }
The staff interface file as follow:
OnlineUserState():
      login_type(::cspws::csp::user::OnlineUserState::OPT_CLIENT)
    {
    }
But the expected output as follow:
OnlineUserState():
      login_type(::cspws::csp::user::OPT_CLIENT)
    {
    }

Original comment by bingqing...@gmail.com on 14 Aug 2012 at 9:16

GoogleCodeExporter commented 9 years ago
Agree, will fix it soon.

Original comment by loentar on 14 Aug 2012 at 10:06

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r704.

Original comment by loentar on 14 Aug 2012 at 10:30

GoogleCodeExporter commented 9 years ago
Today. Thank you very much for your help.

Original comment by bingqing...@gmail.com on 14 Aug 2012 at 10:42