2 * Copyright (C) 2011 Sansar Choinyambuu
4 * Copyright (C) secunet Security Networks AG
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 #include "pts_file_meta.h"
19 #include <collections/linked_list.h>
20 #include <utils/debug.h>
22 typedef struct private_pts_file_meta_t private_pts_file_meta_t
;
25 * Private data of a pts_file_meta_t object.
28 struct private_pts_file_meta_t
{
31 * Public pts_file_meta_t interface.
33 pts_file_meta_t
public;
36 * List of File Metadata
42 * Free an pts_file_metadata_t object
44 static void free_entry(pts_file_metadata_t
*entry
)
48 free(entry
->filename
);
53 METHOD(pts_file_meta_t
, get_file_count
, int,
54 private_pts_file_meta_t
*this)
56 return this->list
->get_count(this->list
);
59 METHOD(pts_file_meta_t
, add
, void,
60 private_pts_file_meta_t
*this, pts_file_metadata_t
*metadata
)
62 this->list
->insert_last(this->list
, metadata
);
65 METHOD(pts_file_meta_t
, create_enumerator
, enumerator_t
*,
66 private_pts_file_meta_t
*this)
68 return this->list
->create_enumerator(this->list
);
71 METHOD(pts_file_meta_t
, destroy
, void,
72 private_pts_file_meta_t
*this)
74 this->list
->destroy_function(this->list
, (void *)free_entry
);
81 pts_file_meta_t
*pts_file_meta_create()
83 private_pts_file_meta_t
*this;
87 .get_file_count
= _get_file_count
,
89 .create_enumerator
= _create_enumerator
,
92 .list
= linked_list_create(),