Go to the source code of this file.
|
KivaModel * | KivaModel_create (const char *) |
|
MagPebApp_ErrCode | KivaModel_destroy (KivaModel *this) |
|
MagPebApp_ErrCode | KivaModel_setLenderId (KivaModel *this, const char *) |
|
MagPebApp_ErrCode | KivaModel_setLenderName (KivaModel *const this, const char *) |
|
MagPebApp_ErrCode | KivaModel_setLenderLoc (KivaModel *this, const char *) |
|
MagPebApp_ErrCode | KivaModel_setLenderLoanQty (KivaModel *this, const int) |
|
MagPebApp_ErrCode | KivaModel_addLenderCountry (KivaModel *this, const char *, const char *) |
|
MagPebApp_ErrCode | KivaModel_addKivaCountry (KivaModel *this, const char *, const char *) |
|
MagPebApp_ErrCode | KivaModel_addPreferredLoan (KivaModel *this, const LoanInfo) |
|
MagPebApp_ErrCode | KivaModel_clearPreferredLoans (KivaModel *this) |
|
MagPebApp_ErrCode | KivaModel_getMods (const KivaModel *this, KivaModel_Modified *) |
|
MagPebApp_ErrCode | KivaModel_getLenderId (const KivaModel *this, char **) |
|
MagPebApp_ErrCode | KivaModel_getLenderName (const KivaModel *this, char **) |
|
MagPebApp_ErrCode | KivaModel_getLenderLoc (const KivaModel *this, char **) |
|
MagPebApp_ErrCode | KivaModel_getLenderLoanQty (const KivaModel *this, int *) |
|
MagPebApp_ErrCode | KivaModel_getLenderCountryQty (const KivaModel *this, int *) |
|
MagPebApp_ErrCode | KivaModel_getLenderCountryCodes (const KivaModel *this, const bool, char **) |
|
MagPebApp_ErrCode | KivaModel_getKivaCountryQty (const KivaModel *this, int *) |
|
MagPebApp_ErrCode | KivaModel_getKivaCountryName (const KivaModel *this, const char *, const char **) |
|
MagPebApp_ErrCode | KivaModel_getPreferredLoanQty (const KivaModel *this, uint16_t *) |
|
KivaModel_PrefLoan_CIter * | KivaModel_firstPrefLoan (const KivaModel *this) |
|
KivaModel_PrefLoan_CIter * | KivaModel_nextPrefLoan (const KivaModel *this, KivaModel_PrefLoan_CIter *) |
|
Adds a new country to the list of Kiva-recognized countries. The countryId and countryName parameters are copied; ownership of those parameters is not transferred by this function. The caller is still responsible for freeing that data.
- Parameters
-
[in,out] | this | Pointer to KivaModel; must be already allocated |
[in] | countryId | ID of the country to add; a two-character ISO-3361 country code |
[in] | countryName | Name of the country to add |
Adds a country ID to the list of countries supported by the lender.
- Parameters
-
[in,out] | this | Pointer to KivaModel; must be already allocated |
[in] | countryId | ID of the country to add; a two-character ISO-3361 country code. Ownership is not transferred from the caller, so the caller should free this variable. If the countryId is not yet in the list of recognized Kiva countries, then it will be added to the hash. |
[in] | countryName | Name of the country to add. If countryId is already a recognized Kiva country, then the countryName will be ignored. If the countryId is not yet in the list of countries that this KivaModel recognizes, then this will be the new country name for this ID. If NULL, then the countryId will be used as the name. Ownership is not transferred from the caller, so the caller should free this variable. |
Adds a new loan to the list of preferred loans. Preferred loans are a list of fundraising loans in which the lender has indicated an interest. The heap-allocated members of loanInfo are copied; ownership of those parameters is not transferred by this function. The caller is still responsible for freeing that data.
- Parameters
-
[in,out] | this | Pointer to KivaModel; must be already allocated |
[in] | loanInfo | information about the preferred loan |
Clears the list of preferred loans, freeing all heap-allocated members of LoanInfo data. Preferred loans are a list of fundraising loans in which the lender has indicated an interest.
- Parameters
-
[in,out] | this | Pointer to KivaModel; must be already allocated |
KivaModel* KivaModel_create |
( |
const char * |
lenderId | ) |
|
Constructor
- Parameters
-
[in] | lenderId | Pointer to the lender ID C-string. Identifies the lender uniquely on kiva.org. Ownership is not transferred to this function, so the caller is still responsible for freeing this variable. |
Destroys KivaModel and frees allocated memory.
- Parameters
-
[in,out] | this | Pointer to KivaModel; must be already allocated |
Used to iterate through the list of preferred loans.
printf("Loan #%d Name: %s\n", plIter->idx, plIter->data->name);
}
- Parameters
-
[in,out] | this | Pointer to KivaModel; must be already allocated |
- Returns
- NULL if there are no preferred loans in this KivaModel a valid iterator for the first preferred loan in this KivaModel If a valid iterator, is returned, ownership of the iterator pointer's memory is transferred to the caller, and the caller is responsible for freeing it, in one of the following ways:
Provides a pointer to the country name identified by the specified ID.
- Parameters
-
[in,out] | this | Pointer to KivaModel; must be already allocated |
[in] | countryId | ID of the country to add; a two-character ISO-3361 country code. Ownership of this parameter is not transferred, so the caller is still responsible for freeing this variable. |
[out] | countryName | If the country ID is recognized by this KivaModel, this parameter will be replaced with a pointer to the recognized country name. Must be NULL upon entry to this function. If the country ID is not recognized, then this parameter will remain NULL. Caller does not own (should not free) the memory associated with countryName. |
- Returns
- MPA_SUCCESS on success MPA_INVALID_INPUT_ERR if countryName is not NULL on entry
Gets the quantity of countries actively served by Kiva.
- Parameters
-
[in,out] | this | Pointer to KivaModel; must be already allocated |
[out] | kivaCountryQty | Pointer to the Kiva country quantity int variable |
Gets a list of country codes relative to the registered lender.
- Parameters
-
[in,out] | this | Pointer to KivaModel; must be already allocated |
[in] | support | If true, returns a list of country codes that registered lender has supported with loans. If false, returns a list of country codes that the registered lender has NOT yet supported with loans. |
[out] | countryCodes | If countries exist that meet the support criteria relative to the lender in this KivaModel, then this parameter will be replaced with a pointer to a string of comma- separated country codes. Must be NULL upon entry to this function. If there are no countries that meet the criteria, then this parameter will remain NULL. Ownership of this string is transferred to the caller after this function call. Caller owns (and must free) the memory associated with countryCodes (if the string is not NULL). |
- Returns
- MPA_SUCCESS on success MPA_INVALID_INPUT_ERR if countryCodes is not NULL on entry
Gets the quantity of countries supported by the registered lender.
- Parameters
-
[in,out] | this | Pointer to KivaModel; must be already allocated |
[out] | lenderCountryQty | Pointer to the lender country quantity int variable |
Gets the currently-stored lender ID.
- Parameters
-
[in,out] | this | Pointer to KivaModel; must be already allocated |
[out] | lenderId | Pointer to the lender ID C-string; must be NULL on entry. Ownership is not transferred to the caller, so the caller should not free this variable. |
Gets the quantity of loans by the registered lender.
- Parameters
-
[in,out] | this | Pointer to KivaModel; must be already allocated |
[out] | lenderQty | Pointer to the lender loan quantity int variable |
Gets the currently-stored lender location.
- Parameters
-
[in,out] | this | Pointer to KivaModel; must be already allocated |
[out] | lenderLoc | Pointer to the lender location C-string; must be NULL on entry. Ownership is not transferred to the caller, so the caller should not free this variable. |
Gets the currently-stored lender name.
- Parameters
-
[in,out] | this | Pointer to KivaModel; must be already allocated |
[out] | lenderName | Pointer to the lender name C-string; must be NULL on entry. Ownership is not transferred to the caller, so the caller should not free this variable. |
Indicates which parts of the data model were modified since the last time the data was retrieved from a "getter" member function.
Returns the number of preferred loans stored in this model.
Preferred loans are a list of fundraising loans in which the lender has indicated an interest.
- Parameters
-
[in,out] | this | Pointer to KivaModel; must be already allocated |
[in,out] | prefLoanQty | The quantity of preferred loans stored |
- Returns
- MPA_SUCCESS on success MPA_NULL_POINTER_ERR if this is NULL
Used to iterate through the list of preferred loans.
- Parameters
-
[in,out] | this | Pointer to KivaModel; must be already allocated |
- Returns
- NULL if there are no more preferred loans in this KivaModel a valid LoanInfo* for the next preferred loan in this KivaModel
Sets the Lender ID and resets any lender-specific data so that it will be NULL or empty until it is reloaded.
- Parameters
-
[in,out] | this | Pointer to KivaModel; must be already allocated |
[in] | lenderId | Pointer to the lender ID C-string. Identifies the lender uniquely on kiva.org. Ownership is not transferred to this function, so the caller is still responsible for freeing this variable. |
Sets the lender location for the registered lender.
- Parameters
-
[in,out] | this | Pointer to KivaModel; must be already allocated |
[in] | lenderName | Pointer to the lender location C-string, as it appears on kiva.org. This is a free format text field. Ownership is not transferred to this function, so the caller is still responsible for freeing this variable. |
Sets the lender name for the registered lender.
- Parameters
-
[in,out] | this | Pointer to KivaModel; must be already allocated |
[in] | lenderName | Pointer to the lender name C-string, as it is written on kiva.org. This may be a first name and last name, but is not limited to that format. Ownership is not transferred to this function, so the caller is still responsible for freeing this variable. |