/* * Copyright (c) 2017 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 "idlc/type.h" namespace tidl { Token::Token(std::string name, std::string comments) : name_(std::move(name)), comments_(std::move(comments)) { } BaseType::BaseType(std::string name, std::string comments, bool user_defined) : Token(std::move(name), std::move(comments)), user_defined_(user_defined) { } BaseType::BaseType(const BaseType& type) : Token(type.ToString(), type.GetComments()), user_defined_(type.IsUserDefinedType()) { if (type.GetMetaType() != nullptr) { SetMetaType(new BaseType(*type.GetMetaType())); } } void BaseType::SetMetaType(BaseType* type) { meta_type_.reset(type); } ParameterType::ParameterType(BaseType* type) : type_(type), dir_(Direction::IN) { } ParameterType::ParameterType(BaseType* type, const std::string& dir) : type_(type) { if (dir == "in") dir_ = Direction::IN; else if (dir == "out") dir_ = Direction::OUT; else if (dir == "ref") dir_ = Direction::REF; else dir_ = Direction::IN; } } // namespace tidl