forked from connamara/quickfixn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
connamara#760 Support unsigned 64-bit integers for sequence numbers
- Loading branch information
Showing
15 changed files
with
362 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
| ||
namespace QuickFix.Fields.Converters | ||
{ | ||
/// <summary> | ||
/// convert UInt64 to/from string | ||
/// </summary> | ||
public static class SequenceConverter | ||
{ | ||
/// <summary> | ||
/// Converts sequence number string to ulong. | ||
/// </summary> | ||
/// <param name="i"></param> | ||
/// <returns></returns> | ||
public static ulong Convert(string i) | ||
{ | ||
try | ||
{ | ||
if ((null == i) || (i.Length < 1)) | ||
throw new FieldConvertError("The argument string cannot be null or empty"); | ||
|
||
return System.Convert.ToUInt64(i); | ||
} | ||
catch (System.FormatException e) | ||
{ | ||
throw new FieldConvertError("Could not convert string to unsigned long (" + i + ")", e); | ||
} | ||
catch (System.OverflowException e) | ||
{ | ||
throw new FieldConvertError("Could not convert string to unsigned long (" + i + ")", e); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// convert integer to string | ||
/// </summary> | ||
public static string Convert(System.UInt64 i) | ||
{ | ||
return i.ToString(); | ||
} | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace QuickFix.Fields | ||
{ | ||
/// <summary> | ||
/// An integer message field | ||
/// </summary> | ||
public class SequenceField : FieldBase<ulong> | ||
{ | ||
public SequenceField(int tag) | ||
: base(tag, 0) { } | ||
|
||
public SequenceField(int tag, ulong val) | ||
: base(tag, val) {} | ||
|
||
// quickfix compat | ||
public ulong getValue() | ||
{ return Obj; } | ||
|
||
public void setValue(ulong v) | ||
{ Obj = v; } | ||
|
||
protected override string makeString() | ||
{ | ||
return Converters.SequenceConverter.Convert(Obj); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.