// // Tizen Web Device API // Copyright (c) 2012 Samsung Electronics Co., Ltd. // // Licensed under the Apache License, Version 2.0 (the License); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #include #include #include "EmailAccountInfo.h" namespace DeviceAPI { namespace Messaging { EmailAccountInfo::EmailAccountInfo(int id, const std::string& name, const std::string& address) : m_name(name), m_address(address) { std::stringstream stream; stream << id; if (stream.fail()) { ThrowMsg(WrtDeviceApis::Commons::UnknownException, "Couldn't convert e-mail account id"); } m_id = stream.str(); } EmailAccountInfo::EmailAccountInfo(const std::string& id, const std::string& name, const std::string& address) : m_id(id), m_name(name), m_address(address) { } int EmailAccountInfo::getIntId() const { int result = 0; std::stringstream stream(m_id); stream >> result; if (stream.fail()) { ThrowMsg(WrtDeviceApis::Commons::UnknownException, "Couldn't convert e-mail account id"); } return result; } std::string EmailAccountInfo::getId() const { return m_id; } std::string EmailAccountInfo::getName() const { return m_name; } std::string EmailAccountInfo::getAddress() const { return m_address; } const bool EmailAccountInfo::operator==(const EmailAccountInfo& account) const { return (m_id == account.m_id && m_name == account.m_name && m_address == account.m_address); } } }