libini_config  0.6.1
ini_configmod.h
1 /*
2  INI LIBRARY
3 
4  Interface that allows modification of the INI file.
5 
6  Copyright (C) Dmitri Pal <dpal@redhat.com> 2014
7 
8  INI Library is free software: you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  INI Library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License
19  along with INI Library. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #ifndef INI_CONFIGMOD_H
23 #define INI_CONFIGMOD_H
24 
25 
40 enum INI_VA {
67 
81 
95 
102 
108 };
195 int ini_config_add_section(struct ini_cfgobj *ini_config,
196  const char *section,
197  const char *comments[],
198  size_t count_comment,
199  int position,
200  const char *other_section,
201  int idx);
202 
224 int ini_config_comment_section(struct ini_cfgobj *ini_config,
225  const char *section,
226  const char *comments[],
227  size_t count_comment);
228 
243 int ini_config_rename_section(struct ini_cfgobj *ini_config,
244  const char *section,
245  const char *newname);
246 
247 
262 int ini_config_delete_section_by_name(struct ini_cfgobj *ini_config,
263  const char *section);
264 
299 int ini_config_delete_section_by_position(struct ini_cfgobj *ini_config,
300  int position,
301  const char *section,
302  int idx);
303 
304 
361 int ini_config_add_str_value(struct ini_cfgobj *ini_config,
362  const char *section,
363  const char *key,
364  const char *value,
365  const char *comments[],
366  size_t count_comment,
367  int border,
368  int position,
369  const char *other_key,
370  int idx,
371  enum INI_VA flags);
372 
381 int ini_config_add_int_value(struct ini_cfgobj *ini_config,
382  const char *section,
383  const char *key,
384  int value,
385  const char *comments[],
386  size_t count_comment,
387  int border,
388  int position,
389  const char *other_key,
390  int idx,
391  enum INI_VA flags);
392 
401 int ini_config_add_long_value(struct ini_cfgobj *ini_config,
402  const char *section,
403  const char *key,
404  long value,
405  const char *comments[],
406  size_t count_comment,
407  int border,
408  int position,
409  const char *other_key,
410  int idx,
411  enum INI_VA flags);
412 
421 int ini_config_add_ulong_value(struct ini_cfgobj *ini_config,
422  const char *section,
423  const char *key,
424  unsigned long value,
425  const char *comments[],
426  size_t count_comment,
427  int border,
428  int position,
429  const char *other_key,
430  int idx,
431  enum INI_VA flags);
432 
441 int ini_config_add_unsigned_value(struct ini_cfgobj *ini_config,
442  const char *section,
443  const char *key,
444  unsigned value,
445  const char *comments[],
446  size_t count_comment,
447  int border,
448  int position,
449  const char *other_key,
450  int idx,
451  enum INI_VA flags);
452 
461 int ini_config_add_int32_value(struct ini_cfgobj *ini_config,
462  const char *section,
463  const char *key,
464  int32_t value,
465  const char *comments[],
466  size_t count_comment,
467  int border,
468  int position,
469  const char *other_key,
470  int idx,
471  enum INI_VA flags);
472 
481 int ini_config_add_uint32_value(struct ini_cfgobj *ini_config,
482  const char *section,
483  const char *key,
484  uint32_t value,
485  const char *comments[],
486  size_t count_comment,
487  int border,
488  int position,
489  const char *other_key,
490  int idx,
491  enum INI_VA flags);
492 
501 int ini_config_add_int64_value(struct ini_cfgobj *ini_config,
502  const char *section,
503  const char *key,
504  int64_t value,
505  const char *comments[],
506  size_t count_comment,
507  int border,
508  int position,
509  const char *other_key,
510  int idx,
511  enum INI_VA flags);
512 
521 int ini_config_add_uint64_value(struct ini_cfgobj *ini_config,
522  const char *section,
523  const char *key,
524  uint64_t value,
525  const char *comments[],
526  size_t count_comment,
527  int border,
528  int position,
529  const char *other_key,
530  int idx,
531  enum INI_VA flags);
532 
541 int ini_config_add_double_value(struct ini_cfgobj *ini_config,
542  const char *section,
543  const char *key,
544  double value,
545  const char *comments[],
546  size_t count_comment,
547  int border,
548  int position,
549  const char *other_key,
550  int idx,
551  enum INI_VA flags);
552 
566 int ini_config_add_bin_value(struct ini_cfgobj *ini_config,
567  const char *section,
568  const char *key,
569  void *value,
570  size_t value_len,
571  const char *comments[],
572  size_t count_comment,
573  int border,
574  int position,
575  const char *other_key,
576  int idx,
577  enum INI_VA flags);
578 
588 int ini_config_add_const_str_arr_value(struct ini_cfgobj *ini_config,
589  const char *section,
590  const char *key,
591  const char *value_str_arr[],
592  size_t count_str,
593  char sep,
594  const char *comments[],
595  size_t count_comment,
596  int border,
597  int position,
598  const char *other_key,
599  int idx,
600  enum INI_VA flags);
601 
611 int ini_config_add_str_arr_value(struct ini_cfgobj *ini_config,
612  const char *section,
613  const char *key,
614  char *value_str_arr[],
615  size_t count_str,
616  char sep,
617  const char *comments[],
618  size_t count_comment,
619  int border,
620  int position,
621  const char *other_key,
622  int idx,
623  enum INI_VA flags);
624 
634 int ini_config_add_int_arr_value(struct ini_cfgobj *ini_config,
635  const char *section,
636  const char *key,
637  int *value_int_arr,
638  size_t count_int,
639  char sep,
640  const char *comments[],
641  size_t count_comment,
642  int border,
643  int position,
644  const char *other_key,
645  int idx,
646  enum INI_VA flags);
647 
657 int ini_config_add_long_arr_value(struct ini_cfgobj *ini_config,
658  const char *section,
659  const char *key,
660  long *value_long_arr,
661  size_t count_long,
662  char sep,
663  const char *comments[],
664  size_t count_comment,
665  int border,
666  int position,
667  const char *other_key,
668  int idx,
669  enum INI_VA flags);
670 
680 int ini_config_add_double_arr_value(struct ini_cfgobj *ini_config,
681  const char *section,
682  const char *key,
683  double *value_double_arr,
684  size_t count_double,
685  char sep,
686  const char *comments[],
687  size_t count_comment,
688  int border,
689  int position,
690  const char *other_key,
691  int idx,
692  enum INI_VA flags);
693 
724 int ini_config_delete_value(struct ini_cfgobj *ini_config,
725  const char *section,
726  int position,
727  const char *key,
728  int idx);
729 
758 int ini_config_update_comment(struct ini_cfgobj *ini_config,
759  const char *section,
760  const char *key,
761  const char *comments[],
762  size_t count_comment,
763  int idx);
767 #endif
Clean all duplicates.
Definition: ini_configmod.h:101
int ini_config_add_double_value(struct ini_cfgobj *ini_config, const char *section, const char *key, double value, const char *comments[], size_t count_comment, int border, int position, const char *other_key, int idx, enum INI_VA flags)
Function to add a double value to a particular section.
int ini_config_update_comment(struct ini_cfgobj *ini_config, const char *section, const char *key, const char *comments[], size_t count_comment, int idx)
Function to update a comment.
int ini_config_add_bin_value(struct ini_cfgobj *ini_config, const char *section, const char *key, void *value, size_t value_len, const char *comments[], size_t count_comment, int border, int position, const char *other_key, int idx, enum INI_VA flags)
Function to add a binary value to a particular section.
Error if duplicate.
Definition: ini_configmod.h:107
Update or add if not found (with error).
Definition: ini_configmod.h:94
INI_VA
Definition: ini_configmod.h:40
int ini_config_add_str_arr_value(struct ini_cfgobj *ini_config, const char *section, const char *key, char *value_str_arr[], size_t count_str, char sep, const char *comments[], size_t count_comment, int border, int position, const char *other_key, int idx, enum INI_VA flags)
Function to add a value that consists of an array of strings to a particular section.
int ini_config_add_str_value(struct ini_cfgobj *ini_config, const char *section, const char *key, const char *value, const char *comments[], size_t count_comment, int border, int position, const char *other_key, int idx, enum INI_VA flags)
Function to a add string value to a particular section.
int ini_config_add_section(struct ini_cfgobj *ini_config, const char *section, const char *comments[], size_t count_comment, int position, const char *other_section, int idx)
Function to add a section.
int ini_config_delete_value(struct ini_cfgobj *ini_config, const char *section, int position, const char *key, int idx)
Function to delete a value.
int ini_config_add_ulong_value(struct ini_cfgobj *ini_config, const char *section, const char *key, unsigned long value, const char *comments[], size_t count_comment, int border, int position, const char *other_key, int idx, enum INI_VA flags)
Function to add an unsigned long value to a particular section.
int ini_config_add_int32_value(struct ini_cfgobj *ini_config, const char *section, const char *key, int32_t value, const char *comments[], size_t count_comment, int border, int position, const char *other_key, int idx, enum INI_VA flags)
Function to add an int32 value to a particular section.
Update a specific value (best effort).
Definition: ini_configmod.h:56
int ini_config_add_unsigned_value(struct ini_cfgobj *ini_config, const char *section, const char *key, unsigned value, const char *comments[], size_t count_comment, int border, int position, const char *other_key, int idx, enum INI_VA flags)
Function to add an unsigned value to a particular section.
int ini_config_add_int64_value(struct ini_cfgobj *ini_config, const char *section, const char *key, int64_t value, const char *comments[], size_t count_comment, int border, int position, const char *other_key, int idx, enum INI_VA flags)
Function to add an int64 value to a particular section.
int ini_config_comment_section(struct ini_cfgobj *ini_config, const char *section, const char *comments[], size_t count_comment)
Function to update a comment for a section.
int ini_config_add_long_value(struct ini_cfgobj *ini_config, const char *section, const char *key, long value, const char *comments[], size_t count_comment, int border, int position, const char *other_key, int idx, enum INI_VA flags)
Function to add a long value to a particular section.
int ini_config_add_uint64_value(struct ini_cfgobj *ini_config, const char *section, const char *key, uint64_t value, const char *comments[], size_t count_comment, int border, int position, const char *other_key, int idx, enum INI_VA flags)
Function to add an uint64 value to a particular section.
No check.
Definition: ini_configmod.h:46
int ini_config_rename_section(struct ini_cfgobj *ini_config, const char *section, const char *newname)
Function to rename a section.
int ini_config_add_uint32_value(struct ini_cfgobj *ini_config, const char *section, const char *key, uint32_t value, const char *comments[], size_t count_comment, int border, int position, const char *other_key, int idx, enum INI_VA flags)
Function to add an uint32 value to a particular section.
Update or add if not found (best effort).
Definition: ini_configmod.h:80
int ini_config_delete_section_by_name(struct ini_cfgobj *ini_config, const char *section)
Function to delete a section by name.
Update a specific value (with error).
Definition: ini_configmod.h:66
int ini_config_add_const_str_arr_value(struct ini_cfgobj *ini_config, const char *section, const char *key, const char *value_str_arr[], size_t count_str, char sep, const char *comments[], size_t count_comment, int border, int position, const char *other_key, int idx, enum INI_VA flags)
Function to add a value that consists of an array of constant strings to a particular section.
int ini_config_delete_section_by_position(struct ini_cfgobj *ini_config, int position, const char *section, int idx)
Function to delete a section by position or name.
int ini_config_add_long_arr_value(struct ini_cfgobj *ini_config, const char *section, const char *key, long *value_long_arr, size_t count_long, char sep, const char *comments[], size_t count_comment, int border, int position, const char *other_key, int idx, enum INI_VA flags)
Function to add a value that consists of an array of long integers to a particular section.
int ini_config_add_int_arr_value(struct ini_cfgobj *ini_config, const char *section, const char *key, int *value_int_arr, size_t count_int, char sep, const char *comments[], size_t count_comment, int border, int position, const char *other_key, int idx, enum INI_VA flags)
Function to add a value that consists of an array of integers to a particular section.
int ini_config_add_double_arr_value(struct ini_cfgobj *ini_config, const char *section, const char *key, double *value_double_arr, size_t count_double, char sep, const char *comments[], size_t count_comment, int border, int position, const char *other_key, int idx, enum INI_VA flags)
Function to add a value that consists of an array of doubles to a particular section.
int ini_config_add_int_value(struct ini_cfgobj *ini_config, const char *section, const char *key, int value, const char *comments[], size_t count_comment, int border, int position, const char *other_key, int idx, enum INI_VA flags)
Function to add an integer value to a particular section.