LCOV - code coverage report
Current view: top level - libgnucash/engine - gncEmployee.h (source / functions) Coverage Total Hit
Test: gnucash.info Lines: 100.0 % 2 2
Test Date: 2026-11-02 18:19:43 Functions: 100.0 % 1 1
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /********************************************************************\
       2              :  * gncEmployee.h -- the Core Employee Interface                     *
       3              :  *                                                                  *
       4              :  * This program is free software; you can redistribute it and/or    *
       5              :  * modify it under the terms of the GNU General Public License as   *
       6              :  * published by the Free Software Foundation; either version 2 of   *
       7              :  * the License, or (at your option) any later version.              *
       8              :  *                                                                  *
       9              :  * This program is distributed in the hope that it will be useful,  *
      10              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
      11              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
      12              :  * GNU General Public License for more details.                     *
      13              :  *                                                                  *
      14              :  * You should have received a copy of the GNU General Public License*
      15              :  * along with this program; if not, contact:                        *
      16              :  *                                                                  *
      17              :  * Free Software Foundation           Voice:  +1-617-542-5942       *
      18              :  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
      19              :  * Boston, MA  02110-1301,  USA       gnu@gnu.org                   *
      20              :  *                                                                  *
      21              : \********************************************************************/
      22              : /** @addtogroup Business
      23              :     @{ */
      24              : /** @addtogroup Employee
      25              :     @{ */
      26              : /** @file gncEmployee.h
      27              :     @brief Employee Interface
      28              :     @author Copyright (C) 2001 Derek Atkins <warlord@MIT.EDU>
      29              : */
      30              : 
      31              : #ifndef GNC_EMPLOYEE_H_
      32              : #define GNC_EMPLOYEE_H_
      33              : 
      34              : typedef struct _gncEmployee GncEmployee;
      35              : typedef struct _gncEmployeeClass GncEmployeeClass;
      36              : 
      37              : #include "gncAddress.h"
      38              : #include "Account.h"
      39              : 
      40              : #ifdef __cplusplus
      41              : extern "C" {
      42              : #endif
      43              : 
      44              : #define GNC_ID_EMPLOYEE "gncEmployee"
      45              : 
      46              : /* --- type macros --- */
      47              : #define GNC_TYPE_EMPLOYEE            (gnc_employee_get_type ())
      48              : #define GNC_EMPLOYEE(o)              \
      49              :      (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_EMPLOYEE, GncEmployee))
      50              : #define GNC_EMPLOYEE_CLASS(k)        \
      51              :      (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_EMPLOYEE, GncEmployeeClass))
      52              : #define GNC_IS_EMPLOYEE(o)           \
      53              :      (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_EMPLOYEE))
      54              : #define GNC_IS_EMPLOYEE_CLASS(k)     \
      55              :      (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_EMPLOYEE))
      56              : #define GNC_EMPLOYEE_GET_CLASS(o)    \
      57              :      (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_EMPLOYEE, GncEmployeeClass))
      58              : GType gnc_employee_get_type(void);
      59              : 
      60              : /** @name Create/Destroy Functions
      61              :  @{ */
      62              : GncEmployee *gncEmployeeCreate (QofBook *book);
      63              : void gncEmployeeDestroy (GncEmployee *employee);
      64              : void gncEmployeeBeginEdit (GncEmployee *employee);
      65              : void gncEmployeeCommitEdit (GncEmployee *employee);
      66              : int gncEmployeeCompare (const GncEmployee *a, const GncEmployee *b);
      67              : /** @} */
      68              : 
      69              : /** @name Set Functions
      70              :  @{ */
      71              : void gncEmployeeSetID (GncEmployee *employee, const char *id);
      72              : void gncEmployeeSetUsername (GncEmployee *employee, const char *username);
      73              : /* Note: Employees don't have a name property defined, but
      74              :  * in order to get a consistent interface with other owner types,
      75              :  * this function fakes one by setting the name property of
      76              :  * the employee's address.
      77              :  */
      78              : void gncEmployeeSetName (GncEmployee *employee, const char *name);
      79              : void gncEmployeeSetLanguage (GncEmployee *employee, const char *language);
      80              : void gncEmployeeSetAcl (GncEmployee *employee, const char *acl);
      81              : void gncEmployeeSetWorkday (GncEmployee *employee, gnc_numeric workday);
      82              : void gncEmployeeSetRate (GncEmployee *employee, gnc_numeric rate);
      83              : void gncEmployeeSetCurrency (GncEmployee *employee, gnc_commodity * currency);
      84              : void gncEmployeeSetActive (GncEmployee *employee, gboolean active);
      85              : void gncEmployeeSetCCard (GncEmployee *employee, Account* ccard_acc);
      86              : void qofEmployeeSetAddr (GncEmployee *employee, QofInstance *addr_ent);
      87              : 
      88              : /** @} */
      89              : 
      90              : /** @name Get Functions
      91              :  @{ */
      92              : QofBook * gncEmployeeGetBook (GncEmployee *employee);
      93              : const char * gncEmployeeGetID (const GncEmployee *employee);
      94              : const char * gncEmployeeGetUsername (const GncEmployee *employee);
      95              : /* Note: Employees don't have a name property defined, but
      96              :  * in order to get a consistent interface with other owner types,
      97              :  * this function fakes one by returning the name property of
      98              :  * the employee's address.
      99              :  */
     100              : const char * gncEmployeeGetName (const GncEmployee *employee);
     101              : GncAddress * gncEmployeeGetAddr (const GncEmployee *employee);
     102              : const char * gncEmployeeGetLanguage (const GncEmployee *employee);
     103              : const char * gncEmployeeGetAcl (const GncEmployee *employee);
     104              : gnc_numeric gncEmployeeGetWorkday (const GncEmployee *employee);
     105              : gnc_numeric gncEmployeeGetRate (const GncEmployee *employee);
     106              : gnc_commodity * gncEmployeeGetCurrency (const GncEmployee *employee);
     107              : gboolean gncEmployeeGetActive (const GncEmployee *employee);
     108              : Account * gncEmployeeGetCCard (const GncEmployee *employee);
     109              : /** @} */
     110              : 
     111              : 
     112              : /** Return a pointer to the instance gncEmployee that is identified
     113              :  *  by the guid, and is residing in the book. Returns NULL if the
     114              :  *  instance can't be found.
     115              :  */
     116            1 : static inline GncEmployee * gncEmployeeLookup (const QofBook *book, const GncGUID *guid)
     117              : {
     118            1 :     QOF_BOOK_RETURN_ENTITY(book, guid, GNC_ID_EMPLOYEE, GncEmployee);
     119              : }
     120              : 
     121              : 
     122              : #define EMPLOYEE_ID       "id"
     123              : #define EMPLOYEE_USERNAME "username"
     124              : #define EMPLOYEE_NAME     "name"
     125              : #define EMPLOYEE_ADDR     "addr"
     126              : #define EMPLOYEE_LANGUAGE "native language"
     127              : #define EMPLOYEE_ACL      "acl"
     128              : #define EMPLOYEE_WORKDAY  "workday"
     129              : #define EMPLOYEE_RATE     "rate"
     130              : #define EMPLOYEE_CC       "credit_card_account"
     131              : 
     132              : /** deprecated routines */
     133              : #define gncEmployeeGetGUID(E) qof_entity_get_guid(QOF_INSTANCE(E))
     134              : #define gncEmployeeGetBook(E) qof_instance_get_book(QOF_INSTANCE(E))
     135              : #define gncEmployeeRetGUID(E) (E ? *(qof_entity_get_guid(QOF_INSTANCE(E))) : *(guid_null()))
     136              : #define gncEmployeeLookupDirect(G,B) gncEmployeeLookup((B),&(G))
     137              : 
     138              : /** Test support function, used by test-dbi-business-stuff.c */
     139              : gboolean gncEmployeeEqual(const GncEmployee* e1, const GncEmployee* e2);
     140              : gboolean gncEmployeeIsDirty (const GncEmployee *employee);
     141              : 
     142              : #ifdef __cplusplus
     143              : }
     144              : #endif
     145              : 
     146              : #endif /* GNC_EMPLOYEE_H_ */
     147              : /** @} */
     148              : /** @} */
        

Generated by: LCOV version 2.0-1