2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file libiriwrapper.cpp
18 * @author Piotr Marcinkiewicz (p.marcinkiew@samsung.com
20 * @brief Libiri parser wrapper
24 #include "libiriwrapper.h"
26 //TODO: Design and implement new IRI manager class
29 Wrapper::Wrapper(const char* aIri) : m_Iri(iri_parse(aIri))
35 //! \brief Returns true if iri is valid
36 bool Wrapper::Validate()
40 m_Iri->scheme != NULL && (
41 m_Iri->display != NULL ||
42 m_Iri->user != NULL ||
43 m_Iri->auth != NULL ||
44 m_Iri->password != NULL ||
45 m_Iri->host != NULL ||
46 m_Iri->path != NULL ||
47 m_Iri->query != NULL ||
48 m_Iri->anchor != NULL ||
49 m_Iri->qparams != NULL ||
50 m_Iri->schemelist != NULL);
53 std::ostream & operator<<(std::ostream& a_stream,
54 const Wrapper& a_wrapper)
56 iri_t& iri = *a_wrapper.m_Iri;
57 #define PRINT_FIELD(field) "] " #field " [" << (iri.field ? iri.field : "null")
59 " display [" << (iri.display ? iri.display : "null") <<
60 PRINT_FIELD(scheme) <<
63 PRINT_FIELD(password) <<
65 "] port [" << (iri.port ? iri.port : -1) <<
68 PRINT_FIELD(anchor) <<