/src/cyad/DispatcherIO.cpp
https://gitlab.com/github-cloud-corporation/cynara · C++ · 40 lines · 14 code · 5 blank · 21 comment · 3 complexity · a21c19c865d70c038da59f10801cb2ea MD5 · raw file
- /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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.
- */
- /**
- * @file src/cyad/DispatcherIO.cpp
- * @author Aleksander Zdyb <a.zdyb@samsung.com>
- * @version 1.0
- * @brief Aggregates I/O methods
- */
- #include <fstream>
- #include "DispatcherIO.h"
- namespace Cynara {
- BaseDispatcherIO::InputStreamPtr DispatcherIO::openFile(const BaseDispatcherIO::Filename &filename)
- {
- BaseDispatcherIO::InputStreamPtr streamPtr;
- if (filename == "-") {
- streamPtr.reset(&std::cin, [] (BaseDispatcherIO::InputStreamPtr::element_type *) {});
- } else {
- streamPtr.reset(new std::ifstream(filename));
- }
- return streamPtr;
- }
- } /* namespace Cynara */