Enum serialization

I take an error trying serialize a member in document class of type enum...
 binary '>>' : no operator found which takes a right-hand operand of type 
'Elementi' (or there is no acceptable conversion)

where i defined

enum Elementi{Line,Rectangles,Circle,Curve,TEXT};

enum Elementi m_element;

and for example m_element = Line;

so in serialize doc function i have in my serialize function...

if (ar.IsStoring())
{
ar << m_color // Store the current color
<< m_element // the current element type,  !!!THIS LINE GIVES NO ERROR!!!
<< m_PenWidth // and the current pen width
<< m_DocSize; // and the current document size
}
else
{
ar >> m_color // Retrieve the current color
>> m_element // the current element type,  !!!ERROR IN THIS LINE!!!
>> m_PenWidth // and the current pen width
>> m_DocSize; // and the current document size


Maybe i should implement a personalized operator overload for >> ?
And how should i implement that?And where?
Why << operator doesn't give me the error and works fine? 

0
marco1036 (1)
9/26/2007 8:02:57 PM
vc.mfc 33608 articles. 0 followers. Follow

5 Replies
712 Views

Similar Articles

[PageSpeed] 27

enum is a "short" type, so all you have to do is cast your enum value to 
short while serializing, and from short to enum while deserializing.

if (ar.IsStoring())
  ar << (short)m_element;
else
{
  short value;
  ar >> value;
  m_element = (Elementi)value;
}

You can also add an overloaded << or >> operator to your class that is 
derived from CArchive:

class CMyArchive : public CArchive
{
public:
    CMyArchive& operator << ( const Elementi& value )
    {
        CArchive::operator << ((short)value);
        return *this;
    }

    CMyArchive& operator >> ( Elementi& value )
    {
        short shValue;
        CArchive::operator >> (shValue);
        value = (Elementi)shValue;
        return *this;
    }
};

redefine the document's Serialize() as

void CMyDoc::Serialize( CMyArchive& ar )

But this looks like a hassle...


"Marco Biagioni" <marco1036@interfree.it> wrote in message 
news:AF23362B-3C33-451E-90C8-8CBD4E30AB33@microsoft.com...
>I take an error trying serialize a member in document class of type enum...
> binary '>>' : no operator found which takes a right-hand operand of type 
> 'Elementi' (or there is no acceptable conversion)
>
> where i defined
>
> enum Elementi{Line,Rectangles,Circle,Curve,TEXT};
>
> enum Elementi m_element;
>
> and for example m_element = Line;
>
> so in serialize doc function i have in my serialize function...
>
> if (ar.IsStoring())
> {
> ar << m_color // Store the current color
> << m_element // the current element type,  !!!THIS LINE GIVES NO ERROR!!!
> << m_PenWidth // and the current pen width
> << m_DocSize; // and the current document size
> }
> else
> {
> ar >> m_color // Retrieve the current color
>>> m_element // the current element type,  !!!ERROR IN THIS LINE!!!
>>> m_PenWidth // and the current pen width
>>> m_DocSize; // and the current document size
>
>
> Maybe i should implement a personalized operator overload for >> ?
> And how should i implement that?And where?
> Why << operator doesn't give me the error and works fine? 


0
9/27/2007 12:44:47 AM
Yep, and this is deliberate.  enum is implementation-specific and therefore is
non-portable and therefore cannot be serialized.  So you can cast it to a DWORD, for
example, to write it out, and cast the DWORD back to an enum type on input.
					joe
On Wed, 26 Sep 2007 22:02:57 +0200, "Marco Biagioni" <marco1036@interfree.it> wrote:

>I take an error trying serialize a member in document class of type enum...
> binary '>>' : no operator found which takes a right-hand operand of type 
>'Elementi' (or there is no acceptable conversion)
>
>where i defined
>
>enum Elementi{Line,Rectangles,Circle,Curve,TEXT};
>
>enum Elementi m_element;
>
>and for example m_element = Line;
>
>so in serialize doc function i have in my serialize function...
>
>if (ar.IsStoring())
>{
>ar << m_color // Store the current color
><< m_element // the current element type,  !!!THIS LINE GIVES NO ERROR!!!
><< m_PenWidth // and the current pen width
><< m_DocSize; // and the current document size
>}
>else
>{
>ar >> m_color // Retrieve the current color
>>> m_element // the current element type,  !!!ERROR IN THIS LINE!!!
>>> m_PenWidth // and the current pen width
>>> m_DocSize; // and the current document size
>
>
>Maybe i should implement a personalized operator overload for >> ?
>And how should i implement that?And where?
>Why << operator doesn't give me the error and works fine? 
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
9/27/2007 5:20:12 AM
No, enum is NOT a "short" type.  According to Harbison & Steele, 

5.11.1 Enumeration Compatibility

Each enumerated type definition gives rise to a new integral type.  ISO C requires each
enumerated type to be compatible with the implementation-defined integer type that
represents it.  The compatible integer type may be different for different enumerations in
ths ame program.  The composite type is the enumerated type. No two different enumerated
types defined in the same source file are compatible.

So I can perfectly well write

typedef enum {zero=0, big=0x7FFFFFFF, small=0x80000000 }

which would not fit a "short" but would definitely be a valid enum.  In fact, it would be
an error to cast an enum to a short.
						joe
On Wed, 26 Sep 2007 17:44:47 -0700, "Ashot Geodakov" <a_geodakov@nospam.hotmail.com>
wrote:

>enum is a "short" type, so all you have to do is cast your enum value to 
>short while serializing, and from short to enum while deserializing.
>
>if (ar.IsStoring())
>  ar << (short)m_element;
>else
>{
>  short value;
>  ar >> value;
>  m_element = (Elementi)value;
>}
>
>You can also add an overloaded << or >> operator to your class that is 
>derived from CArchive:
>
>class CMyArchive : public CArchive
>{
>public:
>    CMyArchive& operator << ( const Elementi& value )
>    {
>        CArchive::operator << ((short)value);
>        return *this;
>    }
>
>    CMyArchive& operator >> ( Elementi& value )
>    {
>        short shValue;
>        CArchive::operator >> (shValue);
>        value = (Elementi)shValue;
>        return *this;
>    }
>};
>
>redefine the document's Serialize() as
>
>void CMyDoc::Serialize( CMyArchive& ar )
>
>But this looks like a hassle...
>
>
>"Marco Biagioni" <marco1036@interfree.it> wrote in message 
>news:AF23362B-3C33-451E-90C8-8CBD4E30AB33@microsoft.com...
>>I take an error trying serialize a member in document class of type enum...
>> binary '>>' : no operator found which takes a right-hand operand of type 
>> 'Elementi' (or there is no acceptable conversion)
>>
>> where i defined
>>
>> enum Elementi{Line,Rectangles,Circle,Curve,TEXT};
>>
>> enum Elementi m_element;
>>
>> and for example m_element = Line;
>>
>> so in serialize doc function i have in my serialize function...
>>
>> if (ar.IsStoring())
>> {
>> ar << m_color // Store the current color
>> << m_element // the current element type,  !!!THIS LINE GIVES NO ERROR!!!
>> << m_PenWidth // and the current pen width
>> << m_DocSize; // and the current document size
>> }
>> else
>> {
>> ar >> m_color // Retrieve the current color
>>>> m_element // the current element type,  !!!ERROR IN THIS LINE!!!
>>>> m_PenWidth // and the current pen width
>>>> m_DocSize; // and the current document size
>>
>>
>> Maybe i should implement a personalized operator overload for >> ?
>> And how should i implement that?And where?
>> Why << operator doesn't give me the error and works fine? 
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
9/27/2007 5:25:13 AM
Oops, sorry, my bad...

Just never saw enums with larger than "short" range of enumerators or 
values. In fact, they all could fit in a single byte. Hence, forgot all 
about theory.

I've never seen samples similar to yours. What would such bizarre values be 
used for, binary aritmetics?

"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
news:mcfmf3dt574412ivifalopii81klorjrcp@4ax.com...
> No, enum is NOT a "short" type.  According to Harbison & Steele,
>
> 5.11.1 Enumeration Compatibility
>
> Each enumerated type definition gives rise to a new integral type.  ISO C 
> requires each
> enumerated type to be compatible with the implementation-defined integer 
> type that
> represents it.  The compatible integer type may be different for different 
> enumerations in
> ths ame program.  The composite type is the enumerated type. No two 
> different enumerated
> types defined in the same source file are compatible.
>
> So I can perfectly well write
>
> typedef enum {zero=0, big=0x7FFFFFFF, small=0x80000000 }
>
> which would not fit a "short" but would definitely be a valid enum.  In 
> fact, it would be
> an error to cast an enum to a short.
> joe
> On Wed, 26 Sep 2007 17:44:47 -0700, "Ashot Geodakov" 
> <a_geodakov@nospam.hotmail.com>
> wrote:
>
>>enum is a "short" type, so all you have to do is cast your enum value to
>>short while serializing, and from short to enum while deserializing.
>>
>>if (ar.IsStoring())
>>  ar << (short)m_element;
>>else
>>{
>>  short value;
>>  ar >> value;
>>  m_element = (Elementi)value;
>>}
>>
>>You can also add an overloaded << or >> operator to your class that is
>>derived from CArchive:
>>
>>class CMyArchive : public CArchive
>>{
>>public:
>>    CMyArchive& operator << ( const Elementi& value )
>>    {
>>        CArchive::operator << ((short)value);
>>        return *this;
>>    }
>>
>>    CMyArchive& operator >> ( Elementi& value )
>>    {
>>        short shValue;
>>        CArchive::operator >> (shValue);
>>        value = (Elementi)shValue;
>>        return *this;
>>    }
>>};
>>
>>redefine the document's Serialize() as
>>
>>void CMyDoc::Serialize( CMyArchive& ar )
>>
>>But this looks like a hassle...
>>
>>
>>"Marco Biagioni" <marco1036@interfree.it> wrote in message
>>news:AF23362B-3C33-451E-90C8-8CBD4E30AB33@microsoft.com...
>>>I take an error trying serialize a member in document class of type 
>>>enum...
>>> binary '>>' : no operator found which takes a right-hand operand of type
>>> 'Elementi' (or there is no acceptable conversion)
>>>
>>> where i defined
>>>
>>> enum Elementi{Line,Rectangles,Circle,Curve,TEXT};
>>>
>>> enum Elementi m_element;
>>>
>>> and for example m_element = Line;
>>>
>>> so in serialize doc function i have in my serialize function...
>>>
>>> if (ar.IsStoring())
>>> {
>>> ar << m_color // Store the current color
>>> << m_element // the current element type,  !!!THIS LINE GIVES NO 
>>> ERROR!!!
>>> << m_PenWidth // and the current pen width
>>> << m_DocSize; // and the current document size
>>> }
>>> else
>>> {
>>> ar >> m_color // Retrieve the current color
>>>>> m_element // the current element type,  !!!ERROR IN THIS LINE!!!
>>>>> m_PenWidth // and the current pen width
>>>>> m_DocSize; // and the current document size
>>>
>>>
>>> Maybe i should implement a personalized operator overload for >> ?
>>> And how should i implement that?And where?
>>> Why << operator doesn't give me the error and works fine?
>>
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm 


0
9/27/2007 7:31:43 AM
Techniques like this are often used when you need to interface to some external
specification, for example

"The value for this field in the data packet is either 0x80000000 indicating the
subsequent fields are not specified, 0x7FFFFFF meaning all subsequent fields are defined,
or 0x0 meaning you must determine the individual fields are specified with a type and
length", so a programmer might choose to represent these as enum types.
						joe

On Thu, 27 Sep 2007 00:31:43 -0700, "Ashot Geodakov" <a_geodakov@nospam.hotmail.com>
wrote:

>Oops, sorry, my bad...
>
>Just never saw enums with larger than "short" range of enumerators or 
>values. In fact, they all could fit in a single byte. Hence, forgot all 
>about theory.
>
>I've never seen samples similar to yours. What would such bizarre values be 
>used for, binary aritmetics?
>
>"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
>news:mcfmf3dt574412ivifalopii81klorjrcp@4ax.com...
>> No, enum is NOT a "short" type.  According to Harbison & Steele,
>>
>> 5.11.1 Enumeration Compatibility
>>
>> Each enumerated type definition gives rise to a new integral type.  ISO C 
>> requires each
>> enumerated type to be compatible with the implementation-defined integer 
>> type that
>> represents it.  The compatible integer type may be different for different 
>> enumerations in
>> ths ame program.  The composite type is the enumerated type. No two 
>> different enumerated
>> types defined in the same source file are compatible.
>>
>> So I can perfectly well write
>>
>> typedef enum {zero=0, big=0x7FFFFFFF, small=0x80000000 }
>>
>> which would not fit a "short" but would definitely be a valid enum.  In 
>> fact, it would be
>> an error to cast an enum to a short.
>> joe
>> On Wed, 26 Sep 2007 17:44:47 -0700, "Ashot Geodakov" 
>> <a_geodakov@nospam.hotmail.com>
>> wrote:
>>
>>>enum is a "short" type, so all you have to do is cast your enum value to
>>>short while serializing, and from short to enum while deserializing.
>>>
>>>if (ar.IsStoring())
>>>  ar << (short)m_element;
>>>else
>>>{
>>>  short value;
>>>  ar >> value;
>>>  m_element = (Elementi)value;
>>>}
>>>
>>>You can also add an overloaded << or >> operator to your class that is
>>>derived from CArchive:
>>>
>>>class CMyArchive : public CArchive
>>>{
>>>public:
>>>    CMyArchive& operator << ( const Elementi& value )
>>>    {
>>>        CArchive::operator << ((short)value);
>>>        return *this;
>>>    }
>>>
>>>    CMyArchive& operator >> ( Elementi& value )
>>>    {
>>>        short shValue;
>>>        CArchive::operator >> (shValue);
>>>        value = (Elementi)shValue;
>>>        return *this;
>>>    }
>>>};
>>>
>>>redefine the document's Serialize() as
>>>
>>>void CMyDoc::Serialize( CMyArchive& ar )
>>>
>>>But this looks like a hassle...
>>>
>>>
>>>"Marco Biagioni" <marco1036@interfree.it> wrote in message
>>>news:AF23362B-3C33-451E-90C8-8CBD4E30AB33@microsoft.com...
>>>>I take an error trying serialize a member in document class of type 
>>>>enum...
>>>> binary '>>' : no operator found which takes a right-hand operand of type
>>>> 'Elementi' (or there is no acceptable conversion)
>>>>
>>>> where i defined
>>>>
>>>> enum Elementi{Line,Rectangles,Circle,Curve,TEXT};
>>>>
>>>> enum Elementi m_element;
>>>>
>>>> and for example m_element = Line;
>>>>
>>>> so in serialize doc function i have in my serialize function...
>>>>
>>>> if (ar.IsStoring())
>>>> {
>>>> ar << m_color // Store the current color
>>>> << m_element // the current element type,  !!!THIS LINE GIVES NO 
>>>> ERROR!!!
>>>> << m_PenWidth // and the current pen width
>>>> << m_DocSize; // and the current document size
>>>> }
>>>> else
>>>> {
>>>> ar >> m_color // Retrieve the current color
>>>>>> m_element // the current element type,  !!!ERROR IN THIS LINE!!!
>>>>>> m_PenWidth // and the current pen width
>>>>>> m_DocSize; // and the current document size
>>>>
>>>>
>>>> Maybe i should implement a personalized operator overload for >> ?
>>>> And how should i implement that?And where?
>>>> Why << operator doesn't give me the error and works fine?
>>>
>> Joseph M. Newcomer [MVP]
>> email: newcomer@flounder.com
>> Web: http://www.flounder.com
>> MVP Tips: http://www.flounder.com/mvp_tips.htm 
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
9/27/2007 4:58:49 PM
Reply:

Similar Artilces:

OT: Enum validation...
....are there any little tricks I've not heard of/thought of for validating enums? Example: enum MessageType { COMMAND, QUERY, EVENT, RESPONSE }; Now, you can simply check to see if the value is less than COMMAND or more than RESPONSE, but this is inflexible and adding an enum means forcing that new enum to be between those two values or to change the validation code. You could also put two 'unused' enums such as START and END (or equivalent meaning terms) around each of the valid enums and validate that way, but that seems clunky. I could presume that sin...

Xml Serialization the same class may have multiple namespaces
Hi, Not 100% sure if this is the correct group to post in but. I have a class that I want to serialize/deserialize to match the MM7 specifications, which I have done but now that we are starting to connect to a few different people we have realised that there are multiple versions of the specification and each one has been defined in a different namespace, now the actual xml is the same between the versions example : Release 6 version 1. 4 <?xml version="1.0"?> <Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/20...

Restrict OMA access with IMEI (mobile serial number)
Is it possible to restrict OMA access only from the user's mobile phone with the IMEI number (mobile serial number) ? Thank you, Xavier "Xavier Coppin" <xavier@coppin.net> wrote: >Is it possible to restrict OMA access only from the user's mobile phone with >the IMEI number (mobile serial number) ? > >Thank you, > >Xavier > Exchange has no visibility of the IMEI number Mark Arnold MCSA MCSE+M MVP, mark@mvps.org FAQ: http://www.swinc.com/resource/exchange.htm & http:http://www.swinc.com/resource/e2kfaq.htm Thank you for your quick reply ! ...

Need to use .NET 2005 MFC for Serial Communication
All: I need to use .NET 2005 MFC to read and write data via serial port. Is there available class and example I can reference? Thank you in advance awu10 ...

ActiveX: Enum in odl file
Hi All, I created a simple activeX and wrote a simple enum in the odl file under the Library tag and it gave me an error: enum ActiveScanner { asScanner600, asScanner800, asScanner1000 }; Error: error MIDL2313 : illegal definition, must use typedef in mktyplib compatibility mode : [ Enum 'ActiveScanner' ] How can i define the enum in the odl? The reason for it is that i want to declare a property with a specific set of values. A developer which uses the activeX and access this property will get the available values (intelliSense). I found the answer and it simple need to c...

soap serialization problems
Hello I am having problems with a very simple serialization :( I download the schema http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-0 and execute the xsd.exe for create the classes. I load the file created in my project but when I try to serialize... '------------------------------------------- Dim reqSubmit As New submitReqType Dim fs As New MemoryStream Dim formatter As New SoapFormatter formatter.Serialize(fs, reqSubmit) Console.WriteLine(System.Text.Encoding.Default.GetString(fs.ToArray)) fs.Close() '--------------------------------------...

XML Serialization and references?
Say I have a data class: class Data { public List<SubData> SubDataList1 { get ... set ... } public List<Subdata> SubDataList2 { get ... set ... } } It's possible that a specific SubData instance is in SubDataList1 as well as SubDataList2. When I serialize a Data instance, said SubData instance is written to the XML file twice. After deserialization I have two different objects instead of one that's in both lists. How can I change this? I guess there'd have to be some support for serialization of object references, where a reference to the same SubData inst...

Fixed Assets Serial Number Field #2
Combination of Manufacturer Name & Serial Numbers are unique indentifiers to identify assets. When creating FA IDs, currently there is no way to prevent duplicate serial numbers; an Asset can accidentally be created more than once with the same serial number. I would like to suggest making the Serial Number a unique field or giving users a prompt to tell them that this number already exists and if they still want to continue. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click t...

Enums with Or / And
I've read about bitwise combinations but not much experience using them Formerly i had 3 options buttons so only one could be set at a time ' If Me.opSetting.Value = True Then ' mlSelectedType = DIMTYPE.Setting ' ElseIf Me.opTicket.Value = True Then ' mlSelectedType = DIMTYPE.ISO ' ElseIf Me.opEllipse.Value = True Then ' mlSelectedType = DIMTYPE.Ellipse ' End If now i want to change them to 3 checkboxes so they can be combined...so... if my enum is like: Public Enum DIMTYPE Setting = 1 ISO = 2 Ellipse = ...

Serial worker thread help
I have a serial worker thread that works with COM-DRV++(serial wrapper) below. This worked fine until I needed it to work under Vista. I have switched to the CreateFile(), ReadFile(), WriteFile() methods. UINT SerialThread( LPVOID Param ) //Thread to monitor serial activity { HWND hDlg = (HWND)Param; int DataByte=0x00; int Count=0; int i; while(TRUE){ Count=0; while(Count == 0){ Count = Port.BytesInReceiveBuffer(); Sleep(50); } DataByte=Port.GetByte(18); if (DataByte == 0x10){ for (i=0; i<33; i++){ DataByte=Port.GetByte(18); ...

serialize an XML file
Hi, I have an XML like this: <ArrayOfFormName> <FormName name="name1"> <label name="label1"> <IT>Italian text for label1</IT> <EN>English text for label1</EN> </label> <label name="label2"> <IT>Italian text for label2</IT> <EN>English text for label2</EN> </label> </FormName> <FormName name="name2"> <label name="label1"> ...

questin about enum all threads of a process
Hi all: I know I can enum the threads of a process using toolhelper lib in win2k or win9x. but the lib is not availble at Winnt. instead of toolhelper, microsoft supply the performance data library, but the data struct is too complex. Can I have another way to get all threads handle of a process? Thank advance. sincecely ...

Enum serialization
I take an error trying serialize a member in document class of type enum... binary '>>' : no operator found which takes a right-hand operand of type 'Elementi' (or there is no acceptable conversion) where i defined enum Elementi{Line,Rectangles,Circle,Curve,TEXT}; enum Elementi m_element; and for example m_element = Line; so in serialize doc function i have in my serialize function... if (ar.IsStoring()) { ar << m_color // Store the current color << m_element // the current element type, !!!THIS LINE GIVES NO ERROR!!! << m_PenWidth // and the cu...

Post-serialization processing
Hello. I need to do some processing (updating some windows captions, populating a list box, etc.) after the user has de-serialized (loaded) a document from disk. I need to be sure the de-serialization process is complete before doing the updating since some of the updating is based on data that ia being de-serialized. Where is the best place to do this...OnOpenDocument? Thanks in advance! >Hello. I need to do some processing (updating some >windows captions, populating a list box, etc.) after the >user has de-serialized (loaded) a document from disk. I >need to be sur...

accessing ActiveX control enums in MFC
I have an ActiveX contol whose tlb (using OLE/COM viewer) shows // There are a couple of more of these, but this is typical example typedef enum { RF_MCS86 = 1, RF_BINARY = 2, RF_ASCII_BINARY = 3 } EROMFormat; This enum is accessed from another function from within the control as STDMETHOD Func(SAFEARRAY **Ptr, EROMFormat Fmt, Long * Retval) I have dropped the control onto my form and MFC has generated the wrappers for the methods except for the ones having SAFEARRAY arguments Now, not only does MFC not generate the function because of the familiar // method &...

#import ignores enums?
Sorry for the cross-post, but I have absolutely no idea which newsgroup this question should go into ... I have a DLL that I am creating in C++, using the Microsoft attributed stuff, and it contains an enum like this in my H file: [export] enum eInterfaces { eDoodad = 1, eFlipper = 2 }; and then I have an entry in my __interface that looks like this : [propget, id(23), helpstring("property Interface")] HRESULT Interface([out, retval] enum eInterfaces* pVal); The compiler creates an IDL file with the same values in it. But when I #import that DLL into my EXE, the resulting TL...

Problem with serialization of DefaultValueAttribute
Hello: I have generated a c# proxy (client) from the WSDL. One of the class has a defaultValueAtribute. Like so: public class PersonInformationLoadRequest { [System.Xml.Serialization.XmlAttributeAttribute()] public string DataSource; [System.Xml.Serialization.XmlAttributeAttribute()] public string Sequence; [System.Xml.Serialization.XmlAttributeAttribute()] [System.ComponentModel.DefaultValueAttribute("Load")] public string Action = "Load"; } When this class gets serialized to XML request, the attribute of the e...

Enum problem
I created a spreadsheet with a Module. Inside the module, there is a statement as follows: Public Enum ezFormState Quote = 1 Revision = 2 PO = 3 End Enum This works fine on a Win2k system with Excel 2K/XP. However, on another system, which is running Windows 98, it doesn't run at all. It quits with an error message highlighting the Enum statement. I forgot to email the exact message to myself and I won't be able to get to it until tomorrow. Hoping someone might have a quick answer. In the meantime, I'll search google. Thank you in advance. -- Jim Carlock http://www.mic...

XmlSerializer for single level serialization of objects ?
Ok the XmlSerializer is nice for my need. BUT I what I need (maybe the XmlSerializer isnt what I need) is to be able to take the following objects A Person who has a collection of Addresses Person (fname) (lname) Address (Street) (City) (State) (Zip) And Serialize the Person object Seperatly from the Addresses. What is the best way to do this ? Inverse recursion ? What I would like in the end are 2 strings, 1 representing the Person and 1 representing the address. If there were 2 addresses then 3 strings, 1 for the person, and 1 for EACH address. Thanks Chris Hi...

enum desirialization
Hi, I have an enum, defined as follows: public enum Flags { ON = 0, OFF = 1 } I want the following xml to be deserialized into that enum, without an exception (I want the resulted enum to get the value ON by default): <Flags>2</Flags> <Flags>4</Flags> etc. What can I do? Thanks ...

Some more about serialization
Hi! I'm reading a book from Microsoft Press(MCTS). It says *If you just needed to store a single string in a file, you wouldn't need to use serialization you could simply write the string directly to a text file. Serialization becomes useful when storing more complex information, such as the current date and time. As the following code sample demonstates, serializing complex objects is as simple as serializing a string." Can anybode tell me the reason why to use serialization when I want to store current date and time as the text above claims when it's even...

Great Plains Suggestion: Need to increase the lenght of inventory item serial number field
Currently the inventory item serial number field is 20 characters lenght. Some computer products currently have up to 35 digits at serial number. It could be nice to increase the field to 40 or 50 characters. Regards, Takashi Arikuma ...

Serializing a collection
Hi I am trying to serialize a collection of GUIDs by overriding the serialize function on a diagram component I am using. The following code sucessfully serializes a single GUID: Public Overloads Overrides Function Serialize(ByVal Key As Object) As String Dim objXML As New XmlDocument Dim objParent As XmlElement objParent = objXML.CreateElement("InteractionShape") objParent.SetAttribute("InteractionGUID", _ m_InteractionGUID.ToString) <-----change to collection objParent.InnerXml = MyB...

Serialize #2
Compile: VisualC .NET 2003 At me a problem: class CDataSpect : public CObject { DECLARE_SERIAL(CDataSpect); (..skip...) public: void Serialize(CArchive& ar); private: double amplitude[8001]; (..skip..) } CDataSpect::Serialize(CArchive& ar) { CObject::Serialize(ar); if(ar.IsStoring()) { //write ar << amplitude << (..skip..); // Warning } else { // Read ar >> amplitude >> (..skip..); // Error } } The following statement: > ar << amplitude << (..skip..); // Warning will archive the 'address' of the vector. If y...

inheriting from Enum
Hello! Do any class inherit from Enum ? Can you mention anyone. //Tony Tony Johansson wrote: > Hello! > > Do any class inherit from Enum ? > Can you mention anyone. > > //Tony > > > All enums inherit from System.Enum, but you can't derive a class from it yourself. -- Willem van Rumpt Tony Johansson wrote: > Hello! > > Do any class inherit from Enum ? > Can you mention anyone. All "enum" types inherit from System.Enum. All value types are sealed and thus cannot be further inherited. This ...