Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 10-26-2004
teayu teayu is offline
Registered User
 
 
Join Date: Oct 2004
Posts: 4
problem in mapping string->string[] in C#

Hi guys,

I tried to generate a C# dictionaryBase impl which names stringArrayMap that maps string->string[], however, the generated code couldn't be compiled:

-----
public override bool Equals(object other)
{
if(object.ReferenceEquals(this, other))
{
return true;
}
if(!(other is StringArrayMap))
{
return false;
}
if(Count != ((StringArrayMap)other).Count)
{
return false;
}
string[] __klhs = new string[Count];
Keys.CopyTo(__klhs, 0);
_System.Array.Sort(__klhs);
string[] __krhs = new string[((StringArrayMap)other).Count];
((StringArrayMap)other).Keys.CopyTo(__krhs, 0);
_System.Array.Sort(__krhs);
for(int i = 0; i < Count; ++i)
{
if(!__klhs[i].Equals(__krhs[i]))
{
return false;
}
}
string[][] __vlhs = new string[][Count];
Values.CopyTo(__vlhs, 0);
_System.Array.Sort(__vlhs);
string[][] __vrhs = new string[][((StringArrayMap)other).Count];
((StringArrayMap)other).Values.CopyTo(__vrhs, 0);
_System.Array.Sort(__vrhs);
for(int i = 0; i < Count; ++i)
{
if(__vlhs[i] == null && __vrhs[i] != null)
{
return false;
}
if(!__vlhs[i].Equals(__vrhs[i]))
{
return false;
}
}
return true;
}
-----
the problem lies in:
string[][] __vlhs = new string[][Count];

do I have to turn to string->collection to get around that? Thanks!

Tea
Reply With Quote
  #2 (permalink)  
Old 10-26-2004
michi's Avatar
michi michi is offline
ZeroC Staff
 
Name: Michi Henning
Organization: ZeroC
Project: Ice
 
Join Date: Feb 2003
Location: Brisbane, Australia
Posts: 912
Re: problem in mapping string->string[] in C#

Quote:
Originally posted by teayu
Hi guys,

I tried to generate a C# dictionaryBase impl which names stringArrayMap that maps string->string[], however, the generated code couldn't be compiled:

-----
string[][] __vlhs = new string[][Count];
Values.CopyTo(__vlhs, 0);
_System.Array.Sort(__vlhs);
string[][] __vrhs = new string[][((StringArrayMap)other).Count];
-----
the problem lies in:
string[][] __vlhs = new string[][Count];
You are right, that's a bug. This should read:
Code:
	    string[][] __vlhs = new string[Count][];
	    Values.CopyTo(__vlhs, 0);
	    _System.Array.Sort(__vlhs);
	    string[][] __vrhs = new string[((StringArrayMap)other).Count][];
Quote:
do I have to turn to string->collection to get around that?
For the moment, that will get you off the hook. I'll post a patch to fix this later today. Thanks for the bug report!

Cheers,

Michi.
Reply With Quote
  #3 (permalink)  
Old 10-27-2004
michi's Avatar
michi michi is offline
ZeroC Staff
 
Name: Michi Henning
Organization: ZeroC
Project: Ice
 
Join Date: Feb 2003
Location: Brisbane, Australia
Posts: 912
I've posted a patch for this problem at Patch #2 for slice2cs, release 1.5.1.

Cheers,

Michi.
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
how to realize string to object in ice? rellik78 Help Center 1 09-20-2006 08:07 AM
std::string in interface dthompson Help Center 1 06-21-2006 05:49 PM
Casting char* to std::string inmmat Help Center 5 06-10-2006 02:43 PM
Link problem using a string to class map MKoleoso Help Center 2 07-03-2005 12:02 PM
problem with string sequences alexs Bug Reports 4 01-27-2004 11:28 AM


All times are GMT -4. The time now is 06:34 PM.


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.