Skip to content

Commit

Permalink
C# Switch to Google.FlatBuffers namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaileychess committed Aug 31, 2022
1 parent adee51b commit 44116ed
Show file tree
Hide file tree
Showing 65 changed files with 78 additions and 135 deletions.
2 changes: 1 addition & 1 deletion net/FlatBuffers/ByteBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#warning ENABLE_SPAN_T requires UNSAFE_BYTEBUFFER to also be defined
#endif

namespace FlatBuffers
namespace Google.FlatBuffers
{
public abstract class ByteBufferAllocator
{
Expand Down
2 changes: 1 addition & 1 deletion net/FlatBuffers/ByteBufferUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

using System;

namespace FlatBuffers
namespace Google.FlatBuffers
{
/// <summary>
/// Class that collects utility functions around `ByteBuffer`.
Expand Down
2 changes: 1 addition & 1 deletion net/FlatBuffers/FlatBufferBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/// @addtogroup flatbuffers_csharp_api
/// @{

namespace FlatBuffers
namespace Google.FlatBuffers
{
/// <summary>
/// Responsible for building up and accessing a FlatBuffer formatted byte
Expand Down
2 changes: 1 addition & 1 deletion net/FlatBuffers/FlatBufferConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
using System.Linq;
using System.Text;

namespace FlatBuffers
namespace Google.FlatBuffers
{
public static class FlatBufferConstants
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,16 @@
<TargetFrameworks>netstandard2.1;netstandard2.0;net46</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<PackageId>Google.FlatBuffers</PackageId>
<AssemblyName>FlatBuffers</AssemblyName>
<AssemblyTitle>FlatBuffers</AssemblyTitle>
<Description>A cross-platform memory efficient serialization library</Description>
<PackageVersion>2.0.8-beta</PackageVersion>
<Authors>Wouter van Oortmerssen, Derek Bailey</Authors>
<Company>Google</Company>
<PackageVersion>2.0.8-beta.1</PackageVersion>
<Authors>Google LLC</Authors>
<PackageProjectUrl>https://github.com/google/flatbuffers</PackageProjectUrl>
<RepositoryUrl>https://github.com/google/flatbuffers</RepositoryUrl>
<RepositoryBranch>master</RepositoryBranch>
<RepositoryCommit>e2eb5ee67096f5c039947c3d03477370d3be44f8</RepositoryCommit>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageIcon>flatbuffers.png</PackageIcon>
<PackageTags>Google;FlatBuffers;Serialization;Buffer;Binary;zero copy</PackageTags>
<PackageReleaseNotes>First official nuget package release of flatbuffers</PackageReleaseNotes>
<Copyright>Copyright 2022 Google Inc. All rights reserved.</Copyright>
<PackRelease>true</PackRelease>
<PublishRelease>true</PublishRelease>
<Optimize>true</Optimize>
<Configuration>Release</Configuration>
<Copyright>Copyright 2022 Google LLC</Copyright>
</PropertyGroup>

<PropertyGroup Condition="'$(UNSAFE_BYTEBUFFER)' == 'true'">
Expand All @@ -40,7 +32,8 @@
</ItemGroup>

<ItemGroup>
<None Include="flatbuffers.png" Pack="true" PackagePath="\" />
<None Include ="..\..\LICENSE.txt" Pack="true" PackagePath="" />
<None Include="flatbuffers.png" Pack="true" PackagePath="" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion net/FlatBuffers/IFlatbufferObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

namespace FlatBuffers
namespace Google.FlatBuffers
{
/// <summary>
/// This is the base for both structs and tables.
Expand Down
2 changes: 1 addition & 1 deletion net/FlatBuffers/Offset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

namespace FlatBuffers
namespace Google.FlatBuffers
{
/// <summary>
/// Offset class for typesafe assignments.
Expand Down
52 changes: 0 additions & 52 deletions net/FlatBuffers/Properties/AssemblyInfo.cs

This file was deleted.

2 changes: 1 addition & 1 deletion net/FlatBuffers/Struct.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

namespace FlatBuffers
namespace Google.FlatBuffers
{
/// <summary>
/// All structs in the generated code derive from this class, and add their own accessors.
Expand Down
2 changes: 1 addition & 1 deletion net/FlatBuffers/Table.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
using System.Text;
using System.Runtime.InteropServices;

namespace FlatBuffers
namespace Google.FlatBuffers
{
/// <summary>
/// All tables in the generated code derive from this struct, and add their own accessors.
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def glob(path, pattern):
# For Rust we currently generate two independent schemas, with namespace_test2
# duplicating the types in namespace_test1
flatc(
RUST_OPTS,
RUST_OPTS + CS_OPTS,
prefix="namespace_test",
schema=[
"namespace_test/namespace_test1.fbs",
Expand Down
14 changes: 8 additions & 6 deletions src/idl_gen_csharp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class CSharpGenerator : public BaseGenerator {
if (needs_includes) {
code += "using global::System;\n";
code += "using global::System.Collections.Generic;\n";
code += "using global::FlatBuffers;\n\n";
code += "using global::Google.FlatBuffers;\n\n";
}
code += classcode;
if (!namespace_name.empty()) { code += "\n}\n"; }
Expand Down Expand Up @@ -1307,9 +1307,9 @@ class CSharpGenerator : public BaseGenerator {
code += "Offset<" + struct_def.name + ">";
code += "[] offsets) {\n";
code += " Array.Sort(offsets,\n";
code += " (Offset<" + struct_def.name +
"> o1, Offset<" + struct_def.name + "> o2) =>\n";
code += " "+ GenKeyGetter(struct_def, key_field);
code += " (Offset<" + struct_def.name + "> o1, Offset<" +
struct_def.name + "> o2) =>\n";
code += " " + GenKeyGetter(struct_def, key_field);
code += ");\n";
code += " return builder.CreateVectorOfTables(offsets);\n }\n";

Expand Down Expand Up @@ -1463,8 +1463,10 @@ class CSharpGenerator : public BaseGenerator {
}
code += "\n";
// Pack()
code += " public static int Pack(FlatBuffers.FlatBufferBuilder builder, " +
union_name + " _o) {\n";
code +=
" public static int Pack(Google.FlatBuffers.FlatBufferBuilder "
"builder, " +
union_name + " _o) {\n";
code += " switch (_o.Type) {\n";
for (auto it = enum_def.Vals().begin(); it != enum_def.Vals().end(); ++it) {
auto &ev = **it;
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Benchmarks/FlatBufferBuilderBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
using BenchmarkDotNet.Attributes;
using MyGame.Example;

namespace FlatBuffers.Benchmarks
namespace Google.FlatBuffers.Benchmarks
{
//[EtwProfiler] - needs elevated privileges
[MemoryDiagnoser]
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Benchmarks/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

using BenchmarkDotNet.Running;

namespace FlatBuffers.Benchmarks
namespace Google.FlatBuffers.Benchmarks
{
public static class Program
{
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/Assert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
using System.Linq;
using System.Text;

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{

public class AssertFailedException : Exception
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/ByteBufferTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
using System;
using System.Runtime.InteropServices;

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{
[FlatBuffersTestClass]
public class ByteBufferTests
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/FlatBufferBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

using System;

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{
[FlatBuffersTestClass]
public class FlatBufferBuilderTests
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/FlatBuffersExampleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
using optional_scalars;
using KeywordTest;

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{
[FlatBuffersTestClass]
public class FlatBuffersExampleTests
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/FlatBuffersFuzzTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

using System;

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{
[FlatBuffersTestClass]
public class FlatBuffersFuzzTests
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/FlatBuffersTestClassAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
using System.Linq;
using System.Text;

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{
[AttributeUsage(AttributeTargets.Class)]
public class FlatBuffersTestClassAttribute : Attribute
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/FlatBuffersTestMethodAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

using System;

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{
[AttributeUsage(AttributeTargets.Method)]
public class FlatBuffersTestMethodAttribute : Attribute
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/FuzzTestData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

using System;

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{
internal static class FuzzTestData
{
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/Lcg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{
/// <summary>
/// Lcg Pseudo RNG
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
using System.Linq;
using System.Reflection;

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{
static class Program
{
Expand Down
2 changes: 1 addition & 1 deletion tests/FlatBuffers.Test/TestTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

namespace FlatBuffers.Test
namespace Google.FlatBuffers.Test
{
/// <summary>
/// A test Table object that gives easy access to the slot data
Expand Down
2 changes: 1 addition & 1 deletion tests/KeywordTest/KeywordsInTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace KeywordTest

using global::System;
using global::System.Collections.Generic;
using global::FlatBuffers;
using global::Google.FlatBuffers;

public struct KeywordsInTable : IFlatbufferObject
{
Expand Down
2 changes: 1 addition & 1 deletion tests/KeywordTest/KeywordsInUnion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class KeywordsInUnionUnion {
public KeywordTest.KeywordsInTableT Asinternal() { return this.As<KeywordTest.KeywordsInTableT>(); }
public static KeywordsInUnionUnion Frominternal(KeywordTest.KeywordsInTableT _internal) { return new KeywordsInUnionUnion{ Type = KeywordsInUnion.@internal, Value = _internal }; }

public static int Pack(FlatBuffers.FlatBufferBuilder builder, KeywordsInUnionUnion _o) {
public static int Pack(Google.FlatBuffers.FlatBufferBuilder builder, KeywordsInUnionUnion _o) {
switch (_o.Type) {
default: return 0;
case KeywordsInUnion.@static: return KeywordTest.KeywordsInTable.Pack(builder, _o.Asstatic()).Value;
Expand Down
2 changes: 1 addition & 1 deletion tests/MyGame/Example/Ability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace MyGame.Example

using global::System;
using global::System.Collections.Generic;
using global::FlatBuffers;
using global::Google.FlatBuffers;

public struct Ability : IFlatbufferObject
{
Expand Down
2 changes: 1 addition & 1 deletion tests/MyGame/Example/Any.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class AnyUnion {
public MyGame.Example2.MonsterT AsMyGame_Example2_Monster() { return this.As<MyGame.Example2.MonsterT>(); }
public static AnyUnion FromMyGame_Example2_Monster(MyGame.Example2.MonsterT _mygame_example2_monster) { return new AnyUnion{ Type = Any.MyGame_Example2_Monster, Value = _mygame_example2_monster }; }

public static int Pack(FlatBuffers.FlatBufferBuilder builder, AnyUnion _o) {
public static int Pack(Google.FlatBuffers.FlatBufferBuilder builder, AnyUnion _o) {
switch (_o.Type) {
default: return 0;
case Any.Monster: return MyGame.Example.Monster.Pack(builder, _o.AsMonster()).Value;
Expand Down
2 changes: 1 addition & 1 deletion tests/MyGame/Example/AnyAmbiguousAliases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class AnyAmbiguousAliasesUnion {
public MyGame.Example.MonsterT AsM3() { return this.As<MyGame.Example.MonsterT>(); }
public static AnyAmbiguousAliasesUnion FromM3(MyGame.Example.MonsterT _m3) { return new AnyAmbiguousAliasesUnion{ Type = AnyAmbiguousAliases.M3, Value = _m3 }; }

public static int Pack(FlatBuffers.FlatBufferBuilder builder, AnyAmbiguousAliasesUnion _o) {
public static int Pack(Google.FlatBuffers.FlatBufferBuilder builder, AnyAmbiguousAliasesUnion _o) {
switch (_o.Type) {
default: return 0;
case AnyAmbiguousAliases.M1: return MyGame.Example.Monster.Pack(builder, _o.AsM1()).Value;
Expand Down
2 changes: 1 addition & 1 deletion tests/MyGame/Example/AnyUniqueAliases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class AnyUniqueAliasesUnion {
public MyGame.Example2.MonsterT AsM2() { return this.As<MyGame.Example2.MonsterT>(); }
public static AnyUniqueAliasesUnion FromM2(MyGame.Example2.MonsterT _m2) { return new AnyUniqueAliasesUnion{ Type = AnyUniqueAliases.M2, Value = _m2 }; }

public static int Pack(FlatBuffers.FlatBufferBuilder builder, AnyUniqueAliasesUnion _o) {
public static int Pack(Google.FlatBuffers.FlatBufferBuilder builder, AnyUniqueAliasesUnion _o) {
switch (_o.Type) {
default: return 0;
case AnyUniqueAliases.M: return MyGame.Example.Monster.Pack(builder, _o.AsM()).Value;
Expand Down
2 changes: 1 addition & 1 deletion tests/MyGame/Example/ArrayStruct.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace MyGame.Example

using global::System;
using global::System.Collections.Generic;
using global::FlatBuffers;
using global::Google.FlatBuffers;

public struct ArrayStruct : IFlatbufferObject
{
Expand Down
2 changes: 1 addition & 1 deletion tests/MyGame/Example/ArrayTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace MyGame.Example

using global::System;
using global::System.Collections.Generic;
using global::FlatBuffers;
using global::Google.FlatBuffers;

public struct ArrayTable : IFlatbufferObject
{
Expand Down

0 comments on commit 44116ed

Please sign in to comment.