variables.h 2.34 KB
Newer Older
1 2 3
/*
    This file is part of darktable,
    copyright (c) 2010 henrik andersson.
4
    copyright (c) 2010--2017 tobias ellinghaus.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

    darktable 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.

    darktable 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 darktable.  If not, see <http://www.gnu.org/licenses/>.
*/

20
#pragma once
21

22
#include <glib.h>
23 24
#include <stdint.h>

25
typedef struct dt_variables_params_t
26
{
27
  /** used for expanding variables that uses filename $(FILE_FOLDER) $(FILE_NAME) and $(FILE_EXTENSION). */
28
  const gchar *filename;
29

Henrik Andersson's avatar
Henrik Andersson committed
30
  /** used for expanding variable $(JOBCODE) */
31
  const gchar *jobcode;
32

33
  /** used for expanding variables such as $(IMAGE_WIDTH) $(IMAGE_HEIGHT). */
34
  uint32_t imgid;
35

36 37 38
  /** used as thread-safe sequence number. only used if >= 0. */
  int sequence;

39
  /** internal variables data */
40
  struct dt_variables_data_t *data;
41

42
} dt_variables_params_t;
43

Henrik Andersson's avatar
Henrik Andersson committed
44
/** allocate and initializes a dt_variables_params_t. */
45
void dt_variables_params_init(dt_variables_params_t **params);
Henrik Andersson's avatar
Henrik Andersson committed
46
/** destroys an initialized dt_variables_params_t, pointer is garbage after this call. */
47
void dt_variables_params_destroy(dt_variables_params_t *params);
48 49
/** set the time in a dt_variables_params_t. */
void dt_variables_set_time(dt_variables_params_t *params, time_t time);
50 51
/** set the time to use for EXIF variables */
void dt_variables_set_exif_time(dt_variables_params_t *params, time_t time);
52

53 54
/** expands variables in string. the result should be freed with g_free(). */
char *dt_variables_expand(dt_variables_params_t *params, gchar *source, gboolean iterate);
55 56 57
/** reset sequence number */
void dt_variables_reset_sequence(dt_variables_params_t *params);

58 59
// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.sh
// vim: shiftwidth=2 expandtab tabstop=2 cindent
Tobias Ellinghaus's avatar
Tobias Ellinghaus committed
60
// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;