UNKNOWN
Project description
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 + ")";
}
}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file idlite-0.0.11.tar.gz.
File metadata
- Download URL: idlite-0.0.11.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2915cf18bccabe8d51c287f87e0b9b43087c9f49267d5d4aa9707ae0bca49c6c
|
|
| MD5 |
d4b396cc31cfa48d96d5247594a6b0f9
|
|
| BLAKE2b-256 |
face6b4e91e3ed5a36ceea868de5045f6888a7491ec12026ae50684a692179ac
|
File details
Details for the file idlite-0.0.11-py3-none-any.whl.
File metadata
- Download URL: idlite-0.0.11-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25704891c8b436b2cbfd02191bd296f8ae77e16cafe97467738c4a456628086f
|
|
| MD5 |
7de7090fa644454669bd765a59686429
|
|
| BLAKE2b-256 |
1d18cbe72748d95b58022aa2f2c9b28fa762cce81953ab47049aef302fb11322
|