-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add experimental depending only mscorlib assembly (Unity3D.Micro). Re…
…lated to Issue #72.
- Loading branch information
Showing
29 changed files
with
1,201 additions
and
32 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
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,86 @@ | ||
#region -- License Terms -- | ||
// | ||
// MessagePack for CLI | ||
// | ||
// Copyright (C) 2015 FUJIWARA, Yusuke | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
#endregion -- License Terms -- | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace MsgPack | ||
{ | ||
#if CORLIB_ONLY | ||
internal sealed class BooleanStack | ||
{ | ||
private readonly List<Boolean> _list; | ||
|
||
public int Count { get { return this._list.Count; } } | ||
|
||
public BooleanStack( int initialCapacity ) | ||
{ | ||
this._list = new List<Boolean>( initialCapacity ); | ||
} | ||
|
||
public void Push( Boolean value ) | ||
{ | ||
this._list.Add( value ); | ||
} | ||
|
||
public Boolean Peek() | ||
{ | ||
return this._list[ this._list.Count - 1 ]; | ||
} | ||
|
||
public Boolean Pop() | ||
{ | ||
var result = this.Peek(); | ||
this._list.RemoveAt( this._list.Count - 1 ); | ||
return result; | ||
} | ||
} | ||
|
||
internal sealed class Int64Stack | ||
{ | ||
private readonly List<Int64> _list; | ||
|
||
public int Count { get { return this._list.Count; } } | ||
|
||
public Int64Stack( int initialCapacity ) | ||
{ | ||
this._list = new List<Int64>( initialCapacity ); | ||
} | ||
|
||
public void Push( Int64 value ) | ||
{ | ||
this._list.Add( value ); | ||
} | ||
|
||
public Int64 Peek() | ||
{ | ||
return this._list[ this._list.Count - 1 ]; | ||
} | ||
|
||
public Int64 Pop() | ||
{ | ||
var result = this.Peek(); | ||
this._list.RemoveAt( this._list.Count - 1 ); | ||
return result; | ||
} | ||
} | ||
|
||
#endif // CORLIB_ONLY | ||
} |
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,70 @@ | ||
<#@ template debug="false" hostspecific="false" language="C#" #> | ||
<#@ assembly name="System.Core" #> | ||
<#@ import namespace="System.Linq" #> | ||
<#@ import namespace="System.Text" #> | ||
<#@ import namespace="System.Collections.Generic" #> | ||
<#@ output extension=".cs" #> | ||
#region -- License Terms -- | ||
// | ||
// MessagePack for CLI | ||
// | ||
// Copyright (C) 2015 FUJIWARA, Yusuke | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
#endregion -- License Terms -- | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace MsgPack | ||
{ | ||
#if CORLIB_ONLY | ||
<# | ||
foreach ( var itemType in new[] { typeof( bool ), typeof( long ) } ) | ||
{ | ||
#> | ||
internal sealed class <#= itemType.Name #>Stack | ||
{ | ||
private readonly List<<#= itemType.Name #>> _list; | ||
|
||
public int Count { get { return this._list.Count; } } | ||
|
||
public <#= itemType.Name #>Stack( int initialCapacity ) | ||
{ | ||
this._list = new List<<#= itemType.Name #>>( initialCapacity ); | ||
} | ||
|
||
public void Push( <#= itemType.Name #> value ) | ||
{ | ||
this._list.Add( value ); | ||
} | ||
|
||
public <#= itemType.Name #> Peek() | ||
{ | ||
return this._list[ this._list.Count - 1 ]; | ||
} | ||
|
||
public <#= itemType.Name #> Pop() | ||
{ | ||
var result = this.Peek(); | ||
this._list.RemoveAt( this._list.Count - 1 ); | ||
return result; | ||
} | ||
} | ||
|
||
<# | ||
} | ||
#> | ||
#endif // CORLIB_ONLY | ||
} |
Oops, something went wrong.