Skip to main content

IDLite は開発中のプロジェクトです。 予告なく、下位互換性のない変更を行います。

背景

IDLite は、 Unity でモバイルオンラインゲームを作成するときに、 Unity C# で JSON を 扱うのが面倒なのを解決してくれるツールです。

固い protocol を使いたい場合は protocol buffer や thrift や msgpack idl がありますが、 これらは効率的にデータをパックするために、 {“キー”: 値} という構造ではなくて、 配列中の位置に意味をもたせているため、効率よりも Web 系のカジュアルな開発スタイルを 重視する場合には使いにくいことがあります。

JSON schema もありますが、これも複雑で学習が難しいものです。

LitJSON など、 JSON を手軽に扱える C# のライブラリはありますが、 リフレクションやジェネリクスに制限のある iOS では動かないケースがあります。

IDLite は、この隙間の需要を満たすためのものです。

サンプル

IDL

// ドキュメントコメント
// 複数行書けます.
enum Color {
    red = 1,
    green = 2,
    blue = 3
};

# 無視されるコメント

// ボール
class Ball {
    // ボールの持ち主
    string? owner;
    // ボールの色
    enum Color color;
    // 座標
    float x;
    float y;
};

class Field {
    List<Ball> balls;
};

生成されるコード

// This code is automatically generated.
// Don't edit this file directly.
using System;
using System.Collections.Generic;

namespace IDLite
{
        /// <summary>
        /// ドキュメントコメント
        /// 複数行書けます.
        /// </summary>
        public enum Color
        {
                red = 1,
                green = 2,
                blue = 3
        }


        /// <summary>
        /// ボール
        /// </summary>
        [Serializable]
        public partial class Ball : IDLiteBase
        {
                /// <summary>
                /// ボールの持ち主
                /// </summary>
                public string owner;
                /// <summary>
                /// ボールの色
                /// </summary>
                public Color color;
                /// <summary>
                /// 座標
                /// </summary>
                public double x;
                public double y;

                public Ball(string owner, Color color, double x, double y)
                {
                        this.owner = owner;
                        this.color = color;
                        this.x = x;
                        this.y = y;
                }

                public Ball(Dictionary<string, object> dict)
                {
                        this.owner = ParseNullableString(GetItem(dict, "owner"));
                        this.color = (Color)ParseInt(GetItem(dict, "color"));
                        this.x = ParseDouble(GetItem(dict, "x"));
                        this.y = ParseDouble(GetItem(dict, "y"));
                }

                public override string ToString()
                {
                        return "Ball(owner=" + owner + ", color=" + color + ", x=" + x + ", y=" + y + ")";
                }
        }

        [Serializable]
        public partial class Field : IDLiteBase
        {
                public List<Ball> balls;

                public Field(List<Ball> balls)
                {
                        this.balls = balls;
                }

                public Field(Dictionary<string, object> dict)
                {
                        this.balls = GetList<Ball>(dict, "balls", (object o) => { return new Ball((Dictionary<string, object>)o); });
                }

                public override string ToString()
                {
                        return "Field(balls=" + balls + ")";
                }
        }

}

Release files for idlite 0.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for idlite 0.0.11
File Size Uploaded
idlite-0.0.11.tar.gz 7.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for idlite 0.0.11
File Interpreter ABI Platform
idlite-0.0.11-py3-none-any.whl Python 3 none any Details

Total release size: 18.3 kB

Release files / idlite-0.0.11.tar.gz

Download URL idlite-0.0.11.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2915cf18bccabe8d51c287f87e0b9b43087c9f49267d5d4aa9707ae0bca49c6c
BLAKE2b-256 checksum
How to use checksums
face6b4e91e3ed5a36ceea868de5045f6888a7491ec12026ae50684a692179ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / idlite-0.0.11-py3-none-any.whl

Download URL idlite-0.0.11-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25704891c8b436b2cbfd02191bd296f8ae77e16cafe97467738c4a456628086f
BLAKE2b-256 checksum
How to use checksums
1d18cbe72748d95b58022aa2f2c9b28fa762cce81953ab47049aef302fb11322
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.11 This release

2 release files

0.0.10

1 release file

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page