[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RFC libquran: API



*Name Space*
All function calls shall be prefixed with quran_ and written in
lowercase and words are delimited with underscores.
All constants shall be prefixed with QURAN_ and written in capitals
and words are delimited with underscores.
All types/typedefs shall be prefixed with Quran and written with camel case.

*Return Status*
All functions shall return the QuranStatus enum. The returned strings
or other values are set with pass by reference method.

*Package API*
Some function calls requires a successfully opened QuranPackage as the argument.

QuranStatus quran_package_open (const gchar *full_path, QuranPackage *package);
QuranStatus quran_package_close (QuranPackage *package);

*Text API*
typedef struct {
  const gchar *name:
  const gchar *language:
  const gchar *license:
  const gchar *additional_info:
} QuranText;

QuranStatus quran_text_open (QuranPackage *package, const gchar *id,
QuranText *text);
QuranStatus quran_text_close (QuranText *text);
QuranStatus quran_text_get_ayah (QuranText *text, int surah, int ayah,
gchar *ayah_text);
QuranStatus quran_text_get_info (QuranText *text, QuranTextInfo *info)
QuranStatus quran_text_get_ayah_info (int surah, int ayah, QuranAyahInfo *info);

*Audio API*
typedef struct {
  const gchar *name:
  const gchar *language:
  const gchar *recitor:
  const gchar *license:
  const gchar *additional_info:
  const gchar *mime_type;
} QuranAudio;

QuranStatus quran_audio_open (QuranPackage *package, const gchar *id,
QuranAudio *audio);
QuranStatus quran_audio_close (QuranAudio *audio);
QuranStatus quran_audio_play (QuranAudio *audio, int surah, int ayah,
int (*)(quran_audio_callback *));
QuranStatus quran_audio_stop (QuranAudio *audio);
QuranStatus quran_audio_get_info (QuranAudio *audio, QuranAudioInfo *info);