/usr/include/qofexpensesobjects/qof-expenses.h is in libqofexpensesobjects-dev 0.1.9-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | /***************************************************************************
* qof-expenses.h
*
* Thu Oct 21 08:18:44 2004
* Copyright 2004,2005,2006,2009 Neil Williams <linux@codehelp.co.uk>
****************************************************************************/
/*
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/** @addtogroup QOF
@{ */
/** @addtogroup Exp Expenses
Like ::DB, Expenses uses UTC time within QOF and sets localtime when
calling pilot-link code.
Gradually becoming a standard QOF method, whilst retaining compatibility
with the simple pilot-link currency handling instead of going the whole
hog to GnuCash currencies. The old Expense_t has been removed for easier
sharing between applications.
The typed enumerators ::ExpenseDistance, ::ExpenseType and ::ExpensePayment
may look strange initially because macros are used to ensure
that the enum value and a string version of the enum are always in sync.
This allows the QOF backends to write human-readable data stores by specifying
an ExpenseType of "Parking" as:
\verbatim
<string type="type_of_expense">Parking</string>
\endverbatim
instead of:
\verbatim
<string type="type_of_expense">5</string>
\endverbatim
In particular, do not let the macro syntax <tt>_(name, value)</tt> fool you
into thinking it is related to <tt>_(String)</tt> from gettext! Note how the
enumerator is handled by doxygen:
\verbatim
enum ExpenseType {
Airfare = 0, Breakfast = 1, Bus = 2, BusinessMeals, ...
\endverbatim
Translation must only be used to represent the string version of the enum
value in the user interface and all internal handling of the enum value
must remain untranslated in the QofEntity itself
as this would lock the data into a specific locale.
\note Translation support in the user interface requires a little
adjustment of the display routines. Do \b NOT use translated
strings in the ::QofEntity - only in the user interface. The problem
is that although only the UI cares, the translated strings themselves
are only accessible via the library. See ::ExpenseType and
::ExpensePayment.
@{ */
/** @file qof-expenses.h
@brief QOF expense definitions
@author Copyright (c) 2004-2009 Neil Williams <linux@codehelp.co.uk>
*/
#ifndef _QOF_EXPENSES_H
#define _QOF_EXPENSES_H
#include <glib.h>
#include <qof.h>
/** @bug need to support qof-expenses and gpe-expenses */
#define GPE_MOD_EXP "gpe-expenses-module"
#define GPE_QOF_EXPENSES "gpe_expenses"
#define QOF_EXPENSES_DESC "GPE QOF expenses"
#define EXP_DATE "expense_date"
#define EXP_TYPE "type_of_expense"
#define EXP_PAYMENT "form_of_payment"
#define EXP_CURRENCY "currency_code"
#define EXP_AMOUNT "expense_amount"
#define EXP_VENDOR "expense_vendor"
#define EXP_CITY "expense_city"
#define EXP_ATTENDEES "expense_attendees"
#define EXP_NOTE "expense_note"
#define EXP_CATEGORY "category"
#define EXP_DISTANCE "distance_unit"
#define EXP_KVP "currency_lookup"
/** type: KVP_TYPE_STRING - inherited from pilot-link via pilot-qof. */
#define PQ_CURRENCY_MNEMONIC "expense/currency/mnemonic"
/** type: KVP_TYPE_STRING - inherited from pilot-link via pilot-qof. */
#define PQ_CURRENCY_SYMBOL "expense/currency/symbol"
/** type: KVP_TYPE_GINT64 - inherited from pilot-link via pilot-qof. */
#define PQ_CURRENCY_FRACTION "expense/currency/fraction"
/** \brief Wraps QOF around pilot-link expenses */
typedef struct QofExp_s QofExp;
typedef void (*QofCurrencyCB) (gpointer key, gpointer value, gpointer user_data);
void qof_currency_foreach(QofCurrencyCB cb, gpointer user_data);
/** \brief qof-expenses currency data wrapper.
Uses the same format as the Palm Default Currency Table:
http://pilot-qof.sourceforge.net/manual.html#currency
*/
typedef struct
{
/** pilot-link integer ID */
gint pq_code;
/** currency fraction, pennies/cents etc. */
gint fraction;
/** locale symbol. */
const gchar* symbol;
/** gnucash/cashutil mnemonic. */
const gchar* mnemonic;
/** TRUE if symbol is not UTF-8. (Currently,
this is only useful if the symbol can still be shown
as iso-8859-1.) */
gboolean non_utf8;
}QofCurrency;
/** \brief Set details of a QofCurrency from a currency_code
Lookup details of a QofCurrency from a short identifier. The
QofInstance will have a KvpFrame set (replacing any existing
values for the same keys) containing:
-::PQ_CURRENCY_MNEMONIC
-::PQ_CURRENCY_FRACTION
-::PQ_CURRENCY_SYMBOL
\param inst The QofInstance to hold the KvpFrame containing the
details of the currency.
\param currency_code The identifier of this currency.
\return a pointer to the QofCurrency identified by the
currency_code or NULL on error.
*/
QofCurrency *
qof_currency_lookup (QofInstance* inst, gint currency_code);
/** \brief Lookup a currency by name
Slower than ::gpe_currency_lookup because the entire currency
hash must be searched. Otherwise, equivalent.
*/
QofCurrency *
qof_currency_lookup_name (QofInstance* inst, gchar * mnemonic);
#define DISTANCE_LIST(_) \
_(Miles, = 0) \
_(Kilometers,)
#define PAYMENT_TYPE_LIST(_) \
_(AmericanExpress, = 0) \
_(Cash, = 1 ) \
_(Cheque, ) \
_(CreditCard, ) \
_(MasterCard, ) \
_(Prepaid, ) \
_(VISA, ) \
_(Unfiled, )
#define EXPENSE_TYPE_LIST(_) \
_(Airfare, = 0) \
_(Breakfast, = 1) \
_(Bus, = 2) \
_(BusinessMeals, ) \
_(CarRental, ) \
_(Dinner, ) \
_(Entertainment, ) \
_(Fax, ) \
_(Gas, ) \
_(Gifts, ) \
_(Hotel, ) \
_(Incidentals, ) \
_(Laundry, ) \
_(Limo, ) \
_(Lodging, ) \
_(Lunch, ) \
_(Mileage, ) \
_(Other, ) \
_(Parking, ) \
_(Postage, ) \
_(Snack, ) \
_(Subway, ) \
_(Supplies, ) \
_(Taxi, ) \
_(Telephone, ) \
_(Tips, ) \
_(Tolls, ) \
_(Train, )
DEFINE_ENUM(ExpenseDistance, DISTANCE_LIST)
/** \brief typedef for expense payment types.
\note These \b can be translated but it requires a little
adjustment of the display routines. Do \b NOT use translated
strings in the ::QofEntity - only in the user interface. The problem
is that although only the UI cares, the translated strings themselves
are only accessible via the library. This requires the use of
<tt>dgettext</tt> not the ordinary <tt>gettext</tt> or the
<tt>_(String)</tt> macro.
In your UI, to retrieve the translated string for an ExpensePayment,
wrap ExpenseTypeasString in a call to the library translation support:
\code
ExpensePayment i = Cash;
GtkComboBox * my_combo_box;
// set i to the enum value to display as a translated string
gtk_combo_box_append_text (my_combo_box,
dgettext(LIBRARY_GETTEXT_PACKAGE, ExpensePaymentasString(i)));
// the combo_box has a translation of "Cash" added to the list.
\endcode
You may choose to define your own macro for this.
Other translatable strings in your application code must continue
to use <tt>gettext</tt> or the <tt>_(String)</tt> macro as normal.
In accordance with the gettext manual, the library code does \b not
call <tt>setlocale (LC_ALL, "")</tt>. It is the responsibility of the
main program to set the locale.
*/
DEFINE_ENUM(ExpensePayment, PAYMENT_TYPE_LIST)
/** \brief typedef for expense types
\note These \b can be translated but it requires a little
adjustment of the display routines. Do \b NOT use translated
strings in the ::QofEntity - only in the user interface. The problem
is that although only the UI cares, the translated strings themselves
are only accessible via the library. This requires the use of
<tt>dgettext</tt> not the ordinary <tt>gettext</tt> or the
<tt>_(String)</tt> macro.
In your UI, to retrieve the translated string for an ExpenseType,
wrap ExpenseTypeasString in a call to the library translation support:
\code
GtkComboBox * my_combo_box;
ExpenseType i = Telephone;
// set i to the enum value to display as a translated string
gtk_combo_box_append_text (my_combo_box,
dgettext(LIBRARY_GETTEXT_PACKAGE, ExpenseTypeasString(i)));
// the combo_box has a translation of "Telephone" added to the list.
\endcode
You may choose to define your own macro for this.
Other translatable strings in your application code must continue
to use <tt>gettext</tt> or the <tt>_(String)</tt> macro as normal.
In accordance with the gettext manual, the library code does \b not
call <tt>setlocale (LC_ALL, "")</tt>. It is the responsibility of the
main program to set the locale.
*/
DEFINE_ENUM(ExpenseType, EXPENSE_TYPE_LIST)
AS_STRING_DEC (ExpenseDistance, DISTANCE_LIST)
FROM_STRING_DEC(ExpenseDistance, DISTANCE_LIST)
AS_STRING_DEC (ExpensePayment, PAYMENT_TYPE_LIST)
FROM_STRING_DEC(ExpensePayment, PAYMENT_TYPE_LIST)
AS_STRING_DEC (ExpenseType, EXPENSE_TYPE_LIST)
FROM_STRING_DEC(ExpenseType, EXPENSE_TYPE_LIST)
/** \brief Register this object with QOF
In accordance with the gettext manual, the library code does \b not
call <tt>setlocale (LC_ALL, "")</tt>. It is the responsibility of the
main program to set the locale. The library just calls bindtextdomain
with the domain for the library, LIBRARY_GETTEXT_PACKAGE which is
exported via the libqofexpensesobjects API.
\code
bindtextdomain (LIBRARY_GETTEXT_PACKAGE, LOCALE_DIR);
\endcode
*/
gboolean ExpensesRegister (void);
/** @} */
/** @} */
#endif /* _QOF_EXPENSES_H */
|