user_defined_members problem

Tom Widmer
2003-07-03
2013-04-29
  • Tom Widmer

    Tom Widmer - 2003-07-03

    Passing true as the last argument to PeerGenerator causes the #include statement to be inserted inside the end of the Peer class, to allow user defined members. However, this isn't very useful, since you can't add user defined members of arbitrary types, because you have to way of adding extra #includes to the top of the peer header.

    So you need an extra #include at the top of the generated file to allow user includes (such as, say:
    //user_includes.h
    #include <map>
    #include <MyType.h>

    Obviously, the work around is to use the pimpl idiom in your C++ code, or to only use PeerGenerator once, and then make any extra changes manually (which can cause maintenance problems of course, if the peer class changes).

    Tom

     
    • Toby Reyelts

      Toby Reyelts - 2003-07-07

      Is there some reason why you just can't add #includes to user_defined_members? I can't think of a reason why they'd have to appear before anything else in the header.

      God bless,
      -Toby Reyelts

       
    • Michael Rosinus

      Michael Rosinus - 2003-12-09

      In VisualC 7, I need to add a member function to a generated Peer class. I added the following line to the *_user.h file:

      CComSafeArray<VARIANT> prepareArguments(::jace::JArray< ::jace::proxy::java::lang::Object > jParams);

      Doing so, I have to add

      #include "atlsafe.h"

      in the "*_user.h" file, too. This however breaks the compilation:

      c:Microsoft Visual Studio .NETVc7includemalloc.h(36) : error C2059: syntax error : 'string'
      c:Microsoft Visual Studio .NETVc7includemalloc.h(36) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
      ...

      When I add the "#include at" the beginning of the generated *.h file, the compiler runs properly.

      Cheers, Michael

       
    • - 2005-01-25

      Submitted a patch 1108819 to work around the problem.

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks