blob: cc99a0e97d2e3123f8cc0f8e26a7c909d2952f8e [file] [log] [blame]
Alexandre Lision0e143012014-01-22 11:02:46 -05001/* $Id: util.hpp 4704 2014-01-16 05:30:46Z ming $ */
2/*
3 * Copyright (C) 2013 Teluu Inc. (http://www.teluu.com)
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <pjsua2/types.hpp>
21#include <string>
22
23#define PJ2BOOL(var) ((var) != PJ_FALSE)
24
25namespace pj
26{
27using std::string;
28
29inline pj_str_t str2Pj(const string &input_str)
30{
31 pj_str_t output_str;
32 output_str.ptr = (char*)input_str.c_str();
33 output_str.slen = input_str.size();
34 return output_str;
35}
36
37inline string pj2Str(const pj_str_t &input_str)
38{
39 if (input_str.ptr)
40 return string(input_str.ptr, input_str.slen);
41 return string();
42}
43
44
45} // namespace