Skip to content

Commit

Permalink
edit docs; etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
peteroupc committed Nov 3, 2024
1 parent 8d63df7 commit bae3a86
Show file tree
Hide file tree
Showing 10 changed files with 1,773 additions and 747 deletions.
2 changes: 1 addition & 1 deletion CBOR.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ Version 4.5:
- Add support for deserializing CBOR objects to IReadOnlyList, IReadOnlyCollection, and ReadOnlyDictionary

Note that after version 4.5x, the CBOR library&apos;s repository will stop including special projects for .NET 2.0 and .NET 4.0, leaving the .NET-Standard project for building the library.</releaseNotes><summary></summary><license type='expression'>Unlicense</license><projectUrl>https://github.com/peteroupc/CBOR</projectUrl><authors>Peter Occil</authors><description>A C# implementation of Concise Binary Object Representation (CBOR), a general-purpose binary data format defined in RFC 8949.</description><owners>Peter Occil</owners><title>CBOR (Concise Binary Object Representation)</title><tags>cbor data serialization binary json</tags><dependencies><group targetFramework='.NETStandard1.0'><dependency id='PolySharp' version='1.13.2' /><dependency id='PeterO.URIUtility' version='1.0.0' /><dependency id='PeterO.Numbers' version='1.8.2' /><dependency id='PeterO.DataUtilities' version='1.1.0' /></group></dependencies></metadata><files><file src='CBOR/bin/Release/netstandard1.0/CBOR.dll' target='/lib/netstandard1.0' /><file src='CBOR/bin/Release/netstandard1.0/CBOR.xml' target='/lib/netstandard1.0' /></files></package
>
>
2 changes: 1 addition & 1 deletion CBORTest/CBORTest.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk='Microsoft.NET.Sdk'>
<PropertyGroup>
<TargetFramework>netcoreapp7.0</TargetFramework>
<TargetFramework>netcoreapp8.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition=' &apos;$(Configuration)&apos;==&apos;Debug&apos; '>
<DebugType>full</DebugType>
Expand Down
2 changes: 2 additions & 0 deletions docs/APIDocs.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@
* [PeterO.Cbor.JSONOptions.ConversionMode](PeterO.Cbor.JSONOptions.ConversionMode.md) - Specifies how JSON numbers are converted to CBOR objects when decoding JSON (such as via FromJSONString or ReadJSON ).

* [PeterO.Cbor.PODOptions](PeterO.Cbor.PODOptions.md) - Options for controlling how certain DotNET or Java objects, such as so-called "plain old data" objects (better known as POCOs in DotNET or POJOs in Java), are converted to CBOR objects.

