Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 03-24-2004
damingyipai damingyipai is offline
Registered User
 
 
Join Date: Jan 2004
Posts: 59
forgot me, but I can't declare a recursion nested struct...

struct Nav; // i can not do this;
sequence<Nav> NavItems;
struct Nav{
string title;
NavItems children;
};

because the Nav has any small sub Nav, I'd like to got it by once.
somebody help me ?
thanks
Reply With Quote
  #2 (permalink)  
Old 03-24-2004
damingyipai damingyipai is offline
Registered User
 
 
Join Date: Jan 2004
Posts: 59
i can't use class, because it must create

a class object instance in server side and post a proxy to client.
I just want to send a little bit of complex data to client side.

can you enable Forward Declare a struct?

struct a;
sequence<a> as;
struct a{
as children;
}

...
nonmutating a get();
...
Reply With Quote
  #3 (permalink)  
Old 03-24-2004
mes's Avatar
mes mes is offline
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 971
You cannot forward-declare a struct, you have to use classes for this purpose:
Code:
class Nav;
sequence<Nav> NavItems;
class Nav
{
    string title;
    NavItems children;
};
You can use classes as "fancy structs", i.e., as structs with inheritance. You do not have to use classes strictly by proxies. If your classes have no operations, then you do not need to install factories for them. Take a look at the code in demo/Ice/value for an example of passing classes by value.

Take care,
- Mark
Reply With Quote
  #4 (permalink)  
Old 03-25-2004
damingyipai damingyipai is offline
Registered User
 
 
Join Date: Jan 2004
Posts: 59
Thumbs up great, thank you!

:-)
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
About return struct billwillman Help Center 7 10-16-2006 03:39 AM
Blocked by nested callback roger jin Help Center 10 07-14-2006 02:16 PM
Error using Ice.loadSlice() with nested *.ice hiasl Help Center 1 08-29-2005 08:00 AM
is there any way to use my own struct in slice? pi1ot Help Center 1 02-21-2005 12:35 AM
proxy needed for struct? gminorcoles Help Center 2 01-06-2005 03:05 PM


All times are GMT -4. The time now is 09:49 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.