Using the API

From GnuCash
Revision as of 20:04, 10 May 2011 by Cstim (talk | contribs) (initial text)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page collects some examples on how to use the C API in gnucash for basic data type manipulation. The C API (also called "the engine") is the abstraction layer from any backend. That is, the GUI or plugin programmer should never access any XML or SQL himself but instead he only uses the functions from the C API to access the data.

As for documentation: Unfortunatly there doesn't exist any up-to-date coherent set of documentation. Part of it is in doxygen, but part of it are only in the C header files.

  • http://svn.gnucash.org/docs/HEAD/modules.html contains the overview of those parts that are in doxygen. For example, there is a module group entitled "GnuCash Engine: Core, Non-GUI Accounting Functions" which contains the doxygen-ized parts of this, including the "Account", but not including Transaction and Split which are the other important basic data types.
  • https://github.com/downloads/jralls/gnucash/gnucash_erd.png is an up-to-date (May 2011) Entity-Relationship-Diagram (ERD) which shows those most important types of gnucash (in the form of tables, as common for an ERD):
    • Split
    • Transaction
    • Account
    • Commodity
    • Book
  • The only place that is for sure up-to-date are the header files:
    • src/engine/Account.h
    • src/engine/Transaction.h
    • src/engine/Split.h
    • src/libqof/qof/qofbook.h
    • src/engine/gnc-commodity.h
   * In cutecash so far: src/gnc/Transaction.hpp

Creating a new transaction