clear TODO
[www-quvi.git] / Link.cxx
blob452addc324ce8c6e4d9bac409baf5f2c0625ab88
1 /*
2 * Copyright (C) 2010 Toni Gundogdu.
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include <string>
20 #include "Quvi.h"
22 Link::Link () :length_bytes (-1) { }
24 Link::Link (quvi_video_t qv) :length_bytes (-1) {
25 #define _wrap(id,dst,type) \
26 do { type t; quvi_getprop(qv,id,&t); dst=t; } while (0)
27 _wrap(QUVIPROP_VIDEOURL, url, char*);
28 _wrap(QUVIPROP_VIDEOFILECONTENTTYPE, content_type, char*);
29 _wrap(QUVIPROP_VIDEOFILESUFFIX, file_suffix, char*);
30 _wrap(QUVIPROP_VIDEOFILELENGTH, length_bytes, double);
31 #undef _wrap
34 Link::Link (const Link& l) :length_bytes (-1) { _swap (l); }
36 Link& Link::operator=(const Link& l) {
37 if (this != &l) _swap (l);
38 return *this;
41 Link::~Link () { }
43 void
44 Link::_swap (const Link& l) {
45 content_type = l.content_type;
46 file_suffix = l.file_suffix;
47 url = l.url;
48 length_bytes = l.length_bytes;