Remove a set of kvp_frame functions which are unused throughout gnucash.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20516 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2011-04-02 20:17:42 +00:00
parent 82167d6a78
commit 79e7c77b39
2 changed files with 6 additions and 188 deletions

View File

@ -168,7 +168,7 @@ kvp_frame_copy(const KvpFrame * frame)
* Passing in a null value into this routine has the effect of * Passing in a null value into this routine has the effect of
* removing the key from the KVP tree. * removing the key from the KVP tree.
*/ */
KvpValue * static KvpValue *
kvp_frame_replace_slot_nc (KvpFrame * frame, const char * slot, kvp_frame_replace_slot_nc (KvpFrame * frame, const char * slot,
KvpValue * new_value) KvpValue * new_value)
{ {
@ -524,7 +524,7 @@ kvp_frame_replace_value_nc (KvpFrame * frame, const char * key_path,
/* ============================================================ */ /* ============================================================ */
KvpFrame * static KvpFrame *
kvp_frame_add_value_nc(KvpFrame * frame, const char * path, KvpValue *value) kvp_frame_add_value_nc(KvpFrame * frame, const char * path, KvpValue *value)
{ {
char *key = NULL; char *key = NULL;
@ -568,88 +568,6 @@ kvp_frame_add_value_nc(KvpFrame * frame, const char * path, KvpValue *value)
return frame; return frame;
} }
KvpFrame *
kvp_frame_add_value(KvpFrame * frame, const char * path, KvpValue *value)
{
value = kvp_value_copy (value);
frame = kvp_frame_add_value_nc (frame, path, value);
if (!frame) kvp_value_delete (value);
return frame;
}
void
kvp_frame_add_gint64(KvpFrame * frame, const char * path, gint64 ival)
{
KvpValue *value;
value = kvp_value_new_gint64 (ival);
frame = kvp_frame_add_value_nc (frame, path, value);
if (!frame) kvp_value_delete (value);
}
void
kvp_frame_add_double(KvpFrame * frame, const char * path, double dval)
{
KvpValue *value;
value = kvp_value_new_double (dval);
frame = kvp_frame_add_value_nc (frame, path, value);
if (!frame) kvp_value_delete (value);
}
void
kvp_frame_add_numeric(KvpFrame * frame, const char * path, gnc_numeric nval)
{
KvpValue *value;
value = kvp_value_new_gnc_numeric (nval);
frame = kvp_frame_add_value_nc (frame, path, value);
if (!frame) kvp_value_delete (value);
}
void
kvp_frame_add_gdate(KvpFrame * frame, const char * path, GDate nval)
{
KvpValue *value;
value = kvp_value_new_gdate (nval);
frame = kvp_frame_add_value_nc (frame, path, value);
if (!frame) kvp_value_delete (value);
}
void
kvp_frame_add_string(KvpFrame * frame, const char * path, const char* str)
{
KvpValue *value;
value = kvp_value_new_string (str);
frame = kvp_frame_add_value_nc (frame, path, value);
if (!frame) kvp_value_delete (value);
}
void
kvp_frame_add_guid(KvpFrame * frame, const char * path, const GncGUID *guid)
{
KvpValue *value;
value = kvp_value_new_guid (guid);
frame = kvp_frame_add_value_nc (frame, path, value);
if (!frame) kvp_value_delete (value);
}
void
kvp_frame_add_timespec(KvpFrame * frame, const char * path, Timespec ts)
{
KvpValue *value;
value = kvp_value_new_timespec (ts);
frame = kvp_frame_add_value_nc (frame, path, value);
if (!frame) kvp_value_delete (value);
}
void
kvp_frame_add_frame(KvpFrame * frame, const char * path, KvpFrame *fr)
{
KvpValue *value;
value = kvp_value_new_frame (fr);
frame = kvp_frame_add_value_nc (frame, path, value);
if (!frame) kvp_value_delete (value);
}
void void
kvp_frame_add_frame_nc(KvpFrame * frame, const char * path, KvpFrame *fr) kvp_frame_add_frame_nc(KvpFrame * frame, const char * path, KvpFrame *fr)
{ {
@ -848,37 +766,6 @@ decode (char *enc)
} }
} }
void
kvp_frame_add_url_encoding (KvpFrame *frame, const char *enc)
{
char *buff, *p;
if (!frame || !enc) return;
/* Loop over all key-value pairs in the encoded string */
buff = g_strdup (enc);
p = buff;
while (*p)
{
char *n, *v;
n = strchr (p, '&'); /* n = next key-value */
if (n) *n = 0x0;
v = strchr (p, '='); /* v = pointer to value */
if (!v) break;
*v = 0x0;
v ++;
decode (p);
decode (v);
kvp_frame_set_slot_nc (frame, p, kvp_value_new_string(v));
if (!n) break; /* no next key, we are done */
p = ++n;
}
g_free(buff);
}
/* ============================================================ */ /* ============================================================ */

View File

@ -236,58 +236,12 @@ KvpFrame * kvp_frame_set_value_nc(KvpFrame * frame,
KvpValue * kvp_frame_replace_value_nc (KvpFrame * frame, const gchar * slot, KvpValue * kvp_frame_replace_value_nc (KvpFrame * frame, const gchar * slot,
KvpValue * new_value); KvpValue * new_value);
/** @} */ /** @} */
/** @name KvpFrame URL handling
@{
*/
/** The kvp_frame_add_url_encoding() routine will parse the
* value string, assuming it to be URL-encoded in the standard way,
* turning it into a set of key-value pairs, and adding those to the
* indicated frame. URL-encoded strings are the things that are
* returned by web browsers when a form is filled out. For example,
* 'start-date=June&end-date=November' consists of two keys,
* 'start-date' and 'end-date', which have the values 'June' and
* 'November', respectively. This routine also handles % encoding.
*
* This routine treats all values as strings; it does *not* attempt
* to perform any type-conversion.
* */
void kvp_frame_add_url_encoding (KvpFrame *frame, const gchar *enc);
/** @} */
/** @name KvpFrame Glist Bag Storing /** @name KvpFrame Glist Bag Storing
@{ @{
*/ */
/** The kvp_frame_add_gint64() routine will add the value of the /** \brief Store the given kvp_frame to the glist bag at the indicated path (non-copying)
* gint64 to the glist bag of values at the indicated path.
* If not all frame components of the path exist, they are
* created. If the value previously stored at this path was
* not a glist bag, then a bag will be formed there, the old
* value placed in the bag, and the new value added to the bag.
*
* Similarly, the add_double, add_numeric, and add_timespec
* routines perform the same function, for each of the respective
* types.
*/
void kvp_frame_add_gint64(KvpFrame * frame, const gchar * path, gint64 ival);
void kvp_frame_add_double(KvpFrame * frame, const gchar * path, double dval);
/** \deprecated
Use kvp_frame_add_numeric instead of kvp_frame_add_gnc_numeric
*/
#define kvp_frame_add_gnc_numeric kvp_frame_add_numeric
void kvp_frame_add_numeric(KvpFrame * frame, const gchar * path, gnc_numeric nval);
void kvp_frame_add_timespec(KvpFrame * frame, const gchar * path, Timespec ts);
void kvp_frame_add_gdate(KvpFrame * frame, const gchar * path, GDate date);
/** \deprecated
Use kvp_frame_add_string instead of kvp_frame_add_str
*/
#define kvp_frame_add_str kvp_frame_add_string
/** \brief Copy of the string to the glist bag at the indicated path.
* If not all frame components * If not all frame components
* of the path exist, they are created. If there was another * of the path exist, they are created. If there was another
@ -295,33 +249,10 @@ Use kvp_frame_add_string instead of kvp_frame_add_str
* to a bag, and the old value, along with the new value, is added * to a bag, and the old value, along with the new value, is added
* to the bag. * to the bag.
* *
* Similarly, the add_guid and add_frame will make copies and * This method does *NOT* copy the frame.
* add those.
*
* The kvp_frame_add_frame_nc() routine works as above, but does
* *NOT* copy the frame.
*/ */
void kvp_frame_add_string(KvpFrame * frame, const gchar * path, const gchar* str);
void kvp_frame_add_guid(KvpFrame * frame, const gchar * path, const GncGUID *guid);
void kvp_frame_add_frame(KvpFrame *frame, const gchar *path, KvpFrame *chld);
void kvp_frame_add_frame_nc(KvpFrame *frame, const gchar *path, KvpFrame *chld); void kvp_frame_add_frame_nc(KvpFrame *frame, const gchar *path, KvpFrame *chld);
/* The kvp_frame_add_value() routine will add a copy of the value
* to the glist bag at the indicated path. If not all frame components
* of the path exist, they are created. If there was another
* item previously stored at that path, then the path is converted
* to a bag, and the old value, along with the new value, is added
* to the bag. This routine returns the pointer to the last frame
* (the actual frame to which the value was added), or NULL if there
* was an error of any sort (typically, a parse error in the path).
*
* The *_nc() routine is analogous, except that it doesn't copy the
* value.
*/
KvpFrame * kvp_frame_add_value(KvpFrame * frame, const gchar * path, KvpValue *value);
KvpFrame * kvp_frame_add_value_nc(KvpFrame * frame, const gchar * path, KvpValue *value);
/** @} */ /** @} */
@ -443,8 +374,8 @@ You probably shouldn't be using these low-level routines
* Passing in a NULL new_value has the effect of deleting that * Passing in a NULL new_value has the effect of deleting that
* slot. * slot.
*/ */
KvpValue * kvp_frame_replace_slot_nc (KvpFrame * frame, const gchar * slot, /* KvpValue * kvp_frame_replace_slot_nc (KvpFrame * frame, const gchar * slot, */
KvpValue * new_value); /* KvpValue * new_value); */
/** The kvp_frame_set_slot() routine copies the value into the frame, /** The kvp_frame_set_slot() routine copies the value into the frame,