Git Product home page Git Product logo

castledbgen's Introduction

CastleDBGen

CastleDB: http://castledb.org/ Github: https://github.com/ncannasse/castle

Process CastleDB database JSON files and generates source code for both the types contained in the database and code to load and resolve foreign keys.

Supported CastleDB data types

  • Unique Identifier
  • Text
  • bool
  • Int
  • Float
  • Enum
  • Flags
  • Lists
  • References
  • Color
  • File (as String)

Unsupported CastleDB data types

  • Layer
  • TilePos
  • TileLayer
  • Custom
  • Dynamic
  • Image (seperate IMG database, base64 encoding - will probably fork CastleDB to work with Urho3D resources in the future)

Command line usage printout:

CastleDBGen - (C) JSandusky 2015
usage:
CastleDBGen <input-db-path> [outputfilename]

switches:
-ns: namespace, follow with namespace
    default: none
    C#: REQUIRED
-lang: <language>
    default: cpp
    option: as
    option: cs
    option: lua
    option: asbind (generate AS bindings)
-hd: <header path string>, C++ only
-db: name for database class
    default: GameDatabase
-bin: <setting>, type of binary read/write suppprt
    default: none
    option: on
    option: only, only generates binary read/write, no JSON
-inherit: <classname>
    default: none
    Required as "RefCounted" for AS binding generation
    Note: in C++ inheriting RefCounted will use SharedPtr for all things

Examples

CastleDBGen C:\MyDdatabase.cdb -lang cpp -ns MyNamespace
CastleDBGen C:\MyDdatabase.cdb -lang as
CastleDBGen C:\MyDdatabase.cdb -lang cpp -hd "../HeaderPath/"

Dependencies

Newtonsoft.JSON via Nuget

Using custom types

To use CastleDB custom types and their constructors a specific set of rules must be used to make the generator happy. These necessities were irrelevant to Haxe. Eventually a CastleDB fork will account for the necessity.

  • The first "constructor" must be the variable type and must not be used in your data.
  • All other constructors will be used to construct that data

The following snippet is valid for a field that is a float and is constructed via a call to random(value,value). The effect of the constructed code would be to call random() to set a float.

enum MyCustom {
    float;
    random(min : float, max : float);
}

castledbgen's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.