* [PeterO.DataUtilities](PeterO.DataUtilities.md) - Contains methods useful for reading and writing text strings.
67 changes: 62 additions & 5 deletions docs/PeterO.Cbor.CBORDataUtilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Contains methods useful for reading and writing data, with a focus on CBOR.
* <code>[ParseJSONNumber(char[], int, int, PeterO.Cbor.JSONOptions)](#ParseJSONNumber_char_int_int_PeterO_Cbor_JSONOptions)</code> - Parses a number from a sequence of char s whose format follows the JSON specification (RFC 8259) and converts that number to a CBOR object.
* <code>[ParseJSONNumber(char[], PeterO.Cbor.JSONOptions)](#ParseJSONNumber_char_PeterO_Cbor_JSONOptions)</code> - Parses a number from a sequence of char s whose format follows the JSON specification (RFC 8259) and converts that number to a CBOR object.
* <code>[ParseJSONNumber(string)](#ParseJSONNumber_string)</code> - Parses a number whose format follows the JSON specification.
* <code>[ParseJSONNumber(string, bool, bool)](#ParseJSONNumber_string_bool_bool)</code> - <b>Deprecated:</b> Call the one-argument version of this method instead. If this method call used positiveOnly = true, check that the string does not begin with '-' before calling that version. If this method call used integersOnly = true, check that the string does not contain '.', 'E', or 'e' before calling that version.
* <code>[ParseJSONNumber(string, bool, bool, bool)](#ParseJSONNumber_string_bool_bool_bool)</code> - <b>Deprecated:</b> Instead, call ParseJSONNumber(str, jsonoptions) with a JSONOptions that sets preserveNegativeZero to the desired value, either true or false. If this method call used positiveOnly = true, check that the string does not begin with '-' before calling that version. If this method call used integersOnly = true, check that the string does not contain '.', 'E', or 'e' before calling that version.
* <code>[ParseJSONNumber(string, int, int)](#ParseJSONNumber_string_int_int)</code> - Parses a number whose format follows the JSON specification (RFC 8259) from a portion of a text string, and converts that number to a CBOR object.
* <code>[ParseJSONNumber(string, int, int, PeterO.Cbor.JSONOptions)](#ParseJSONNumber_string_int_int_PeterO_Cbor_JSONOptions)</code> - Parses a number whose format follows the JSON specification (RFC 8259) and converts that number to a CBOR object.
* <code>[ParseJSONNumber(string, PeterO.Cbor.JSONOptions)](#ParseJSONNumber_string_PeterO_Cbor_JSONOptions)</code> - Parses a number whose format follows the JSON specification (RFC 8259) and converts that number to a CBOR object.
Expand All @@ -24,15 +26,15 @@ Contains methods useful for reading and writing data, with a focus on CBOR.
public static PeterO.Cbor.CBORObject ParseJSONNumber(
byte[] bytes);

Parses a number from a byte sequence whose format follows the JSON specification. The method uses a JSONOptions with all default properties.
Parses a number from a byte sequence whose format follows the JSON specification. The method uses a JSONOptions with all default properties except for a PreserveNegativeZero property of false.

<b>Parameters:</b>

* <i>bytes</i>: A byte sequence to parse as a JSON number.

<b>Return Value:</b>

A CBOR object that represents the parsed number. Returns null if the parsing fails, including if the byte sequence is null or empty.
A CBOR object that represents the parsed number. Returns positive zero if the number is a zero that starts with a minus sign (such as "-0" or "-0.0"). Returns null if the parsing fails, including if the byte sequence is null or empty.

<a id="ParseJSONNumber_byte_int_int"></a>
### ParseJSONNumber
Expand Down Expand Up @@ -143,15 +145,15 @@ A CBOR object that represents the parsed number. Returns null if the parsing fai
public static PeterO.Cbor.CBORObject ParseJSONNumber(
char[] chars);

Parses a number from a sequence of `char` s whose format follows the JSON specification. The method uses a JSONOptions with all default properties.
Parses a number from a sequence of `char` s whose format follows the JSON specification. The method uses a JSONOptions with all default properties except for a PreserveNegativeZero property of false.

<b>Parameters:</b>

* <i>chars</i>: A sequence of `char` s to parse as a JSON number.

<b>Return Value:</b>

A CBOR object that represents the parsed number. Returns null if the parsing fails, including if the sequence of `char` s is null or empty.
A CBOR object that represents the parsed number. Returns positive zero if the number is a zero that starts with a minus sign (such as "-0" or "-0.0"). Returns null if the parsing fails, including if the sequence of `char` s is null or empty.

<a id="ParseJSONNumber_char_int_int"></a>
### ParseJSONNumber
Expand Down Expand Up @@ -262,12 +264,67 @@ A CBOR object that represents the parsed number. Returns null if the parsing fai
public static PeterO.Cbor.CBORObject ParseJSONNumber(
string str);

Parses a number whose format follows the JSON specification. The method uses a JSONOptions with all default properties.
Parses a number whose format follows the JSON specification. The method uses a JSONOptions with all default properties except for a PreserveNegativeZero property of false.

<b>Parameters:</b>

* <i>str</i>: A text string to parse as a JSON number.

<b>Return Value:</b>

A CBOR object that represents the parsed number. Returns positive zero if the number is a zero that starts with a minus sign (such as "-0" or "-0.0"). Returns null if the parsing fails, including if the string is null or empty.

<a id="ParseJSONNumber_string_bool_bool"></a>
### ParseJSONNumber

public static PeterO.Cbor.CBORObject ParseJSONNumber(
string str,
bool integersOnly,
bool positiveOnly);

<b>Deprecated.</b> Call the one-argument version of this method instead. If this method call used positiveOnly = true, check that the string does not begin with '-' before calling that version. If this method call used integersOnly = true, check that the string does not contain '.', 'E', or 'e' before calling that version.

Parses a number whose format follows the JSON specification (RFC 8259). The method uses a JSONOptions with all default properties except for a PreserveNegativeZero property of false.

Roughly speaking, a valid JSON number consists of an optional minus sign, one or more basic digits (starting with 1 to 9 unless there is only one digit and that digit is 0), an optional decimal point (".", full stop) with one or more basic digits, and an optional letter E or e with an optional plus or minus sign and one or more basic digits (the exponent). A text string representing a valid JSON number is not allowed to contain white space characters, including spaces.

<b>Parameters:</b>

* <i>str</i>: A text string to parse as a JSON number.

* <i>integersOnly</i>: If true, no decimal points or exponents are allowed in the string. The default is false.

* <i>positiveOnly</i>: If true, only positive numbers are allowed (the leading minus is disallowed). The default is false.

<b>Return Value:</b>

A CBOR object that represents the parsed number. Returns positive zero if the number is a zero that starts with a minus sign (such as "-0" or "-0.0"). Returns null if the parsing fails, including if the string is null or empty.

<a id="ParseJSONNumber_string_bool_bool_bool"></a>
### ParseJSONNumber

public static PeterO.Cbor.CBORObject ParseJSONNumber(
string str,
bool integersOnly,
bool positiveOnly,
bool preserveNegativeZero);

<b>Deprecated.</b> Instead, call ParseJSONNumber(str, jsonoptions) with a JSONOptions that sets preserveNegativeZero to the desired value, either true or false. If this method call used positiveOnly = true, check that the string does not begin with '-' before calling that version. If this method call used integersOnly = true, check that the string does not contain '.', 'E', or 'e' before calling that version.

Parses a number whose format follows the JSON specification (RFC 8259).

Roughly speaking, a valid JSON number consists of an optional minus sign, one or more basic digits (starting with 1 to 9 unless there is only one digit and that digit is 0), an optional decimal point (".", full stop) with one or more basic digits, and an optional letter E or e with an optional plus or minus sign and one or more basic digits (the exponent). A text string representing a valid JSON number is not allowed to contain white space characters, including spaces.

<b>Parameters:</b>

* <i>str</i>: A text string to parse as a JSON number.

* <i>integersOnly</i>: If true, no decimal points or exponents are allowed in the string. The default is false.

* <i>positiveOnly</i>: If true, the leading minus is disallowed in the string. The default is false.

* <i>preserveNegativeZero</i>: If true, returns positive zero if the number is a zero that starts with a minus sign (such as "-0" or "-0.0"). Otherwise, returns negative zero in this case. The default is false.

<b>Return Value:</b>

A CBOR object that represents the parsed number. Returns null if the parsing fails, including if the string is null or empty.
Expand Down
7 changes: 7 additions & 0 deletions docs/PeterO.Cbor.CBORDateConverter.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,3 +298,10 @@ Tries to extract the fields of a date and time in the form of a CBOR object.
<b>Return Value:</b>

Either `true` if the method is successful, or `false` otherwise.

<b>Exceptions:</b>

* System.ArgumentNullException:
The parameter <i>year</i>
or <i>lesserFields</i>
is null, or contains fewer elements than required.
17 changes: 0 additions & 17 deletions docs/PeterO.Cbor.CBORNumber.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ An instance of a number that CBOR or certain CBOR tags can represent. For this p
* <code>[ToByteIfExact()](#ToByteIfExact)</code> - Converts this number's value to a byte (from 0 to 255) if it can fit in a byte (from 0 to 255) without rounding to a different numerical value.
* <code>[ToByteUnchecked()](#ToByteUnchecked)</code> - Converts this number's value to an integer by discarding its fractional part, and returns the least-significant bits of its two's-complement form as a byte (from 0 to 255).
* <code>[ToCBORObject()](#ToCBORObject)</code> - Converts this object's value to a CBOR object.
* <code>[ToDecimal()](#ToDecimal)</code> - Converts this number's value to a CLR decimal.
* <code>[ToEDecimal()](#ToEDecimal)</code> - Converts this object to a decimal number.
* <code>[ToEFloat()](#ToEFloat)</code> - Converts this object to an arbitrary-precision binary floating point number.
* <code>[ToEInteger()](#ToEInteger)</code> - Converts this object to an arbitrary-precision integer.
Expand Down Expand Up @@ -678,22 +677,6 @@ Converts this object's value to a CBOR object.

A CBOR object that stores this object's value.

<a id="ToDecimal"></a>
### ToDecimal

public decimal ToDecimal();

Converts this number's value to a CLR decimal.

<b>Return Value:</b>

This number's value, converted to a decimal as though by `(decimal)this.ToEDecimal()` .

<b>Exceptions:</b>

* System.OverflowException:
This value is infinity or not-a-number.

<a id="ToEDecimal"></a>
### ToEDecimal

Expand Down
Loading

0 comments on commit bae3a86

Please sign in to comment.