gwenhywfar  5.10.1
htmlimage.c
Go to the documentation of this file.
1 /***************************************************************************
2  begin : Fri Jul 16 2010
3  copyright : (C) 2010 by Martin Preuss
4  email : martin@libchipcard.de
5 
6  ***************************************************************************
7  * Please see toplevel file COPYING for license details *
8  ***************************************************************************/
9 
10 #ifdef HAVE_CONFIG_H
11 # include <config.h>
12 #endif
13 
14 #define DISABLE_DEBUGLOG
15 
16 
17 #include "htmlimage_p.h"
18 
19 
20 
23 
24 
26 {
27  HTML_IMAGE *img;
28 
30  img->refCount=1;
33 
34  return img;
35 }
36 
37 
38 
40 {
41  if (img) {
42  assert(img->refCount);
43  if (img->refCount>1)
44  img->refCount--;
45  else {
48  free(img->imageName);
49 
50  img->refCount=0;
51  GWEN_FREE_OBJECT(img);
52  }
53  }
54 }
55 
56 
57 
59 {
60  assert(img);
61  assert(img->refCount);
62  img->refCount++;
63 }
64 
65 
66 
67 const char *HtmlImage_GetImageName(const HTML_IMAGE *img)
68 {
69  assert(img);
70  assert(img->refCount);
71  return img->imageName;
72 }
73 
74 
75 
76 void HtmlImage_SetImageName(HTML_IMAGE *img, const char *s)
77 {
78  assert(img);
79  assert(img->refCount);
80  free(img->imageName);
81  if (s)
82  img->imageName=strdup(s);
83  else
84  img->imageName=NULL;
85 }
86 
87 
88 
90 {
91  assert(img);
92  assert(img->refCount);
93  return img->width;
94 }
95 
96 
97 
98 void HtmlImage_SetWidth(HTML_IMAGE *img, int i)
99 {
100  assert(img);
101  assert(img->refCount);
102  img->width=i;
103 }
104 
105 
106 
108 {
109  assert(img);
110  assert(img->refCount);
111  return img->height;
112 }
113 
114 
115 
117 {
118  assert(img);
119  assert(img->refCount);
120  img->height=i;
121 }
122 
123 
124 
void HtmlImage_SetImageName(HTML_IMAGE *img, const char *s)
Definition: htmlimage.c:76
#define GWEN_INHERIT_FINI(t, element)
Definition: inherit.h:238
void HtmlImage_Attach(HTML_IMAGE *img)
Definition: htmlimage.c:58
int HtmlImage_GetWidth(const HTML_IMAGE *img)
Definition: htmlimage.c:89
#define GWEN_FREE_OBJECT(varname)
Definition: memory.h:61
#define NULL
Definition: binreloc.c:300
void HtmlImage_SetHeight(HTML_IMAGE *img, int i)
Definition: htmlimage.c:116
void HtmlImage_free(HTML_IMAGE *img)
Definition: htmlimage.c:39
#define GWEN_NEW_OBJECT(typ, varname)
Definition: memory.h:55
struct HTML_IMAGE HTML_IMAGE
Definition: htmlimage_be.h:23
#define GWEN_INHERIT_INIT(t, element)
Definition: inherit.h:223
int HtmlImage_GetHeight(const HTML_IMAGE *img)
Definition: htmlimage.c:107
void HtmlImage_SetWidth(HTML_IMAGE *img, int i)
Definition: htmlimage.c:98
const char * HtmlImage_GetImageName(const HTML_IMAGE *img)
Definition: htmlimage.c:67
#define GWEN_LIST_INIT(t, element)
Definition: list1.h:465
HTML_IMAGE * HtmlImage_new(void)
Definition: htmlimage.c:25
#define GWEN_LIST_FUNCTIONS(t, pr)
Definition: list1.h:366
#define GWEN_LIST_FINI(t, element)
Definition: list1.h:474
#define GWEN_INHERIT_FUNCTIONS(t)
Definition: inherit.h:163