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))
36 //! \brief Returns true if iri is valid
37 bool Wrapper::Validate()
41 m_Iri->scheme != NULL && (
42 m_Iri->display != NULL ||
43 m_Iri->user != NULL ||
44 m_Iri->auth != NULL ||
45 m_Iri->password != NULL ||
46 m_Iri->host != NULL ||
47 m_Iri->path != NULL ||
48 m_Iri->query != NULL ||
49 m_Iri->anchor != NULL ||
50 m_Iri->qparams != NULL ||
51 m_Iri->schemelist != NULL);
54 std::ostream & operator<<(std::ostream& a_stream,
55 const Wrapper& a_wrapper)
57 iri_t& iri = *a_wrapper.m_Iri;
58 #define PRINT_FIELD(field) "] " # field " [" << (iri.field ? iri.field : "null")
60 " display [" << (iri.display ? iri.display : "null") <<
61 PRINT_FIELD(scheme) <<
64 PRINT_FIELD(password) <<
66 "] port [" << (iri.port ? iri.port : -1) <<
69 PRINT_FIELD(anchor) <<